I am currently trying to optimise my CascadeClassifier used to detect faces on the raspberry pi. There are two main factors - Speed and Quality.
SPEED
I want the camera to pick up a face as quickly as possible so as to react to the image and also I want to collect as many photos as possible of the face.
QUALITY
I need the camera to be able to pick up the face (obviously). I am finding this the most difficult to measure as I am only knowing how well it has done after running a stream loop from the camera which returns cropped images of the face - any tips on how to measure this would be great.
My configuration setup is this with the detectMultiScale
function:
CLASSIFIER = 'haarcascade_frontalface_default.xml'
SCALE_FACTOR = 1.4
MIN_SIZE = (30, 30)
NEIGHBOURS = 4
and this gives me about two images per second.
I was wondering if I could multithread the detection to take advantage of all 4 cores so as to keep collecting images on 1 thread and on the other 3 run the classifications are there any issues with this?
Ideally I would like the photos of the face to be of a lot higher quality then the current (640, 480)
And then cropped to the actual size of the face which could be 30,30
as I am then planning to run a recognition algorithm on the face itself afterwords.
Currently if I remove the classification the RPi takes 12 images per second at (640, 480)
and 6 per second at (1080, 960)
which seems pretty slow in itself.
Any advice on these tasks would be greatly appreciated. I am thinking that maybe an RPi is not the answer and I should invest in some better hardware.