Skip to content

Error loading ONNX model (FasterRCNN50 from Torchvision) #16783

@adityak2920

Description

@adityak2920

I am trying to load FasterRCNN model of torchvision but facing some errors. Here is the code for the model:-

import torch
import torchvision

model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=True)
x = [torch.rand(3, 300, 400), torch.rand(3, 500, 400)]
model.eval()
predictions = model(x)
torch.onnx.export(model, x, "fasterrcnn50.onnx", opset_version=11)

And loading my model using :

import cv2 as cv
net = cv.dnn.readNet('fasterrcnn50.onnx')

Here I am getting an error which is:

cv2.error: OpenCV(4.2.0-dev) /Users/adityakumar/opencv/modules/dnn/src/graph_simplifier.cpp:79: error: (-212:Parsing error) Input node with name 2780 not found in function 'getInputNodeId'

torch==1.4.0
torchvision==0.5.0
OpenCV==4.2.0-dev

Here is the link of model: model

Please check, how can I resolve this error?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions