AI

这个报错是为啥
?

这边测试功能正常,请确保你的模型和标签文件没有问题

没有问题‘

但是还是有错
刚刚开始是没问题的但是隔了一分钟左右就跳出来了
先使用官方模型测试

这个错误是为什么
哪个型号的OpenMV
OpenmvH7PLUS
"trained.tflite"
# Copyright (c) SingTown Technology. All rights reserved.
# OpenMV.cc SingTown.com
# 导入所需模块
import sensor, image # 摄像头和图像处理模块
import ml
import time
# 初始化摄像头
sensor.reset() # 重置摄像头传感器
sensor.set_pixformat(sensor.RGB565) # 设置像素格式为RGB565(也可用GRAYSCALE灰度)
sensor.set_framesize(sensor.QVGA) # 设置帧大小为QQVGA(128x160),适配LCD屏幕
sensor.set_windowing(128,128)
sensor.skip_frames(time=2000) # 跳过前2000ms的帧,等待摄像头稳定
with open('labels.txt','r') as file:
labels = [line.strip()for line in file if line.strip()]
print(labels)
model = ml.Model("trained.tflite", load_to_fb=True)
print(model)
norm = ml.Normalization(scale = (0.0,1.0))
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot() # 捕获当前帧图像
# 识别逻辑并排序
scores = sorted(
zip(labels, model.predict([norm(img)])[0].flatten().tolist()),
key=lambda x: x[1],
reverse=True
)
print(clock.fps(), "fps\t", "%s = %f\t" % (scores[0][0], scores[0][1]))
?
还是不行
你要把模型文件放到OpenMV的目录里面,而不是romfs。 自行训练AI神经网络模型 · OpenMV中文入门教程这个教程是针对5.0固件的
