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

KeyError: 'ori_shape' #311

Closed
fschvart opened this issue Apr 4, 2022 · 6 comments
Closed

KeyError: 'ori_shape' #311

fschvart opened this issue Apr 4, 2022 · 6 comments
Assignees

Comments

@fschvart
Copy link

fschvart commented Apr 4, 2022

Describe the bug

Hi, I'm trying to convert PointRend from Torch to either ONNX or TensorRT and no matter which config deploy_cfg file I choose, I keep getting the same error : KeyError: 'ori_shape'

Running the standard deploy.py with the MMDET model file for PointRend 3x.
According to the website, PointRend should be able to convert.

Here' the full error I get:

2022-04-04:18:06:58,root ERROR [utils.py:43] 'ori_shape'
Traceback (most recent call last):
File "c:\users\injectoforty\mmdeploy\mmdeploy\utils\utils.py", line 38, in target_wrapper
result = target(*args, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\apis\pytorch2onnx.py", line 109, in torch2onnx
torch2onnx_impl(
File "c:\users\injectoforty\mmdeploy\mmdeploy\apis\pytorch2onnx.py", line 44, in torch2onnx_impl
torch.onnx.export(
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\onnx_init_.py", line 305, in export
return utils.export(model, args, f, export_params, verbose, training,
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\onnx\utils.py", line 118, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names,
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\onnx\utils.py", line 719, in _export
_model_to_graph(model, args, verbose, input_names,
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\onnx\utils.py", line 499, in _model_to_graph
graph, params, torch_out, module = _create_jit_graph(model, args)
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\onnx\utils.py", line 440, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\onnx\utils.py", line 391, in _trace_and_get_graph_from_model
torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\jit_trace.py", line 1166, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\jit_trace.py", line 127, in forward
graph, out = torch._C._create_graph_by_tracing(
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\jit_trace.py", line 118, in wrapper
outs.append(self.inner(*trace_inputs))
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\torch\nn\modules\module.py", line 1098, in _slow_forward
result = self.forward(*input, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\core\rewriters\rewriter_utils.py", line 371, in wrapper
return self.func(self, *args, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\codebase\mmdet\models\detectors\base.py", line 69, in base_detector__forward
return __forward_impl(ctx, self, img, img_metas=img_metas, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\core\optimizers\function_marker.py", line 261, in g
rets = f(*args, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\codebase\mmdet\models\detectors\base.py", line 28, in __forward_impl
return self.simple_test(img, img_metas, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\core\rewriters\rewriter_utils.py", line 371, in wrapper
return self.func(self, *args, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\codebase\mmdet\models\detectors\two_stage.py", line 59, in two_stage_detector__simple_test
return self.roi_head.simple_test(x, proposals, img_metas, rescale=False)
File "c:\users\injectoforty\mmdeploy\mmdeploy\core\rewriters\rewriter_utils.py", line 371, in wrapper
return self.func(self, *args, **kwargs)
File "c:\users\injectoforty\mmdeploy\mmdeploy\codebase\mmdet\models\roi_heads\standard_roi_head.py", line 58, in standard_roi_head__simple_test
segm_results = self.simple_test_mask(
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\mmdet\models\roi_heads\point_rend_roi_head.py", line 162, in simple_test_mask
ori_shapes = tuple(meta['ori_shape'] for meta in img_metas)
File "C:\Users\InjectoFORTY\miniconda3\lib\site-packages\mmdet\models\roi_heads\point_rend_roi_head.py", line 162, in
ori_shapes = tuple(meta['ori_shape'] for meta in img_metas)
KeyError: 'ori_shape'
2022-04-04 18:06:58,917 - mmdeploy - ERROR - torch2onnx failed.

Process finished with exit code 1

Your help would be greatly appreciated.

@RunningLeon
Copy link
Collaborator

@fschvart Hi, PointRend is not supported as shown here. If possible, could you support it by yourself?

@RunningLeon RunningLeon self-assigned this Apr 6, 2022
@fschvart
Copy link
Author

fschvart commented Apr 6, 2022

Well, it does appear on the "experimental" list here https://mmdetection.readthedocs.io/en/latest/tutorials/pytorch2onnx.html#list-of-supported-models-exportable-to-onnx
And it is on the MMSegmentation list as well https://mmdeploy.readthedocs.io/en/latest/supported_models.html The problem is, I need the COCO dataset and not the Cityscapes or ADE20K, which are on the MMSegmentation page

@RunningLeon
Copy link
Collaborator

@fschvart Hi, PointRend is supported in MMDetection repo by experimental, but not supported in mmdeploy. If you have strong request for this model and can not support it by yourself, you could post your request in issue #170. We would consider it by amount of request.

@leemengwei
Copy link

@RunningLeon
Hi Could u give me some guide? I'm tring on htc suppport which as well throw me error 'ori_shape'

mm系列封装的太多了 看起来晕呀

@RunningLeon
Copy link
Collaborator

@RunningLeon Hi Could u give me some guide? I'm tring on htc suppport which as well throw me error 'ori_shape'

mm系列封装的太多了 看起来晕呀

@leemengwei Hi, you could join our wechat group by adding assistant OpenMMLabwx. A more convenient discussion could be conducted in there.

@RunningLeon
Copy link
Collaborator

Closed for now. Feel free to reopen.

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

3 participants