The shift to remote work for many of us over the past year has meant that we have some new and interesting “coworkers” hanging around our work spaces. For most people those coworkers take the form of cats walking across our keyboards, or dogs that are clearly irritated that we choose to type with our hands rather than pet them.
For Everett Robinson, the change of scenery helped him discover the unexpected wildlife that was hanging around just outside his window during the day. Being a hardware hacker at heart, he grabbed a Raspberry Pi 4 and an old USB webcam and got to work building a wildlife tracker, which he calls the Birb Cam, that would prevent him from missing out on seeing his furry and feathery little friends ever again.
Robinson created a Python script that captured frames from the webcam, and with the help of an OpenCV background subtraction function, was able to detect changing pixels, i.e. animals paying a visit to his balcony. For simplicity, he used fast.ai to retrain a ResNet model with his own image data, which was used to classify images of detected animals.
While Robinson wanted to run the inference algorithm directly on the Raspberry Pi’s CPU, he was having problems due to a bug in the preprocessing pipelines for the arm64 build of torchvision. As an alternative, he made use of Google Cloud Functions, which packaged up all of the software libraries he needed in a Docker image and allowed him to run inferences remotely.
The source code is available on GitHub for anyone that is interested in a relatively simple and fun hobby project.