没有项目描述
darknetp的Python项目详细描述
darknetpy是darknet's yolo检测器的简单绑定。
安装
pip install darknetpy
高级选项
GPU=1 pip install darknetpy
使用gpu使用cuda加速构建(cuda应该在/use/local/cuda中)。
CUDNN=1 pip install darknetpy
与cudnn一起构建,使用gpu加速训练(cudnn应该在/usr/local/cudnn中)。
OPENCV=1 pip install darknetpy
使用opencv构建。
OPENMP=1 pip install darknetpy
使用openmp支持构建,使用多核cpu加速yolo。
用法
在example.py中:
from darknetpy.detector import Detector detector = Detector('<absolute-path-to>/darknet/cfg/coco.data', '<absolute-path-to>/darknet/cfg/yolo.cfg', '<absolute-path-to>/darknet/yolo.weights') results = detector.detect('<absolute-path-to>/darknet/data/dog.jpg') print(results)
运行:
python example.py
结果:
[{'right': 194, 'bottom': 353, 'top': 264, 'class': 'dog', 'prob': 0.8198755383491516, 'left': 71}]