Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantize Pointrend #155

Closed
adamantboy opened this issue Sep 27, 2020 · 4 comments
Closed

Quantize Pointrend #155

adamantboy opened this issue Sep 27, 2020 · 4 comments

Comments

@adamantboy
Copy link

I compressed a model of pointrend based on mmdet-2.2.1,the training looks normal, but a error occurs when i convert it to onnx using functions of pytorch2onnx.py in mmdet-2.3.1 (commit id:6495391) . It seems like _bbox_forward() and _mask_forward() have some problems, do you know how to fix it? the error info is as follows:

File "/home/mechmind/projects/mech_learning/mmdet/models/detectors/base.py", line 180, in forward
return self.forward_test(img, img_metas, **kwargs)
File "/home/mechmind/projects/mech_learning/mmdet/models/detectors/base.py", line 138, in forward_test
return self.forward_dummy(imgs[0])
File "/home/mechmind/projects/mech_learning/mmdet/models/detectors/two_stage.py", line 101, in forward_dummy
roi_outs = self.roi_head.forward_dummy(x, proposals)
File "/home/mechmind/projects/mech_learning/mmdet/models/roi_heads/standard_roi_head.py", line 60, in forward_dummy
bbox_results = self._bbox_forward(x, rois)
File "/home/mechmind/projects/mech_learning/mmdet/models/roi_heads/standard_roi_head.py", line 139, in _bbox_forward
x[:self.bbox_roi_extractor.num_inputs], rois)
File "/home/mechmind/projects/nncf_pytorch/nncf/dynamic_graph/wrappers.py", line 83, in wrapped
retval = module_call(self, *args, **kwargs)
File "/home/mechmind/miniconda3/envs/nncf/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in call_impl
result = self.forward(*input, **kwargs)
File "/home/mechmind/projects/mech_learning/mmdet/core/fp16/decorators.py", line 131, in new_func
return old_func(*args, **kwargs)
File "/home/mechmind/projects/mech_learning/mmdet/models/roi_heads/roi_extractors/single_level_roi_extractor.py", line 73, in forward
roi_feats_t = self.roi_layers[i](feats[i], rois
)
File "/home/mechmind/projects/nncf_pytorch/nncf/dynamic_graph/wrappers.py", line 83, in wrapped
retval = module_call(self, *args, **kwargs)
File "/home/mechmind/miniconda3/envs/nncf/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/mechmind/projects/mech_learning/mmdet/ops/roi_align/roi_align.py", line 144, in forward
self.sample_num, self.aligned)
File "/home/mechmind/projects/mech_learning/mmdet/ops/roi_align/roi_align.py", line 30, in forward
aligned)
RuntimeError: roi_width >= 0 && roi_height >= 0 INTERNAL ASSERT FAILED at "/home/mechmind/projects/mech_learning/mmdet/ops/roi_align/src/cpu/roi_align_v2.cpp":134, please report a bug to PyTorch. ROIs in ROIAlign cannot have non-negative size!

@adamantboy
Copy link
Author

@aleksei-kashapov, @AlexKoff88

@adamantboy
Copy link
Author

@vanyalzr Could you please give me some suggestions? Thanks.

@adamantboy
Copy link
Author

I compress a pointrend model based on mmdet-2.3.0(commit id: 7ab8f44 ) with nncf patch, the same error occurs, could you please give me a direction? @aleksei-kashapov

@lzrvch
Copy link
Contributor

lzrvch commented Oct 16, 2020

Hi @adamantboy,

Unfortunately the ONNX export in the original mmdetection repo is still limited in terms of the scope of exportable models. You can try to export the model to ONNX using our mmdetection fork.
The export script is located in tools/export.py and the corresponding config for INT8-quantized PointRend model is in configs/nncf_compression/point_rend/point_rend_r50_caffe_fpn_mstrain_1x_coco_int8.py. You can specify your compressed .pth checkpoint to loaded in the config script and export it to ONNX using the export.py script:

python tools/export.py configs/nncf_compression/point_rend/point_rend_r50_caffe_fpn_mstrain_1x_coco_int8.py /path/to/your/checkpoint/ ./ onnx.

cc @aleksei-kashapov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants