用户在运行OpenMV人眼识别示例代码时出现错误,尝试将原HQVGA分辨率改为QVGA后仍报错。已提供IDE报错截图、完整代码、参考文档来源(星瞳科技电子书)及硬件正反面照片。




import sensor
import time
import image
# Reset sensor
sensor.reset()
# Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
# Load Haar Cascade
# By default this will use all stages, lower satges is faster but less accurate.
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
eyes_cascade = image.HaarCascade("/rom/haarcascade_eye.cascade", stages=24)
print(face_cascade, eyes_cascade)
# FPS clock
clock = time.clock()
while True:
clock.tick()
# Capture snapshot
img = sensor.snapshot()
# Find a face !
# Note: Lower scale factor scales-down the image more and detects smaller objects.
# Higher threshold results in a higher detection rate, with more false positives.
objects = img.find_features(face_cascade, threshold=0.5, scale_factor=1.5)
# Draw faces
for face in objects:
img.draw_rectangle(face)
# Now find eyes within each face.
# Note: Use a higher threshold here (more detections) and lower scale (to find small objects)
eyes = img.find_features(
eyes_cascade, threshold=0.5, scale_factor=1.2, roi=face
)
for e in eyes:
img.draw_rectangle(e)
# Print FPS.
# Note: Actual FPS is higher, streaming the FB makes it slower.
print(clock.fps())1、首先需要打开romfs查看是否有对应模型; 2、无对应模型则需要在工具-机器视觉-开放模型库中下载并导入romfs 3、更新固件到5.0.0版本,4.8.1版本不支持完整的romfs使用
romfs在哪打开

我点击打开romfs文件直接是这个


这样子是正常的吗
正常的,但是这个里面没有haarcascade模型,haarcascade需要自行从开放模型库中复制和导入romfs
haarcascade模型在哪,导入romfs这一个步骤我也不会
还有我想问一下为什么今天更新5.0.0固件后点不动运行
我的问题和训练神经网络模型有啥关联
点不动运行重新插拔usb就可以了