It’s now much easier to AI features to your project thanks to better tools, but as we’ve experienced when trying out Edge Impulse machine learning platform on the XIAO BLE Sense board, it still requires some effort and the learning curve may be higher than some expect.
But for common tasks like face detection, there’s no reason for the solution to be hard-to-use or expensive, and Pete Warden (Useful Sensors) has designed the $10 Person Sensor fitted with a camera module pre-programmed with algorithms that detect nearby faces and reports the results over an I2C interface.
Person Sensor specifications:
- ASIC – Himax HX6537-A ultra-low-power AI accelerator @ 400 MHz with 2MB SRAM, 2MB flash
- Camera
- Image Sensor – 110 degrees FOV
- Image scan rate – 7Hz with no facial recognition
- Image scan rate – 5Hz with facial recognition active
- Host interface
- Qwiic connector for the I2C interface up to 400 Kbps
- Interrupt pin used to indicate if any people have been detected.
- Operating Voltage – 3.3V
- Power consumption
- Up to 150mW
- 5mW for the LED
- Dimensions – Small…
You’ll need to connect the module to a host microcontroller that with either poll for data or use the interrupt pin, and get face detection coordinates out of a 256×256 pixels area, as well as confidence in percent, and whether the face is facing the camera or not. No image data is sent to the host and as such it offers improved privacy. Note the Himax microcontroller is preprogrammed and you can’t update the firmware or get updates.
A sample program (polling mode) for the Raspberry Pi Pico would look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
person_sensor_results_t results = {}; while (1) { // Perform a read action on the I2C address of the sensor to get the // current face information detected. if (!person_sensor_read(&results)) { printf("No person sensor results found on the i2c bus\n"); sleep_ms(SAMPLE_DELAY_MS); continue; } printf("********\n"); printf("%d faces found\n", results.num_faces); for (int i = 0; i < results.num_faces; ++i) { const person_sensor_face_t* face = &results.faces[i]; printf("Face #%d: %d confidence, (%d, %d), %dx%d, %s\n", i, face->box_confidence, face->box_left, face->box_top, face->box_right, face->box_bottom, face->is_facing ? "facing" : "not facing"); } sleep_ms(SAMPLE_DELAY_MS); } |
The module will also return identity information, or in other words, try to detect up to 8 different users, but this is not shown in the example above, and it’s not clear how well that works. You’ll find documentation and code samples in different languages including Arduino, CircuitPython, and Python on GitHub.
The video below shows a face following fan demo based on the Person Sensor module.
The Person Sensor is listed on Sparkfun for $9.95, but is out of stock and on backorder at the time of writing.
Via Hackster.io
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
“Detecting” a face is interesting but what happens next? Is there something more you can do with such a low resolution image? Maybe trigger recording with a better camera?
It’s hard to imagine that identification could be very accurate from such a low resolution image.
Just an idea, but you could attach it to a desktop fan with some servo motors, and make it follow you, instead of relying on the usual side-to-side mechanisms.
Well, that works unless you are standing the whole day. Then you can skip it.
Or a “robot” that can face onlookers (and say something “Halloween-y”). I’m thinking a Dracula doll, or a skeleton. Could possibly also follow onlookers with it’s eyes
It’s fun because what made me start to work with an hexapod bot ~12 years ago was precisely an attempt at making it follow people, a bit like a dog. Face detection on a 500 MHz Geode LX was not that great, to say the least. Future improvements with Allwinner H3 was slightly better but not awesome. Seeing such tiny autonomous devices instantly reminds me lots of time spent trying to just detect a face in moving images before the person left the room 🙂
The 256×256 grid is merely used for the location of the face detected. You don’t get any face image at all.
The camera resolution used for face detection is not given, as the whole solution is a black box, and you don’t get back any image from the sensor anyhow.
All you should care about is whether this sensor is working reliably or not.