Reputation: 63
I'm trying to setup YOLO in enthought canopy environment on a windows machine. Since both tensorflow and darkflow don't seem to be available on package manager, I installed them via pip
pip install tensorflow
and after downloading the darkflow directory from github and navigating to it from canopy command prompt
pip install .
and then
python setup.py build_ext --inplace
for the setting up the the cython_utils. Now, the command line demo seems to work fine
python flow --model cfg/yolo.cfg --load bin/yolo.weights --demo videofile.mp4 --saveVideo
but when I try to run the following in my canopy editor:
from darkflow.net.build import TFNet
option = {'model': 'cfg/yolo.cfg', 'load': 'bin/yolo.weights', 'threshold': 0.3}
tfnet = TFNet(option)
It throws me this error:
AssertionError Traceback (most recent call last)
c:\users\umair\appdata\local\temp\tmp9n4e92.py in <module>()
4 option = {'model': 'cfg/yolo.cfg', 'load': 'bin/yolo.weights', 'threshold': 0.3}
5
----> 6 tfnet = TFNet(option)
C:\Users\umair\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\darkflow\net\build.py in __init__(self, FLAGS, darknet)
56
57 if darknet is None:
---> 58 darknet = Darknet(FLAGS)
59 self.ntrain = len(darknet.layers)
60
C:\Users\umair\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\darkflow\dark\darknet.py in __init__(self, FLAGS)
11
12 def __init__(self, FLAGS):
---> 13 self.get_weight_src(FLAGS)
14 self.modify = False
15
C:\Users\umair\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\darkflow\dark\darknet.py in get_weight_src(self, FLAGS)
45 else:
46 assert os.path.isfile(FLAGS.load), \
---> 47 '{} not found'.format(FLAGS.load)
48 self.src_bin = FLAGS.load
49 name = loader.model_name(FLAGS.load)
AssertionError: bin/yolo.weights not found
I tried copying the bin and cfg folder from my original directory where I extracted darkflow to site-packages/darkflow folder:
C:\Users\umair\AppData\Local\Enthought\Canopy\edm\envs\User\Lib\site-packages\darkflow
but that doesn't seem to work either. Ironically, that works perfectly fine in the python console through canopy command prompt
So what's wrong with all this basically? Have I made some mistake in package installation? Missed adding paths somewhere? or I'm placing the bin and cfg folder at incorrect location?
Upvotes: 1
Views: 1742
Reputation: 5810
Sounds like maybe the code is assuming that it is running in the same directory as your script. This cannot be assumed. You can either change the working directory at the ipython prompt in Canopy editor, or you can configure Canopy to do this for you automatically. See the Canopy docs: https://docs.enthought.com/canopy/2.1/quick-start/code_editor.html#change-directory
Upvotes: 1