First of all, let me tell you that I Love Pigeon and especially white pigeons. Then,
Why?
So when I shifted to a new home, After a couple of days I started hearing pigeon’s sound in the early morning and sometimes in afternoon. I had to get up 5 to 6 times to scare them away and I had to do this most of the days in a week. On weekends too. I saw that pigeons were used to sit outside my gallery window.
Another thing, If I go out for a day and on returning back I see this. Sometimes even worse than this but I don’t have the photograph for that as of now. They become king of the house when they see no one around. This kept on happening for months.Then the moment came when I realized that I have to do something to get rid out of this.
Very first thing I thought was bird net but that was not a good fit for my case due to some reason.
So I decided to try out scare tape which is widely used to scare all kinds of birds. But It did not work, maybe because of less sunlight. After a few days, pigeons used to sit on top of this tape wrapped over metal bars and idea seemed failing.
Check this out.
I started thinking more on this and suddenly an idea came to build something using technology that does this job well.
Also read: Creating an Onboarding Page Indicator in Flutter: A Quick Guide
How?
The main idea to was to make something that detects pigeons and scare them away using sound.
Initial plan
So at the very initial level, I thought of using Android things, piezo buzzer, raspberry pi, firebase realtime database and Android app. I could think of using a dedicated mobile device is because I am having very old spare mobile phone whose touch is not working properly and almost dying. So it was better to take it out of the cupboard and make good use of it.
As per the initial plan, Android app would constantly scan for pigeons using any detection techniques most probably google cloud vision. As app detects pigeon it could trigger some flag in firebase realtime database. At other side, Android things inside raspberry pi would listen for that flag in firebase and would play sound in piezo buzzer.
This remained only on paper for months. But recently Google IO18event made an announcement of new ML Kit in Firebase
I saw this video and check out this official announcement and saw that ML kit provides five ready-to-use different API. such as
- Text recognition
- Face detection
- Barcode scanning
- Image labeling
- Landmark recognition
I got very excited to know that the API that I was interested in was there in ML Kit and that is Image labeling. It actually recognizes objects in the image so I could easily integrate into the Android app and could detect pigeons. This actually gave a boost to this project and I made a new start.
Also read: Exploring Flutter Animation Options: A Guide to Enhancing Your Mobile App
Final plan
I dropped the previous idea of using raspberry pi just to play sound and decided to use phone’s inbuilt speakers to play sound. The time and process to build this became very short and I laid out a new approach.
So the plan was to build Android app that uses ML Kit from Firebase, constantly scanning for pigeons and play any sound as soon as it recognizes pigeon. Very simple.
I was waiting for one good weekend where I would not have other work to do and could finish this project. Finally, that weekend came and I quickly built this app and tested it out. I was happy to see that it was actually working as per whatever I have imagined.
Testing this app was little difficult since I cannot have pigeons in front of me all the time. So I was testing it by showing an image of pigeons to the app. I found few things while testing…
Problem 1: Since I made this app to work only on pigeons, It can also work on any other bird because the callback that app was getting from ML Kit contained label as “Bird” not “pigeon” and that was because I am using on-device APIthat has 400+ labels that cover the most commonly-found concepts in photos. We can also use Cloud API to accurately detect pigeons but we need enable pricing for that and I was comfortable with free on-device API.
Problem 2: App starts playing sound even if it sees feathers of any bird rather than bird or pigeons itself in my case. I found that callbacks from ML kit also offers confidence on the result. So when I set confidence to more than 65%, now app would only sound if detects and has confidence more than 65% that it is a bird. So setting confidence threshold to 65% this problem got resolved. It can no more play sound on feathers of a bird.
Problem 3: Sound. I was not sure that pigeons will get scared from any random notification sound from the phone. So I searched for pigeon scaring sound and downloaded it.
Last but not the least. I had to give a name to this app and suddenly “Furr” came to my mind. I don’t know why but liked it and decided to keep it.
By now the app has taken that shape that I can now test it on real pigeons. I was very excited to see that it was actually working.
This how I have actually placed mobile phone running Furr.
Also read: Creating Your Own Notebook Page with CustomPaint in Flutter
Furr in Action
NOTE: This is not the full proof solution. It has few bugs. It may not work completely or may not be practical in most cases. I just made it to work in my use case and This is just my small effort in solving this problem using technology.
I am open sourcing this app. Here is the full source code.