Fix edgetpu and tfjs exports for arm64 Linux (#19154)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Lakshantha Dissanayake 2025-02-12 20:33:20 -08:00 committed by GitHub
parent 94d36e93d8
commit fb444bca1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -288,8 +288,10 @@ class Exporter:
self.args.nms = False
self.args.conf = self.args.conf or 0.25 # set conf default value for nms export
if edgetpu:
if not LINUX:
raise SystemError("Edge TPU export only supported on Linux. See https://coral.ai/docs/edgetpu/compiler")
if ARM64 and not LINUX:
raise SystemError(
"Edge TPU export only supported on non-aarch64 Linux. See https://coral.ai/docs/edgetpu/compiler"
)
elif self.args.batch != 1: # see github.com/ultralytics/ultralytics/pull/13420
LOGGER.warning("WARNING ⚠️ Edge TPU export requires batch size 1, setting batch=1.")
self.args.batch = 1
@ -307,6 +309,9 @@ class Exporter:
"WARNING ⚠️ INT8 export requires a missing 'data' arg for calibration. "
f"Using default 'data={self.args.data}'."
)
if tfjs:
if ARM64 and LINUX:
raise SystemError("TensorFlow.js export not supported on ARM64 Linux")
# Input
im = torch.zeros(self.args.batch, 3, *self.imgsz).to(self.device)
@ -1128,9 +1133,6 @@ class Exporter:
def export_tfjs(self, prefix=colorstr("TensorFlow.js:")):
"""YOLO TensorFlow.js export."""
check_requirements("tensorflowjs")
if ARM64:
# Fix error: `np.object` was a deprecated alias for the builtin `object` when exporting to TF.js on ARM64
check_requirements("numpy==1.23.5")
import tensorflow as tf
import tensorflowjs as tfjs # noqa