marcoslucianops / DeepStream-Yolo-Seg

NVIDIA DeepStream SDK 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 implementation for YOLO-Segmentation models
MIT License
53 stars 11 forks source link

Convert model pt to onnx is error #7

Open hupu1dong opened 12 months ago

hupu1dong commented 12 months ago

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 commented 12 months ago

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

LangshidaNv commented 4 months ago

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

LangshidaNv commented 4 months ago

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