13 lines
447 B
Python
13 lines
447 B
Python
from ultralytics import YOLO
|
|
|
|
# Load the YOLO11 model
|
|
model = YOLO("runs/detect/train/weights/best.pt")
|
|
|
|
# Export the model to TFLite format
|
|
model.export(format="tflite") # creates 'yolo11n_float32.tflite'
|
|
|
|
# Load the exported TFLite model
|
|
tflite_model = YOLO("runs/detect/train/weights/best_saved_model/best_float32.tflite")
|
|
|
|
# Run inference
|
|
results = tflite_model("datasets/valid/images/2007_000042_jpg.rf.dadefef10ec4b9422a1689f7ce40588e.jpg") |