pip install .
来编译darkflow库。之后,当成功安装darkflow时。
from darkflow.net.build import TFNet
import cv2
options = {"model": "cfg/yolo.cfg", "load": "bin/yolov2.weights", "threshold": 0.1}
tfnet = TFNet(options)
imgcv = cv2.imread("./sample_img/sample_dog.jpg")
result = tfnet.return_predict(imgcv)
print(result)
我遇到了这个错误。
C:\Users\IU-506\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
此外,这些也是错误,请查看以下内容:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-1bd33c7e6a6f> in <module>()
----> 1 from darkflow.net.build import TFNet
2 import cv2
3
4 options = {"model": "cfg/yolo.cfg", "load": "bin/yolov2.weights", "threshold": 0.1}
5
~\Desktop\darkflow-master\darkflow\net\build.py in <module>()
5 from .ops import op_create, identity
6 from .ops import HEADER, LINE
----> 7 from .framework import create_framework
8 from ..dark.darknet import Darknet
9 import json
~\Desktop\darkflow-master\darkflow\net\framework.py in <module>()
----> 1 from . import yolo
2 from . import yolov2
3 from . import vanilla
4 from os.path import basename
5
~\Desktop\darkflow-master\darkflow\net\yolo\__init__.py in <module>()
1 from . import train
----> 2 from . import predict
3 from . import data
4 from . import misc
5 import numpy as np
~\Desktop\darkflow-master\darkflow\net\yolo\predict.py in <module>()
5 import os
6 import json
----> 7 from ...cython_utils.cy_yolo_findboxes import yolo_box_constructor
8
9 def _fix(obj, dims, scale, offs):
ModuleNotFoundError: No module named 'darkflow.cython_utils.cy_yolo_findboxes'
答案 0 :(得分:0)
我已通过以下步骤解决了该问题:-
*确保所有库都安装在基本根目录上
pip install darknetpy
借助Anaconda Navigator在基础(根)中安装Tensorflow
重新启动水蟒