I'm attempting to integrate an Ultralytics YOLOv8 object detection model into an Android application using TensorFlow Lite. The process involves converting the YOLOv8 model from ONNX format to TFLite. The conversion seems to be successful, as I can load the TFLite model into Android Studio.
However, Android Studio indicates that the model lacks metadata.
Following the TensorFlow documentation, I attempted to manually add metadata to the TFLite model using the#is script only changing those parameters .
_MODEL_INFO = {
"elMtreni.tflite":
ModelSpecificInfo(
name="Ultralytics YOLOv8n-seg model trained on dataset.yaml",
version="v1",
image_width=640,
image_height=640,
image_min=0,
image_max=255,
mean=[127.5],
std=[127.5],
num_classes=25,
author="Ultralytics")
}
However, upon adding the metadata, I encountered the error message "not a valid TensorFlow Lite model" screenshot here.
I couldn't find any similar issues documented in the Ultralytics or TensorFlow documentation.