question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Shape inference on the Torchvision’s Mask R-CNN causes a segmentation fault

See original GitHub issue

Bug Report

Is the issue related to model conversion?

Probably not.

Describe the bug

When I try to run shape inference on the Torchvision’s Mask R-CNN it causes a segfault. However, check_model doesn’t return any warning/exception.

System information

  • OS Platform and Distribution (e.g. Linux Ubuntu 16.04): Linux Ubuntu 18.04.4
  • ONNX version (e.g. 1.7): 1.6.0
  • Python version: 3.6.10
  • PyTorch version: 1.6.0a0+9907a3e
  • Torchvision version: 0.7.0a0
  • GCC/Compiler version (if compiling from source): N/A
  • CMake version: 3.14.0
  • Protobuf version: 3.12.2
  • Visual Studio version (if applicable): N/A

Reproduction instructions

import torch
import torchvision
import onnx

model = torchvision.models.detection.maskrcnn_resnet50_fpn(pretrained=True)
model.eval()
x = [torch.rand(3, 800, 800)]
torch.onnx.export(model, x, "mask_rcnn.onnx", opset_version = 11)
onnx_model = onnx.load("mask_rcnn.onnx")
onnx.checker.check_model(onnx_model)
onnx.shape_inference.infer_shapes(onnx_model)

Expected behavior

Shape inference doesn’t cause any errors.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
gramalingamcommented, Aug 24, 2020

This is a bit strange. As far as I know, the inference used by onnxruntime is the same regardless of whether you use the python or C/C++ API. There is a slightly different implementation of the inference in onnxruntime and ONNX. But even here, if the behavior is different, then one of them needs to be fixed. This seems worth investigating.

1reaction
przybyszewskiwcommented, Sep 2, 2020

It looks like when I use onnx 1.7.0 and onnxruntime 1.4.0, model loads correctly in both APIs. Thanks for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Faster, Mask, Cascade R-CNN | by Sieun Park | MLearning.ai ...
Region proposals based on selective search were the main bottleneck for inference speed. Faster R-CNN proposed a learning-based approach based ...
Read more >
Human Pose Estimation using Keypoint RCNN in PyTorch
Consider we are solving a Person-Background segmentation problem using Mask-RCNN.
Read more >
latest PDF - MMDetection's documentation!
4 1: Inference and train with existing models and standard datasets ... We compare the training speed of Mask R-CNN with some other...
Read more >
Ch. 6 - Object Detection and Segmentation
We can use our Mask R-CNN inference in a manipulation to do selective picking from the bin... Variations and Extensions. Pretraining wth self- ......
Read more >
Image-based size estimation of broccoli heads under varying ...
With a mean sizing error of 6.4 mm, ORCNN outperformed Mask R–CNN, ... estimate the bigger shape of the occluded broccoli head with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found