logo

OpenMV4 H7 Plus无法运行人脸识别官方例程 - 缺少frontalface文件报错

2025-12-30 21:43
7
7mnug387tmxe

OpenMV4 H7 Plus无法运行人脸识别官方例程 - 缺少frontalface文件报错

用户在使用OpenMV4 H7 Plus时遇到了人脸识别官方例程无法运行的问题,系统报错缺少frontalface文件。

故障类型为代码报错,硬件型号为OpenMV4 H7 Plus,固件版本为4.7.0。

故障现象:运行人脸识别官方例程时出现错误,提示缺少frontalface文件。

IDE错误截图
import sensor, image, time

# Reset sensor
sensor.reset()

# Sensor settings
sensor.set_contrast(3)
sensor.set_gainceiling(16)

# HQVGA and grayscale is the best for face tracking.
sensor.set_framesize(sensor.HQVGA)
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("frontalface", stages=25)
print(face_cascade)

# FPS clock
clock = time.clock()

while (True):
    clock.tick()

    # Capture snapshot
    img = sensor.snapshot()

    # Find objects.
    # 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.75, scale_factor=1.25)

    # Draw objects
    for r in objects:
        img.draw_rectangle(r)

    # Print FPS.
    # Note: Actual FPS is higher, streaming the FB makes it slower.
    print(clock.fps())
  • 参考文章:face_detection · OpenMV中文入门教程 (https://book.openmv.cc/example/03-Machine-Learning/02-Haar-Cascade/face_detection.html#example-03-machine-learning02-haar-cascadefacedetectionpy)
  • 硬件状态:未连接任何配件
  • 问题描述:运行官方人脸识别例程时,系统报错缺少frontalface文件,无法正常加载Haar Cascade分类器
2025-12-31 16:52
Z