obendidi / Tracking-with-darkflow

Real-time people Multitracker using YOLO v2 and deep_sort with tensorflow
GNU General Public License v3.0
524 stars 174 forks source link

ImportError: No module named 'darkflow.cython_utils' #48

Open k0286 opened 6 years ago

k0286 commented 6 years ago

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.

IAmUnbounded commented 6 years ago

I am getting the same error. Did you figure out ?

exotikh3 commented 6 years ago

@k0286 @sukhad-app seems like a bug. I've installed darkflow globally. This helped me avoid "init darkflow.cython_utils.cy_yolo_findboxes" problem

alexanderfrey commented 6 years ago

Same error here

alexdominguez09 commented 6 years ago

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.

IAmUnbounded commented 6 years ago

Instead of building darkflow inside the tracking with darkflow directly. Install darkflow globally. It would work.

tonmoyborah commented 6 years ago

Copying the cython_utils folder did not work for me. And how do I install darkflow globally? Thanks

nathangq commented 6 years ago

it seems a problem about path, there is a way around with some modification :

  1. delete Tracking-with-darkflow/darkflow/init.py
  2. pip uninstall darkflow
  3. 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/
  4. 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
  5. config yolo cfg, weight, disable tracker
  6. run run.py, till now the detection should work
  7. 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

jrkwon commented 6 years ago

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.

Mengmeng10 commented 5 years ago
      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 .

KaranFriends commented 5 years ago

simply build the module globally, it will work.

italojs commented 5 years ago

install in dev mode pip install -e .

mujeebishaque commented 5 years ago

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.

ghost commented 5 years ago

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.