DeepStream-Yolo-Seg icon indicating copy to clipboard operation
DeepStream-Yolo-Seg copied to clipboard

Convert model pt to onnx is error

Open hupu1dong opened this issue 2 years ago • 4 comments
trafficstars

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

hupu1dong avatar Oct 08 '23 03:10 hupu1dong

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

chienhust avatar Oct 10 '23 08:10 chienhust

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

LangshidaNv avatar May 23 '24 03:05 LangshidaNv

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

LangshidaNv avatar May 23 '24 09:05 LangshidaNv