Skip to content

Loading ONNX model producing error #16876

@rupaai

Description

@rupaai
System information (version)
  • OpenCV => 3.4.9
  • Operating System / Platform => Ubuntu 18.04
  • Compiler => Visual Studio 2017
Detailed description

Loading ONNX model producing error

cv2.error: OpenCV(3.4.10-pre) /home/Jarvis/opencv/modules/dnn/src/dnn.cpp:574: error: (-2:Unspecified error) Can't create layer "291" of type "Sqrt" in function 'getLayerInstance'

Steps to reproduce
import cv2
net = cv2.dnn.readNet('resnet_backbone.onnx')

Here is the code to convert the model

import torch
from torch.autograd import Variable
import torch.nn as nn
from torchvision.models.detection.backbone_utils import *

model = resnet_fpn_backbone('resnet50', True)
x = Variable(torch.randn( 1, 3, 256, 256))
model.eval()
torch.onnx.export(model, x, "resnet_backbone.onnx")

Here is the link to the model

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