Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
560 views
in Technique[技术] by (71.8m points)

runtime error - OpenCV unknown layer type running darknet detect

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...