
如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片
@g36h 神经训练后的运行报错
@kidswong999 labels = [line.rstrip('\n') for line in open("labels.txt")]
显示这一行报错
@kidswong999 # Edge Impulse - OpenMV Image Classification Example
import sensor, image, time, os, tf
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.set_windowing((240, 240)) # Set 240x240 window.
sensor.skip_frames(time=2000) # Let the camera adjust.
net = "trained.tflite"
labels = [line.rstrip('\n') for line in open("labels.txt")]
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
# default settings just do one detection... change them to search the image...
for obj in tf.classify(net, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):
print("**********\nPredictions at [x=%d,y=%d,w=%d,h=%d]" % obj.rect())
img.draw_rectangle(obj.rect())
# This combines the labels and confidence values into a list of tuples
predictions_list = list(zip(labels, obj.output()))
for i in range(len(predictions_list)):
print("%s = %f" % (predictions_list[i][0], predictions_list[i][1]))
print(clock.fps(), "fps")
你没有把label.txt文件和trained.tflite文件复制到OpenMV的磁盘里吧?
按照视频步骤操作:
https://singtown.com/learn/50872/
@kidswong999 复制了,三个都有的
@g36h 重新复制,等红灯灭了,然后重启OpenMV,然后运行代码。

@kidswong999 您好,我试了还是会中途报错,图像出现了1秒后就会报那个错误
@g36h 这个无所谓,一样的。
@kidswong999 这个我插了个SD卡,因为空间不够,有影响吗
@g36h 如果插了SD卡,就要放在SD卡里。
https://singtown.com/learn/50244/

主要是检查OpenMV弹出来的磁盘里有没有这两个文件。如果有,格式化然后重新存。
@kidswong999 您好,是有的,格式化fat32之后再重放还是这样的:tired_face:
没准是你文件有问题。
https://github.com/SingTown/mask-tflite
可以下载这个已经训练好的测试。
@kidswong999 您好,我下载咱这个测试也有问题,会报那个错
@kidswong999 您好,是很多库都删了吗,我现在好多程序运行不了了
@g36h 新的问题单独发帖子。哪个程序用不了就发哪个。