discussion / Human-Wildlife Conflict  / 27 October 2016

Automated Elephant-detection system

Hi everyone,

I thought I would introduce my automated elephant-detection system, that I have been working on over the summer for the hackaday prize. It was a finalist in the prize (top 100 entries/one of 20 winners for the develop a concept round),  but I didn't complete it in time to have a chance of winning the $200,000 usd first prize!

Main page for project on hackaday site: https://hackaday.io/project/10391-automated-elephant-detection-system

The aim of the system is to acquire images when PIR is triggered (like a camera-trap) and use machine-vision algorithms to determine if these images contain elephants. If they do, the system will report via GPRS/3G/4G [or RF is an alternative, with repeater stations; but quite expensive) to a base station. The report will detail which device, and thus which location, has detected elephants. Local people can then be informed via their mobile phones or via in-village signs. Local people can then come to deter elephants from their crop-raiding missions; or just be made aware that elephants are moving on their usual paths, so that neither elephants or humans are startled!

The hardware consists of a raspberry pi 3 for machine-vision computing, with attached raspberry pi camera to photograph animals when PIR triggered, and GPRS/3G/4G dongle (or RF in alternate scenario) to communicate if elephants have been detected by the device. All the components are listed on the hackaday page, including power supply.

After exploring other machine vision algorithms, I settled on using the  Haar feature-based cascade classifier to determine if elephants were present in acquired images. This is in the OpenCV library for Python (and C++). I did get this to work for detecting leaves, and cat faces, and elephants to a certain extent. However, the reliability of detecting elephants has been hampered by the lack of sufficent positive training images (i.e. images containing elephants) that I managed to acquire in order to train the Haar feature-based cascade classifier. I only had ~300 to work with, whilst it's generally thought that several thousand would be more appropriate.

Another problem, hardware-based, was the requirment to obtain images of elephants both in the nightime (when they tend to launch crop-raiding missions), and in the daytime. This required the usage of an IR-filtered camera and a No-IR camera. Since raspberry pi only has one camera input, this required a multiplexing system to be added. I've since managed to solve this problem after finding a commercially available multiplexing system. Although I'd prefer to make my own open-source multiplexing system. 

At present, I'm developing a proof-of-concept system, using the same hardware and software, to detect and identify common garden wildlife (foxes, cats, birds, mice, rats, frogs). This should allow for me to be more easily able to acquire (than with elephants, since I don't live near elephants!) the several thousand of positive images I need for each animal. This is in order to verify that the Haar feature-based classifier is indeed reliable when presented with a greater number of positive training images. An alternative, that I haven't mentioned on hackaday, is to switch to Linear Support Vector Machines trained on HOG (Histogram of Oriented Gradient) features. However, I feel using Linear SVMs trained on HOG is more computationally expensive (e.g. power drain on batteries, and I don't even know if rapsberry pi can do it!).

Anyway, once I've completed this proof-of-concept system, I'll be returning to the elephant-detection system, and attempting to acquire 1000s of elephant images using the same raspberry pi camera as my system uses. These will need to be taken in both the nighttime and daytime of course! With a different trained classifier for each lighting condition.

The future directions for the system are to incorporate elephant-dettering devices into the system. These would play pseudo-randomly chosen audio clips of bees or tigers, to scare elephants from embarking on their crop-raiding missions. In addition, I'd like to extend the machine-vision software to include both vision, and audio-based detection, and determine metrics such as elephant age, herd motion (what does herd motion look like prior to a crop-raid for instance?), direction estimation, etc. [See 'Establishing the fundamentals for an elephant early warning and monitoring system', https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4558827/ )

If anyone would like to help in the future, and is doing field research with exposure to elephants, then I'd be happy to supply a raspberry pi-based camera trap. Thus I could easily acquire the large number of positive training images I require!

I'd just finish by noting that I did consider and worry that this system may be helpful to elephant poachers :-(



Hi Neil,

Automated recognition of almost any kind of animal will be useful to researchers. If you need hundreds of infrared images of elephants then contact researchrs who are using camera traps for wildlife distribution and population surveys. Snap the Serengeti springs to mind.

Good luck, Peter


Thanks for sharing. It definitely sounds like a promising project, and this is the future of surveillance. 

I have a friend at Google who is a program manager on their new Tensor Flow open source project. You should take a look at it, as it could be a better alternative for the AI network you need. Here is a page I just found on using it for image recognition.

Also I'm sure you can find someone with one or more camera traps in elephant territory to help you out with your training. I concur with Peter that Snapshot Serengeti would be a great place to start.

Keep us updated. Thanks,



Hi Neil,

I would love to test your system. Like you, we have been working for over a year now on sensors that can be used in the field to detect threats. Would be great if we could share experiences and collaborate to get your sensor up in the field. 

How shall we start?

ps in 2 weeks we'll travel to Nepal. I know they also do have an elephant problem. Maybe we can demonstrate or deploy your sensor there?


Jan Kees

Hi Neil,

Thank you so much for sharing information about your system. We have a number of WWF elephant landscapes where we would be happy to test your prototype. We are testing a similar camera-trap-based early detection tool in Thailand, but your tool is more advanced. As you mentioned, such a tool will have many other uses in addition to serving as an early detection tool, so it sounds very promising. So we would be happy to trial it once the prototype is ready. Please let us know.