This project will help you add facial recognition to ST by using a Raspberry Pi and a Raspberry Pi Camera and turning it into a smart doorbell, which is pretty cool. You can of course use this project for other things as well, like a security camera where it will capture movement and if there is a face detected, warn you that somebody is around.
The raspberry pi is required as it is where the code is hosted. So whenever there is a trigger (motion, button pressed, etc.) you’re automation tool of choice (in this case webCoRE) will make a GET request to your raspberry pi to capture a picture and then send that picture over to Amazon Rekognition for analysis.
The script works for all versions of raspberry pi. When an image is captured, there are 3 possible scenarios. Depending on the scenario’s, the parameters that the script sends over to webCoRE defers:-
When there is a face and Amazon Rekognition recognises a face, it will pass these parameters:-
‘person’ – the name of the person identified
‘similarity’ – a percentage value of how similar it has matched the face
‘confidence’ – a percentage of the confidence score that it got it right
f there is a face detected, but Rekognition failed to identify the face, it will pass these parameters:-
‘person’ – “Unknown”. It passes unknown so that you can create rules in your statement to handle this accordingly
‘faceConfidence’ – a percentage value on how confident it was that there is a face in the image capture
‘ageHigh’ – the maximum age of the face seen in the image capture
‘ageLow’ – the minimum age of the face seen in the image capture
‘gender’ – the gender of the face identified in the image capture
‘genderConf’ – how confident it is in the gender in percentage
‘mustache’ – a true/false entry whether the face in the image capture has a moustache or not
‘sunglasses’ – a true/false entry whether the face in the image capture has a sunglasses on or not
If it did not detect a face in the image capture, the script will only send a single parameter:-
‘person’ - No. It passes this so that you can create rules in your statement to handle this accordingly
Full install details is over here:-
Here are some screenshots:
This is what you’ll see when you manually execute the script on a browser:
Let me know if you bump into any issues