Animal Watching Telegram Bot with Github Actions
Posted: March 28, 2021
So I thought I could do some game watching without the effort. The South African National Parks service (SANParks) has a few webcams at the watering holes.
They were punting this during lockdown quite a bit as people couldn’t travel to the kruger park.The link to the webcams is www.sanparks.org/webcams/. They don’t really have live video feed (seems to be offline for a long time) but have still cameras which put out a jpg image every few seconds. So I basically wired up the coco tensorflow example object detection to look at these still cameras. Then if animals are seen it sends me an image via telegram.
Here are some images I got (hope it’s ok putting these on my website):
I initially ran a version on my raspberry pi but then wondered if I could do it somewhere in the cloud for free. Hence using Github actions. It’s a really useful service to do continuos integration and various automated workflows in your projects on each code push. They even have a scheduled run where you can do an action on intervals. So this is what I’m using to run my the node script that does the image recognition. After it does this I have another script to send the image to the telegram bot.
I only run it every 10 minutes so I’m sure many sightings are missed. My thinking is I don’t want to abuse the free Github actions and don’t want too many images per day.
This is not very efficient as I cannot keep the model in memory and ready to go. So each time the action runs it installs node, then pulls the cached npm modules and then loads the model into memory before doing a detection. I’m sure there is a better way to do this, like an already built detection binary that runs efficiently. Let me know.
The SANParks website has a place for humans to submit sightings of animals. Which is quite good, so possibly a better way would be to watch this feed and send the human sightings of animals to me.
I think there are a couple things TODO in the future:
- Publish images to twitter perhaps for public consumption or make the telegram chat a group so people can join
- Do a custom model for detecting more animals
- Make more efficient
- Gain insights/statistics from the sightings
Let me know if you have any good ideas for this thing or use it in something you do.
See the code https://github.com/runningdeveloper/kruger-cam
There is a really cool project africam where there are high quality HD cameras with sound in places across Africa. They have a community of people that control the cameras and pickup amazing animal sightings. It is way better than the SANParks still cams!
I have nothing to do with SANParks or their website. Let me know if I’m doing anything wrong.