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