Skip to content

dnn: onnx importer can't import 'Tanh' layer #17463

@berak

Description

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

the Geometric Matching Module model from https://www.dropbox.com/s/tyhc73xa051grjp/cp_vton_gmm.onnx?dl=0 (used in the virtual-try-on sample) fails to read with:

gmm_net = cv2.dnn.readNet("C:/data/dnn/cp_vton_gmm.onnx")
cv2.error: OpenCV(4.3.0-dev) C:\p\opencv\modules\dnn\src\dnn.cpp:610: error: (-2:Unspecified error) Can't create layer "166" of type "Tanh" in function 'getLayerInstance'

note the lowercase h in Tanh, the correct layer name would be TanH.

well, it must have worked at some time before (and the TanH layer is in there since ages),
maybe it's a regression from #16878

for now, wanting to play with the sample, i added a

        else if (layer_type == "Tanh")
        {
            layerParams.type = "TanH";
        }

block in onnx_importer.cpp

Steps to reproduce

run virtual_try_on.py from samples/dnn

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions