6

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'

Water Chan
  • 101
  • 1
  • 2
  • 7

2 Answers2

4

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
0xPrateek
  • 1,158
  • 10
  • 28
0

as you konw, opnecv 4.0.0 does not support the relu activation now. I found some project faced the same problem, but he adjusted opencv for darknet, Support CNN "relu" and maxpool "VALID", you can reference it.

https://github.com/chineseocr/opencv-for-darknet

hope it will solve your problem.

zhicheng duan
  • 81
  • 1
  • 3