In this modern world, it’s surprising how often old problems can find new solutions. I’m sure there are a lot of other Canberrans like me, all familiar with those pesky pigeons who swoop in and steal our chickens’ food. Today, we’re going to talk about how I used an image recognition model to tackle this problem.
The Project: Keeping Pigeons Away from Chicken Feed
The silkies at our chicken coop have had a long-standing feud with the pigeons who have been stealing their food. Our latest attempt to resolve this by creating a feeder out of PVC piping with a U-shaped elbow, high enough for our silkies to reach but not the pigeons (evaluation still underway). But being a tech enthusiast, I wanted to explore how AI can help in such everyday situations.
The AI Solution: Image Recognition
Having recently come across the fastai book I choose to follow allowing for the second chapter/notebook. This walkthroug uses the resnet18 model for this project. Resnet18 is a pre-trained Convolutional Neural Network model capable of image classification tasks. The model was fine-tuned using 4 epochs to distinguish between images of silkies and pigeons.
The data used to train the model were gathered from Bing’s Web Search API. The model was trained on a balanced dataset with 150 images of pigeons and 150 images of silkies (train_size = 122, test_size = 28). A small batch of the images is visualised below:

And guess what? The training process was a breeze! Thanks to Google Colab’s free GPU offering, it took less than 2 minutes to train the model.

Using data augmentation for better results
Data augmentation is a powerful technique to enhance the performance of image classification models. It involves artificially expanding the size of a training dataset by applying a variety of transformations to the existing images. These transformations can include rotations, translations, flips, scaling, cropping, and even adding noise or distortions.
Below is an example of six copies of the same image generated by using data augmentation.

By applying these augmentations, the model is exposed to a more diverse range of images, which helps it learn robust and generalized features.
The Results: 100% Accuracy
The model showed promising results with an impressive accuracy rate of 100%. It seems that we have trained a hawk-eyed AI model that doesn’t miss a pigeon!

To those who might be wondering, the most challenging aspect of this project wasn’t the technicalities of the model, or gathering the data, but rather, overcoming my own laziness to start this fun project!
What’s Next: Implementing the AI Model
The next step is to put this AI to work and build a chicken feeder that uses this image recognition model to control access to feed based on the presence or absence of pigeons.
After validating the model. I then uploaded one of my own picture of our two cute little silkies (unfortunately the pigeons are long gone by the time I am in the vicinity for a picture). I have to say that even I was pretty impressed with the results! I have shared my image as an example in the application so feel free to go check it out and try it for yourself! Play around with uploading a picture of your own (or from the web) silkies/pigeons and see what the results are!
Of course, while developing this AI driven solution to fend off our silkies’ dinner, we’re also considering other methods, like hanging reflective objects like CDs around the feeding area and even a step on feeder. Currently the preliminary results of the PVC piping contraption seem to be promising. Perhaps if someone reading this has a keen interest in 3D printing (as I don’t have a printer myself) I’d be happy to work together and advance this project further.
Conclusion
This project is an example of how AI can serve as a solution to our everyday problems. It has been a fun and rewarding experience to step out of the comfort zone and use technology to resolve this issue. I highly recommend the fast.ai book for anyone interested in starting similar projects. Their instructions are clear, comprehensive, and beginner-friendly.

