The deep learning Santa/Not Santa detector
Did you see Mommy kissing Santa Claus? Or was it simply an imposter? The Not Santa detector is here to help solve the mystery once and for all.
Ho-ho-how does it work?
Note: Adrian Rosebrock is not Santa. But he does a good enough impression of the jolly old fellow that his disguise can fool a Raspberry Pi into thinking otherwise.
But how is the Raspberry Pi able to detect the Santa-ness or Not-Santa-ness of people who walk into the frame?
Two words: deep learning
If you’re not sure what deep learning is, you’re not alone. It’s a hefty topic, and one that Adrian has written a book about, so I grilled him for a bluffers’ guide. In his words, deep learning is:
…a subfield of machine learning, which is, in turn a subfield of artificial intelligence (AI). While AI embodies a large, diverse set of techniques and algorithms related to automatic reasoning (inference, planning, heuristics, etc), the machine learning subfields are specifically interested in pattern recognition and learning from data.
Artificial Neural Networks (ANNs) are a class of machine learning algorithms that can learn from data. We have been using ANNs successfully for over 60 years, but something special happened in the past 5 years — (1) we’ve been able to accumulate massive datasets, orders of magnitude larger than previous datasets, and (2) we have access to specialized hardware to train networks faster (i.e., GPUs).
Given these large datasets and specialized hardware, deeper neural networks can be trained, leading to the term “deep learning”.
So now we have a bird’s-eye view of deep learning, how does the detector detect?
Cameras and twinkly lights
Adrian used a model he had trained on two datasets to detect whether or not an image contains Santa. He deployed the Not Santa detector code to a Raspberry Pi, then attached a camera, speakers, and The Pi Hut’s 3D Xmas Tree.
The camera captures footage of Santa in the wild, while the Christmas tree add-on provides a twinkly notification, accompanied by a resonant ho, ho, ho from the speakers.
A deeper deep dive into deep learning
A full breakdown of the project and the workings of the Not Santa detector can be found on Adrian’s blog, PyImageSearch, which includes links to other deep learning and image classification tutorials using TensorFlow and Keras. It’s an excellent place to start if you’d like to understand more about deep learning.
Build your own Santa detector
Santa might catch on to Adrian’s clever detector and start avoiding the camera, and for that eventuality, we have our own Santa detector. It uses motion detection to notify you of his presence (and your presents!).
Check out our Santa Detector resource here and use a passive infrared sensor, Raspberry Pi, and Scratch to catch the big man in action.
I think it’s a really cool demo. Particularly impressive to me is that it has a reasonable frame rate; “deep learning” applications typically run on very heavy hardware to get anything like real-time performance.
Mmhmm. Adrian is a pro.
Adrian’s site is one of the most comprehensive and helpful I have used in a while. Was really useful to me when I was setting up OpenCV, and I will be reading his TensorFlow articles as well. Great stuff.