OpenCV unknown layer type running darknet detect

六眼飞鱼酱① 提交于 2019-12-01 20:21:44

问题


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

Anybody know how I can fix this? Using a cfg file from Yolo v2 works fine.


回答1:


Support for running YOLOv3 has been added to OpenCV master branch (3.4.3).

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))

Full code here.

Have a look at the object detection example in the samples/dnn directory on OpenCV's github repo.

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.

Hope this helps.



来源:https://stackoverflow.com/questions/49925933/opencv-unknown-layer-type-running-darknet-detect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!