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

Convert model pt to onnx is error #7

Open
hupu1dong opened this issue Oct 8, 2023 · 3 comments
Open

Convert model pt to onnx is error #7

hupu1dong opened this issue Oct 8, 2023 · 3 comments

Comments

@hupu1dong
Copy link

hupu1dong commented Oct 8, 2023

use wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-seg.pt download the model.

python3 export_yoloV8_seg.py -w yolov8s-seg.pt --opset 12

output:
Starting: yolov8s-seg.pt
Opening YOLOv8-Seg model

Ultralytics YOLOv8.0.195 🚀 Python-3.8.16 torch-2.0.0+cu118 CPU (12th Gen Intel Core(TM) i9-12900K)
YOLOv8s-seg summary (fused): 195 layers, 11810560 parameters, 0 gradients, 42.6 GFLOPs

Creating labels.txt file

Exporting the model to ONNX
============= Diagnostic Run torch.onnx.export version 2.0.0+cu118 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

Traceback (most recent call last):
File "/soft/anaconda3/envs/ultralytics/lib/python3.8/site-packages/torch/onnx/utils.py", line 1636, in _export
_C._check_onnx_proto(proto)
RuntimeError: Unrecognized attribute: coordinate_transformation_mode for operator RoiAlign

==> Context: Bad node spec for node. Name: /1/RoiAlign OpType: RoiAlign

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "export_yoloV8_seg.py", line 213, in
sys.exit(main(args))
File "export_yoloV8_seg.py", line 178, in main
torch.onnx.export(model, onnx_input_im, onnx_output_file, verbose=False, opset_version=args.opset,
File "/soft/anaconda3/envs/ultralytics/lib/python3.8/site-packages/torch/onnx/utils.py", line 506, in export
_export(
File "/soft/anaconda3/envs/ultralytics/lib/python3.8/site-packages/torch/onnx/utils.py", line 1638, in _export
raise errors.CheckerError(e) from e
torch.onnx.errors.CheckerError: Unrecognized attribute: coordinate_transformation_mode for operator RoiAlign

==> Context: Bad node spec for node. Name: /1/RoiAlign OpType: RoiAlign

@chienhust
Copy link

I have the same error, are you have solution for it?

@LangshidaNv
Copy link

Any update for this issue, I encountered same problem on master (d770e58).

@LangshidaNv
Copy link

By my test, you have to use opset 16, there will be no such problem

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