OpenCV未知层类型运行暗网检测 [英] OpenCV unknown layer type running darknet detect
问题描述
我正在尝试从使用Yolo v2切换到Yolo v3,并且无法进行检测.我遇到了错误
I'm trying to switch from using Yolo v2 to Yolo v3 and can't get the detection to work. I'm getting the error
OpenCV Error: Parsing error (Unknown layer type: shortcut) in ReadDarknetFromCfgFile
有人知道我该如何解决?使用Yolo v2中的cfg文件效果很好.
Anybody know how I can fix this? Using a cfg file from Yolo v2 works fine.
推荐答案
OpenCV主分支(3.4.3)已添加了对运行YOLOv3的支持.
Support for running YOLOv3 has been added to OpenCV master branch (3.4.3).
您应该可以使用 YOLOv3配置和<带有OpenCV DNN模块的href ="https://pjreddie.com/darknet/yolo/" rel ="noreferrer">重量来执行对象检测.
You should be able to use YOLOv3 config and weights with OpenCV DNN module to perform object detection.
net = cv2.dnn.readNet(args.weights, args.config)
blob = cv2.dnn.blobFromImage(image, scale, (416,416), (0,0,0), True, crop=False)
net.setInput(blob)
outs = net.forward(get_output_layers(net))
完整代码此处.
看看对象检测示例在OpenCV的 github存储库上的samples/dnn目录中.
Have a look at the object detection example in the samples/dnn directory on OpenCV's github repo.
此博客帖子(由我撰写)解释为有关在 COCO数据集上使用预训练的YOLOv3权重执行对象检测的详细信息,以检测
This blog post (written by me) explains in detail about performing object detection with pre-trained YOLOv3 weights on COCO dataset to detect 80 common objects in context.
希望这会有所帮助.
这篇关于OpenCV未知层类型运行暗网检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!