I was wondering what the capabilities of the OpenMV Cam H7 R2 were in terms of running object detection models such as YOLO? I have seen the documentation on the tensorflow lite support however am not sure if the operations in YOLO are supported by tflite and furthermore if the hardware capabilities of the cam are adequate for a real time object detection task using such models.
I would appreciate some light being shed on this matter.
Thank you!
Hi, you can run YOLOV5 models on the H7 Plus and RT1062 right now. It just runs at 0.3 FPS or so. Edge Impulse allows you to train them right now.
We don’t have any demos yet per say though, but, I can share with you scripts that work if you want to try this out right now. v4.6.0 that was released can run YOLOV5. As for the new silicon. That’s around the corner
# This work is licensed under the MIT license.
# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# TensorFlow Lite Tiny YoloV5 Object Detection Example
import time
import sensor
import ml
from ml.postprocessing import yolo_v5_postprocess
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
model = ml.Model("<MODEL FILE PATH>", load_to_fb=True)
model_class_labels = ["person"]
model_class_colors = [(0, 0, 255)]
print(model)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
# boxes is a list of list per class of ((x, y, w, h), score) tuples
boxes = model.predict([img], callback=yolo_v5_postprocess(threshold=0.4))
img.to_ironbow()
# Draw bounding boxes around the detected objects
for i, class_detections in enumerate(boxes):
rects = [r for r, score in class_detections]
labels = [model_class_labels[i] for j in range(len(rects))]
colors = [model_class_colors[i] for j in range(len(rects))]
ml.utils.draw_predictions(img, rects, labels, colors, format=None)
print(clock.fps(), "fps")
# This work is licensed under the MIT license.
# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# TensorFlow Lite Tiny YoloV2 Object Detection Example
import time
import sensor
import ml
from ml.postprocessing import yolo_v2_postprocess
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
model = ml.Model("<MODEL FILE PATH>", load_to_fb=True)
model_class_labels = ["person"]
model_class_colors = [(0, 0, 255)]
print(model)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
# boxes is a list of list per class of ((x, y, w, h), score) tuples
boxes = model.predict([img], callback=yolo_v2_postprocess(threshold=0.4))
img.to_ironbow()
# Draw bounding boxes around the detected objects
for i, class_detections in enumerate(boxes):
rects = [r for r, score in class_detections]
labels = [model_class_labels[i] for j in range(len(rects))]
colors = [model_class_colors[i] for j in range(len(rects))]
ml.utils.draw_predictions(img, rects, labels, colors, format=None)
print(clock.fps(), "fps")