Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cv2.dnn.readNetFromDarknet error: (-212:Parsing error) Unsupported activation: relu in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'

I tried to run the Openpose on darknet with weights and cfg downloaded from this place: https://github.com/lincolnhard/openpose-darknet

This is the error when I tried to create a net in Opencv

modelConfiguration = path to cfg file
modelWeights = path to weights file
darknet = cv2.dnn.readNetFromDarknet(modelConfiguration, modelWeights)

error Traceback (most recent call last) in () ----> 1 darknet = cv2.dnn.readNetFromDarknet(modelConfiguration, modelWeights)

error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:552: error: (-212:Parsing error) Unsupported activation: relu in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'

like image 416
Water Chan Avatar asked Apr 01 '19 09:04

Water Chan


1 Answers

The fix is either you install the latest master branch of openCV or OpenCV version 3.4.XX.XX Only these branches support yolo4.

You can install another version of OpenCV by the following snippet:

!pip install opencv-contrib-python==3.4.13.47 --force-reinstall
like image 89
0xPrateek Avatar answered Sep 30 '22 22:09

0xPrateek