The Birbs and the Bees

Add some smarts to your backyard wildlife watching with this Raspberry Pi-powered animal tracker.

Nick Bild
4 years agoMachine Learning & AI
Birb Cam (📷: E. Robinson)

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.

At that point, the wildlife detector was fully operational, but still needed a user interface. He built a REST API in Flask that serves up data and images to a JavaScript-powered visualization front-end. Now Robinson will never miss one of his animal visitors again, and he has been learning some interesting things about their daily schedules as a bonus.

The source code is available on GitHub for anyone that is interested in a relatively simple and fun hobby project.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Get our weekly newsletter when you join Hackster.
Latest articles
Read more
Related articles