Shape inference on the Torchvision’s Mask R-CNN causes a segmentation fault
See original GitHub issueBug 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:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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!