Skip to content

readNetFromONNX: Cant create layer of type 'Exp' in getLayerInstance #18088

@skaldesh

Description

@skaldesh
  • OpenCV => 4.4.0-dev (master branch)
  • Operating System / Platform => Arch Linux x86_64
  • Compiler => gcc
  • PyTorch => 1.6.0 (latest docker container with gpu)
Detailed description

Very similar issue: #15244
@dkurt

Basically, I exported a ssdlite-mobilenetv3 in PyTorch to ONNX format. Loading it in OpenCV leads to this error:
create detection model: OpenCV(4.4.0-dev) /tmp/opencv/opencv/modules/dnn/src/dnn.cpp:604: error: (-2:Unspecified error) Can't create layer "1117" of type "Exp" in function 'getLayerInstance'

Enabling fusion did not solve my issue.

Here is the code I used to export the model:

net.load(model_path)
net.to('cuda')
net.eval()

model_path = f"models/model.onnx"

dummy_input = torch.randn(1, 3, 300, 300).cuda()

torch.onnx.export(net, dummy_input, model_path, verbose=False, output_names=['scores', 'boxes'])

Here is my PyTorch model (mb3-ssd-lite.pth.txt) and converted ONNX model (mb3-ssd-lite.onnx.txt)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions