OpenMV N6 disconnects and reconnects when running custom Yolo8 model

Hi,
I’m facing an issue with the N6 Cam where it disconnects and reconnects when I try to run a script using a custom Roboflow yolo8 model.

  • I’m using OpenIDE on Windows
  • Connected via USB
  • Have updated the firmware of N6 to 5.0.0 already
  • The model was downloaded using Roboflow’s deployment for OpenMV

Below is the script I am running, which is based on the YoloV8 example in the IDE:

import csi
import time
import ml
from ml.postprocessing.ultralytics import YoloV8

# Initialize the sensor.
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)
csi0.window((224, 224))

# Load YOLO V8 model from ROM FS.
model = ml.Model("/rom/openmv_beverage-recog.tflite", postprocess=YoloV8(threshold=0.4))
print(model)
model.labels = [
    "bottle-glass",
    "bottle-plastic",
    "cup-disposable",
    "cup-handle",
    "glass-mug",
    "glass-normal",
    "glass-wine",
    "gym bottle",
    "tin can"
]

# Visualization parameters.
n = len(model.labels)
model_class_colors = [(int(255 * i // n), int(255 * (n - i - 1) // n), 255) for i in range(n)]

clock = time.clock()
while True:
    clock.tick()
    img = csi0.snapshot()

    # boxes is a list of list per class of ((x, y, w, h), score) tuples
    boxes = model.predict([img])

    # Draw bounding boxes around the detected objects
    for i, class_detections in enumerate(boxes):
        rects = [r for r, score in class_detections]
        labels = [model.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")

The first time it was run it showed 1 or 2 frames and now it disconnect/reconnects the cam every time the script is run. (the example scripts all work fine)

Below is the result of print(model)

{ model_size: 3240912, model_addr: 0x713fe960, ram_size: 198592, ram_addr: 0x341090a0, input_shape: ((1, 224, 224, 3),), input_scale: (0.00392157,), input_zero_point: (0,), input_dtype: ('B',), output_shape: ((1, 13, 1029),), output_scale: (1.0,), output_zero_point: (0,), output_dtype: ('f',) }

I am pretty new to the field and still learning. Any help would be appreciated.

Best,
Khash

Hi, we just updated the ST edge AI library to v4.0.0. OpenMV IDE is out of date to use this right now. I can resolve the issue with a new IDE version on Wednesday.

Working on updating this all today. Will have a new version that should unblock you by the end of the day.

Hi, a new IDE with updated tools is being built. I’ll be able to test, verify, and hopefully release tomorrow.

Hi, the issue is resolved: Release Development Release · openmv/openmv-ide · GitHub

Please install any non-factory IDE. You should be able to update the N6 to the latest firmware release and then use the compiler tools. The examples are still tied to the release version of 4.8.1 right now.

I will be redoing the IDE update infrastructure next after finishing updating the tutorial to pull the latest examples from openmv’s github: openmv/scripts/examples at master · openmv/openmv · GitHub

Hi, thank you very much.

With the updated IDE and firmware my model is working as expected.