Fix TensorFlow export with onnx>=1.18.0 (#21758)

Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Jing Qiu <61612323+Laughing-q@users.noreply.github.com>
Co-authored-by: Laughing-q <1185102784@qq.com>
This commit is contained in:
Mohammed Yasin 2025-08-28 14:37:48 +08:00 committed by GitHub
parent d733dfc012
commit fd95fba607
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -92,7 +92,8 @@ dev = [
]
export = [
"numpy<2.0.0", # TF 2.20 compatibility
"onnx>=1.12.0,<1.18.0", # ONNX export
"onnx>=1.12.0; platform_system != 'Darwin'", # ONNX export
"onnx>=1.12.0,<1.18.0; platform_system == 'Darwin'", # TF inference hanging on MacOS
"coremltools>=8.0; platform_system != 'Windows' and python_version <= '3.13'", # CoreML supported on macOS and Linux
"scikit-learn>=1.3.2; platform_system != 'Windows' and python_version <= '3.13'", # CoreML k-means quantization
"openvino>=2024.0.0", # OpenVINO export

View File

@ -582,9 +582,9 @@ class Exporter:
@try_export
def export_onnx(self, prefix=colorstr("ONNX:")):
"""Export YOLO model to ONNX format."""
requirements = ["onnx>=1.12.0,<1.18.0"]
requirements = ["onnx>=1.12.0"]
if self.args.simplify:
requirements += ["onnxslim>=0.1.59", "onnxruntime" + ("-gpu" if torch.cuda.is_available() else "")]
requirements += ["onnxslim>=0.1.65", "onnxruntime" + ("-gpu" if torch.cuda.is_available() else "")]
check_requirements(requirements)
import onnx # noqa
@ -960,9 +960,9 @@ class Exporter:
"sng4onnx>=1.0.1", # required by 'onnx2tf' package
"onnx_graphsurgeon>=0.3.26", # required by 'onnx2tf' package
"ai-edge-litert>=1.2.0,<1.4.0", # required by 'onnx2tf' package
"onnx>=1.12.0,<1.18.0",
"onnx>=1.12.0",
"onnx2tf>=1.26.3",
"onnxslim>=0.1.59",
"onnxslim>=0.1.65",
"onnxruntime-gpu" if cuda else "onnxruntime",
"protobuf>=5",
),