Skip to content

Darknet Import TanH Activation Function #19393

@cpraschl

Description

@cpraschl
System information (version)
  • OpenCV => 4.5.1.48
  • Operating System / Platform => Windows 64 bit / Python
Detailed description

I wanted to try a U-NET model implemented in Darknet from here. With this I realized that TanH activation function does not work when importing from Darknet, even though the activation function is implemented in OpenCV. I am getting the following Exception:

darknet_io.cpp:246: error: (-212:Parsing error) Unsupported activation: tanh in function 'cv::dnn::darknet::setLayersParams::setActivation'
Steps to reproduce

This problem can be reproduced using the following code:

from cv2 import cv2
net = cv2.dnn.readNetFromDarknet("unet.cfg", "unet.weights")

I have zipped the config and weights file from the above mentioned repository. Can be downloaded here

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