Skip to content

dnn: darknet importer has no "relu" activation #17778

@berak

Description

@berak
System information (version)
  • OpenCV => 4.3.0-dev
  • Operating System / Platform => Windows7 32 Bit
  • Compiler => mingw64(8.1)
Detailed description

while checking out a ultra small(500k !) yolov3 model from here i got a :

cv2.error: OpenCV(4.3.0-dev) C:\p\opencv\modules\dnn\src\darknet\darknet_io.cpp:831: error: (-212:Parsing error) Unsupported activation: relu in function 'ReadDarknetFromCfgStream'

it has a couple of activation=relu lines, e.g. here but in darknet_io.cpp there is only a leaky activation:

if (activation == "leaky")
{
setParams.setActivation("relu");
}

calling this:

if (type == "relu")
{
activation_param.set<float>("negative_slope", 0.1f);
activation_param.type = "ReLU";
}

so, this is indeed the "leaky" variant (used in all other yolo models), and real "relu" would have a slope of 0.0, right ?

Steps to reproduce
net = cv.dnn.readNet('yoloface-500k.cfg', 'yoloface-500k.weights')
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions