Tracking-with-darkflow
Tracking-with-darkflow copied to clipboard
ImportError: No module named 'darkflow.cython_utils'
I installed the repo and build dependences on a clean docker container, according to the instructions in the readme.md.
When I executed the python3 run.py
, I got the following error message.
Traceback (most recent call last):
File "run.py", line 5, in <module>
from darkflow.darkflow.net.build import TFNet
File "/workspace/Tracking-with-darkflow/darkflow/darkflow/net/build.py", line 7, in <module>
from .framework import create_framework
File "/workspace/Tracking-with-darkflow/darkflow/darkflow/net/framework.py", line 1, in <module>
from . import yolo
File "/workspace/Tracking-with-darkflow/darkflow/darkflow/net/yolo/__init__.py", line 2, in <module>
from . import predict
File "/workspace/Tracking-with-darkflow/darkflow/darkflow/net/yolo/predict.py", line 9, in <module>
from ...cython_utils.cy_yolo_findboxes import yolo_box_constructor
File "darkflow/cython_utils/cy_yolo_findboxes.pyx", line 1, in init darkflow.cython_utils.cy_yolo_findboxes
ImportError: No module named 'darkflow.cython_utils'
I also tried to install darkflow form thtrieu directly and got the same error.
I've searched similar issues both on Google and Stack overflow, but I don't find a feasible solution.
I am getting the same error. Did you figure out ?
@k0286 @sukhad-app seems like a bug. I've installed darkflow globally. This helped me avoid "init darkflow.cython_utils.cy_yolo_findboxes" problem
Same error here
I had the same error: I found the darkflow.cython_utils where here: ./Tracking-with-darkflow/darkflow/darkflow/cython_utils ..instead of here ./Tracking-with-darkflow/darkflow/
So I copied the folder cython_utils into ./Tracking-with-darkflow/darkflow/, and that solved for me.
Instead of building darkflow inside the tracking with darkflow directly. Install darkflow globally. It would work.
Copying the cython_utils folder did not work for me. And how do I install darkflow globally? Thanks
it seems a problem about path, there is a way around with some modification :
-
delete Tracking-with-darkflow/darkflow/init.py
-
pip uninstall darkflow
-
cd into Tracking-with-darkflow/darkflow, run command "python3 setup.py build_ext --inplace", if succeed, you will find .so files in darkflow/darkflow/cython_utils/
-
mv Tracking-with-darkflow/run.py to Tracking-with-darkflow/darkflow/run.py, and modify import of run.py such that from darkflow.defaults import argHandler #Import the default arguments from darkflow.net.build import TFNet
-
config yolo cfg, weight, disable tracker
-
run run.py, till now the detection should work
-
activate tracking, and set tracker to deep_sort, run and you will see some path errors, fix one by one, for example in darkflow/darkflow/net/helper.py
if self.FLAGS.tracker == "deep_sort": import sys sys.path.insert(0,"/home/Tracking-with-darkflow") from deep_sort import generate_detections
in darkflow/darkflow/net/yolov2/predict.py
try :
import sys
sys.path.insert(0,"/home/Tracking-with-darkflow")
from deep_sort.application_util import preprocessing as prep
to make python know the path
after this detection with deep_sort tracker could work
A simple, quick, and safe workaround is to copy darkflow/darkflow/cython_utils and darkflow/darkflow/utils to darkflow/cython_utils and darkflow/utils respectively.
Copying the cython_utils folder did not work for me. And how do I install darkflow globally?
Thanks
instead of use python3 setup.py build_ext --inplace you should use pip install .
simply build the module globally, it will work.
install in dev mode pip install -e .
Lookup the annotation files in your directory. See if it contains anything else except .xml files. If yes, remove it and re-run. It will work.
I had the same problem, I was trying to import it from the Anaconda env. But then I noticed that my win10 python version and the anaconda env's was different. Just created a new env with the same python version (3.6.8) as my win10 and had a clean install of darkflow again(using 'python3 setup.py build_ext --inplace' first tried other two options but they did no good), that fixed the problem. I switched to a new env because I had nothing important in the present one and also didnt want to risk it. Maybe it will also work without installing stuff from scratch. Now I cant import it to PyCharm even though I added the darkflow dir to pycharm path, would be awesome if someone can help. Good luck.