Skip to content

Commit 368abb4

Browse files
lakshanthadUltralyticsAssistantglenn-jocher
authoredMar 15, 2024
Optimize TFJS export on ARM64 (ultralytics#8946)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
1 parent 82e8dae commit 368abb4

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed
 

‎docker/Dockerfile-arm64

-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ RUN rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
3232
RUN python3 -m pip install --upgrade pip wheel
3333
RUN pip install --no-cache -e ".[export]"
3434

35-
# Fix error: `np.object` was a deprecated alias for the builtin `object` when exporting to TensorFlow.js
36-
# Here onnxruntime is installed first because in tflite and onnx simplify exports, it will install latest numpy version as a dependency and we need to downgrade it
37-
RUN pip install --no-cache onnxruntime
38-
RUN pip install --no-cache numpy==1.23.5
39-
4035
# Creates a symbolic link to make 'python' point to 'python3'
4136
RUN ln -sf /usr/bin/python3 /usr/bin/python
4237

‎ultralytics/engine/exporter.py

+3
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,9 @@ def export_edgetpu(self, tflite_model="", prefix=colorstr("Edge TPU:")):
886886
def export_tfjs(self, prefix=colorstr("TensorFlow.js:")):
887887
"""YOLOv8 TensorFlow.js export."""
888888
check_requirements("tensorflowjs")
889+
if ARM64:
890+
# Fix error: `np.object` was a deprecated alias for the builtin `object` when exporting to TF.js on ARM64
891+
check_requirements("numpy==1.23.5")
889892
import tensorflow as tf
890893
import tensorflowjs as tfjs # noqa
891894

0 commit comments

Comments
 (0)