A DIY tech project to identify and scare off badgers and foxes is just as good as identifying. The next step is up to you!
(Image credit: Adam Juniper)
An industrious Ring owner has used AI to train the outdoor camera to identify badgers and foxes visiting his garden. Having set up the tech, James Milward used it to trigger a high-frequency deterrent for the animals – but photographers might have other uses for the code he shared.
Milward's project essentially uses code he assembled to monitor a Ring camera's feed, decide whether visitors are foxes and badges, and – if they are – turn on an ultrasonic fox and badger repellant he bought from Amazon. This is where, it occurs to us, a nature photography enthusiast might be more interested in connecting an alert in their home – or sending an alert to their phone, or even to a wireless shutter release.
To be fair, this is a bit of an enthusiast's project, as Milward himself explains on Medium. It was, however, an educational challenge he had been looking for as an excuse to learn the secrets of machine learning.
He realized that a camera, like one of the best Ring cameras (which boast infrared night vision), would provide the ideal feed for him. Moreover, although Ring doesn't offer an official API, its sheer popularity has brought solutions. Ring enthusiasts have not only assembled an unofficial one, but also a library that can stream video via the open RTSP standard (yes, the same one that most livestreaming uses).
Milward was keen to train the cameras to identify foxes and badgers, because each mammal needed a different frequency of sound to deter it. He reasoned that the camera could identify the culprit in his backyard so that the correct deterrent could be activated.
Using a Raspberry Pi 4 he could run a tool called TensorFlow Lite – but first he needed to download video clips from his Ring cameras, screen capture them, and put them into his Google Drive. From there they were fed into a labeling tool (LabelImg) in which he manually told the computer which were foxes or badgers. This was essential, as using off-the-shelf models left the computer spotting sinks, cars, umbrellas, or bears!
Get the Digital Camera World Newsletter
The best camera deals, reviews, product advice, and unmissable photography news, direct to your inbox!
At this point, a model is built using Google Colab, which Milward said cost him under $2 worth of 'Compute Units' (and 2.5 hours of remote processing from 240 images).
This was just the beginning of many refinements to the project, which included more time spent refining the model and the addition of features to ignore objects that weren't moving. Oh, and the name "Furbinator 3000"? That was ChatGPT's suggestion!
What we like, though, is the idea that a Ring camera is just a beginning; if it's possible to use AI training to adapt a camera and protect a lawn, it's equally possible to do it for your own purposes. There are certainly some foxes at the bottom of my garden, but they do look good on camera. Do I protect the lawn, or the hope of that perfect animal portrait?
With over 20 years of expertise as a tech journalist, Adam brings a wealth of knowledge across a vast number of product categories, including timelapse cameras, home security cameras, NVR cameras, photography books, webcams, 3D printers and 3D scanners, borescopes, radar detectors… and, above all, drones.
Adam is our resident expert on all aspects of camera drones and drone photography, from buying guides on the best choices for aerial photographers of all ability levels to the latest rules and regulations on piloting drones.