hustvl / SparseInst

[CVPR 2022] SparseInst: Sparse Instance Activation for Real-Time Instance Segmentation
MIT License
583 stars 72 forks source link

Export onnx error #56

Open JXFOnestep opened 2 years ago

JXFOnestep commented 2 years ago

Traceback (most recent call last): File "convert_onnx.py", line 124, in main() File "convert_onnx.py", line 117, in main opset_version=12, File "anaconda3/envs/yolact/lib/python3.7/site-packages/torch/onnx/init.py", line 320, in export custom_opsets, enable_onnx_checker, use_external_data_format) File "anaconda3/envs/yolact/lib/python3.7/site-packages/torch/onnx/utils.py", line 111, in export custom_opsets=custom_opsets, use_external_data_format=use_external_data_format) File "anaconda3/envs/yolact/lib/python3.7/site-packages/torch/onnx/utils.py", line 729, in _export dynamic_axes=dynamic_axes) File "anaconda3/envs/yolact/lib/python3.7/site-packages/torch/onnx/utils.py", line 532, in _model_to_graph _set_input_and_output_names(graph, input_names, output_names) File "anaconda3/envs/yolact/lib/python3.7/site-packages/torch/onnx/utils.py", line 806, in _set_input_and_output_names set_names(list(graph.outputs()), output_names, "output") File "anaconda3/envs/yolact/lib/python3.7/site-packages/torch/onnx/utils.py", line 801, in set_names % (descriptor, len(name_list), descriptor, len(node_list))) RuntimeError: number of output names provided (2) exceeded number of outputs (0)

wondervictor commented 2 years ago

Hi @JXFOnestep, could you provide more details, such as the running script?

JXFOnestep commented 2 years ago

I just alter the --opts, like this parser.add_argument( "--opts", help="Modify config options using the command-line 'KEY VALUE' pairs", default=['MODEL.WEIGHTS', 'sparse_inst_r50_giam_aug_2b7d68.pth', 'INPUT.MIN_SIZE_TEST', '512'], nargs=argparse.REMAINDER, )

wondervictor commented 2 years ago

Get it and I'll check it!