CLClab306 Demos the Impressive TinyML Facial Recognition Capabilities of the Person Sensor
Tested on Presidential portraits, the Person Sensor proved perfect for picking out faces for a Raspberry Pi Pico.
Pseudonymous maker "CLClab306," hereafter simply "CLC," has penned a guide demonstrating some impressively-accurate tinyML facial recognition — using a Raspberry Pi Pico microcontroller board and the Useful Sensors Person Sensor.
"Facial recognition systems have been in use for decades, but the cost and complexity of the required hardware and software has typically put facial recognition beyond the reach of most makers," CLC explains. "However, that situation changed recently with creation of the Person Sensor by Useful Sensors Inc. This novel sensor brings machine-learning capabilities like facial detection and facial recognition to a small (19.3×22mm), relatively inexpensive (<$10) module that can be programmed with low-cost microcontrollers over an I2C interface."
To prove it, CLC set about building a low-cost facial recognition system — combining the Person Sensor with an RP2040-powered Raspberry Pi Pico microcontroller board in Pimoroni's Pico Explorer Base to provide buttons and a display for on-device interactivity. The idea: training the Person Sensor to detect up to eight faces and distinguish between them, using a CircuitPython program running on the Raspberry Pi Pico.
"I used my program to 'teach' the device what each of the last eight U.S. Presidents looked like by showing it eight different Presidential Portrait photos," CLC explains of his "best-case test" of the Person Sensor's capabilities. "All eight photos were correctly identified within a few seconds with a high degree of confidence (99 per cent)."
Perhaps the most interesting aspect of CLC's project is that, unlike many facial recognition implementations, the training occurs entirely on-device — with no need to feed data into a more powerful system and deploy the resulting model to the microcontroller. Instead, the on-board user interface provides a means to access each of the eight possible recognition slots and train — or "calibrate," as Useful Sensors would have it — the Person Sensor to recognize a particular face.
CLC's full write-up is available on Instructables, with source code, a wiring diagram, and a 3D-printable adapter to hook up a NeoPixel ring for illumination to improve recognition capabilities in low lighting conditions.