Search code examples
python-3.xcythondarknet

I am getting this error "No module named 'darkflow.cython_utils.cy_yolo_findboxes'" When I am using darknet


When I try to use Pycharm to play with YOLO, I got the error. Here is what I got, Any help will be appreciated. Node: I have done python3 setup.py build_ext --inplace. All the file like cy_yolo_findboxes.c and cy_yolo2_findboxes are all inside the cython_utils folder. But it does not work.

import cv2
import sys
sys.path.append('/Users/hantaoliu/darkflow-master')
import tensorflow as tf
from darkflow.net.build import TFNet
import numpy as np
import time

option = {
    'model': 'cfg/yolo.cfg',
    'load': 'bin/yolo.weights',
    'threshold': 0.15,
    'gpu': 1.0
}

capture = cv2.VideoCapture('videofile1.mp4')
colors =[tuple(255 * np.random(3)) for i in range(5)]

for color in colors:
    print(color)

Here are the error message

Traceback (most recent call last):
  File "/Users/hantaoliu/PycharmProjects/YOLO/sample.py", line 5, in <module>
from darkflow.net.build import TFNet
  File "/Users/hantaoliu/darkflow-master/darkflow/net/build.py", line 7, in <module>
    from .framework import create_framework
  File "/Users/hantaoliu/darkflow-master/darkflow/net/framework.py", line 1, in <module>
    from . import yolo
  File "/Users/hantaoliu/darkflow-master/darkflow/net/yolo/__init__.py", line 2, in <module>
    from . import predict
  File "/Users/hantaoliu/darkflow-master/darkflow/net/yolo/predict.py", line 7, in <module>
    from ...cython_utils.cy_yolo_findboxes import yolo_box_constructor
ImportError: No module named 'darkflow.cython_utils.cy_yolo_findboxes'

Solution

  • Build the cython module

    cd ./cython_utils
    python3 setup.py build_ext --inplace