All the code for this project is open sourced and Dockerized for ease of use. Try it out.
I built The Baby Sleep Coach so that my wife and I could automatedly track our baby’s sleep, primarily for us to know when his next nap should be. But pretty much immediately after I put out the video, the code stopped working on my baby. The first version relied on anatomical features always being present, as they are when you have a newborn. Newborns are usually swaddled and laying on their backs.
But my baby started rolling around and wearing blankets, resulting in the code considering him awake, as it couldn’t find his face/other features in the video feed. This code still works great for newborns.
In order to extend the use of this project to older babies and younger kids (I claim it can work for all ages, newborn -> adult) I added a final fallback layer of logic, which is largely a classic machine learning image classifier. The interesting part of this is less the model, and more so the data problem. For obvious reasons I couldn’t attempt searching for datasets of children sleeping.
I found a way around delivering a pretrained model to you, rather The Baby Sleep Coach ships with a web application which runs in front of the sleep tracking code. This enables you to just click a button on your phone (via locally hosted web app) to “correct” the classifier. So each time you open the web app to look at your chubby little baby, if it’s tracking incorrectly, you click a button to say it’s wrong. I found that within 1-2 days of correcting it, it was stable and more resilient than the top-shelf baby monitor AI-baked products on the market.
Sure there’s a little bit of work, but this is free. Not $400 + subscription + special camera stand (this is a thing).. no whining.