Firmware 4.0 regression issue with Haar Cascade?

I had been successfully using the Haar Cascade algorithm for face detection/counting, and it had been working perfectly. With the 4.0 firmware, the accuracy is significantly lower. Even with a clear face image, the algorithm is often returning no faces detected. Any thoughts on what has changed and what the possible cause is?

Here’s the code that creates the Haar Cascade.

face_cascade = image.HaarCascade(“frontalface”, stages=25)

Nothing special about the image capture - using the recommended defaults:

# Reset sensor

sensor.reset()
sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)

You need to change the image contrast. Use the gamma_correction method and boost the constrast by 1.5.

That algorithm really requires good contrast. But… soon, it will not be needed. TensorFlow support for bounding boxes will be worked on and added after I get new documentation and the IDE re-released.

Thanks, but what changed in the 4.0 firmware to result in this degradation in face detection?

Your frame rate would have increased. Otherwise nothing.

It seems to actually have degraded significantly - just installed 4.01 and the same code that averaged about 4.5 fps is now consistently 2.1 fps.

I know why it has gone down. It’s the frame capture load on the processor. This PR will fix it: Enable 100% MDMA offload for specific sensors by kwagyeman · Pull Request #1346 · openmv/openmv · GitHub

Things are working perfectly on the OV5640 but having some issues bringing it to other cameras.

Hi, okay, with this PR I’d getting 20 FPS with the stock face detection example on the H7 plus.

Note, you can turn off triple buffering if you think this is an issue by doing set_framebuffers(1). This basically disables the extra memory load on the system from constant image capture. If your algorithm is not running anywhere near the camera frame rate then you don’t need this on.