ultralytics 8.2.55 adaptive tflite_support logic (#14385)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
Co-authored-by: Nguyễn Anh Bình <sometimesocrazy@gmail.com>
Co-authored-by: Johnny <johnnynuca14@gmail.com>
Co-authored-by: Muhammad Rizwan Munawar <muhammadrizwanmunawar123@gmail.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-07-12 13:47:05 +02:00 committed by GitHub
parent 40137785ec
commit abd391b633
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 7 deletions

View file

@ -1017,13 +1017,13 @@ class Exporter:
"""Add metadata to *.tflite models per https://www.tensorflow.org/lite/models/convert/metadata."""
import flatbuffers
if ARM64:
from tflite_support import metadata # noqa
from tflite_support import metadata_schema_py_generated as schema # noqa
else:
try:
# TFLite Support bug https://github.com/tensorflow/tflite-support/issues/954#issuecomment-2108570845
from tensorflow_lite_support.metadata import metadata_schema_py_generated as schema # noqa
from tensorflow_lite_support.metadata.python import metadata # noqa
except ImportError: # ARM64 systems may not have the 'tensorflow_lite_support' package available
from tflite_support import metadata # noqa
from tflite_support import metadata_schema_py_generated as schema # noqa
# Create model info
model_meta = schema.ModelMetadataT()