logo

工创大赛:OpenMV N6识别固定位置带数字‘3’色环(15cm高度,比赛台面环境)

2026-09-09 15:17
J
jz8rjy942rrg

我现在就是没写其他代码 然后main.py文件能在IDE正常运行但识别不出我数据集里面框选的对象 就是这个图像显示上没有红色框

Z
星小瞳xs

看一下你的训练指标和日志

J
jz8rjy942rrg
屏幕截图 2026-09-09 151941.png
屏幕截图 2026-09-09 151933.png
J
jz8rjy942rrg

第二个消息很长一串的是日志

Z
星小瞳xs
# This work is licensed under the MIT license.
# Copyright (c) 2013-2025 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# TensorFlow Lite YOLO V8 Example
#
# This example runs a YOLO V8 person detection model.
#
# NOTE: This exaxmple requires an OpenMV Cam with an NPU like the AE3 or N6 to run real-time.

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.VGA)

# Load YOLO V8 model from ROM FS.
model = ml.Model("/rom/trained.tflite", postprocess=YoloV8(threshold=0.2))
print(model)

# 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")

Z
星小瞳xs

使用此代码尝试,然后romfs中是否正确上传了模型和标签

Z
星小瞳xs

然后你识别的时候OpenMV的画面是什么样的

J
jz8rjy942rrg

我开始在romfs上传了的,那个代码我运行但是依旧没有红色框

image.png
image.png
J
jz8rjy942rrg

画面就是这样的

image.png
2026-09-09 15:37
J
jz8rjy942rrg

还有办法解决嘛🫢

2026-09-09 15:50
Z
星小瞳xs

你拍数据集的时候分辨率是多少?

2026-09-09 16:15
J
jz8rjy942rrg

是640x480

J
jz8rjy942rrg
image.png
J
jz8rjy942rrg

是640x400不是6

40x480

2026-09-09 16:40
Z
星小瞳xs

加数据集后重新训练,具体看我上面的建议

2026-09-09 16:58
J
jz8rjy942rrg

训练集要多少张才合适呀,我原来是刚好100张这样

J
jz8rjy942rrg

原来是训练集100张。验证集22张,测试集13张,这个分配有没有问题呀

J
jz8rjy942rrg

还有数据集的图片标注我是这样的,没问题吧❓

屏幕截图 2026-09-09 163239.png
2026-09-09 17:13
Z
星小瞳xs

最起码300多张吧,你的数据集里面的图片太同质化了,模型根本学不到特征。你的数据集中的图片应该包含多种角度,多种光线等,不要一个角度死拍几百张,没有作用的,模型学不到特征

2026-09-09 17:35
J
jz8rjy942rrg

好的我试试