In 1800 there may have been 26 million elephants in Africa alone, although it’s hard to be precise. But today, after years of poaching and habitat destruction, those numbers are a tiny fraction of what they once were.
In Africa, the larger of the two species is a step further from extinction. Less than half a million roam the continent, mostly in the southern states. In the west and the forested centre, elephants are in a particularly perilous condition.
Before the detailed documentation, I have attached the making video of my project in below YouTube link, Kindly watch it.Reason behind the destruction of elephants
- Around 20, 000 African elephants were killed last year for their tusks, more than were born
- Due to human population bloom, elephants are killed for land occupancy. A herd of elephants can destroy the annual crop of many small farmers. Human lives are also in danger. In India, panicked or enraged elephants kill more than 400 people each year (pdf).
- Asian elephants are also poached for their ivory tusks, meat and body parts while baby elephants are captured from the wild and sold into the tourism industry. Worldwide, Asian elephants are trained, traded and used for entertainment in tourist parks and circuses, and also for illegal logging activities.
I developed a machine learning models for predicting the elephant behaviour using edge impulse software. These models will predict the poacher activity nearby the elephants, human conflict when elephant enters the village, musth behaviour of elephant to prevent humans from elephant and normal activity tracking like playing, sleeping, sexual and mother-offspring. In my trained models, I covered these below conditions.
The hardware part will be a collar for elephant, which will be deployed by Smart parks. I am concentrating on machine learning models alone in this project. I have added testing data, which can be used for evaluating my model.
I created two different TinyML models in edge impulse based on two different data input. I have used audio input, Triple axis accelerometer for training the models and deployed.
The collar has the following configuration:
So I decided these two data inputs(audio, 3-axis ) for training my models. So it can be deployed in the collar for future use.
Model architectureBased on data input, I split the machine learning models into three categories.
- Model 1 -> Datasets will be Audio input
- Model 2 -> Datasets will be Triple accelerometer axis
Model 1
The model 1 will cover all the use cases mentioned in model. Elephants vocalize in a wide range of situations. They call to advertise physiological or hormonal state, to warn others and to threaten, to demonstrate strong emotions, to announce needs or desires, to propose, negotiate or discuss a plan of action, to coordinate group movement, to secure group defense, to care for calves, to solicit care or support, to reinforce bonds between family and friends, to reconcile differences, and to assert dominance.
The model 1 can able to predict the elephant behavior in most of the cases with minimal error and greater accuracy. In my machine learning model, Model1 and 2 will plays a major to predict the elephant behaviours.
Model 2
Model 2 will also covers the same use cases mentioned in model 1. The elephant will behave differently based on situations like defend, alerting the troop, attacking, playing. So based on the accelerometers data, we can predict the behaviour.
Model 1 - Datasets will be AudioCreating a Project in Edge Impulse
Step1:
For creating a new account in edge impulse, you need to provide email id and password for new account. It is very straight forward and simple, as it won't ask DOB, Name, address etc.
After creating a edge impulse, it will directed to create project page.
For model 1, I have entered a unique name for project.
Step 2:
Once you created a account, you can see your project name on top of the page, on left side you notice the steps to be followed. as of now it is not highlighted, stating still the steps are not yet completed.
Connect a device and acquire data
Go to device option and click connect a new device
you have four options to get a data.
- development boards
- Use your mobile phone
- Porting guide
- Import pre build data sets
Here I am preferring mobile phone to collect a data.
It will display a unique QR code to connect your phone, scan this QR code to get a link and open the in Web browser like google chrome in your mobile, automatically it is connected for data acquisition.
Now the phone is connected to your project.
Step 3: Dataacquisition
Please make sure, the device connected as Phone and select microphone for audio data. And you can vary sample length from 1 sec to 60sec and give unique name Labeling.
Labeling plays a important role in machine learning to categorize the data sample, it helps to train the model based on number of labels available.
In Our Model 1 -> Datasets will be Audio input Project, The labeling will be categorized as below diagram. This is based on use cases and environment noises in the wildlife region.
In each datasets label, background noises will be add on. So we need to capture audio data along with background noises for better accuracy. Since in real time data, noises will be available for sure, so while training itself we need to add these data along with all existing labels.
4.1Poacher attacks
Poachers generally use Kalashnikovs or poisoned arrows, ” Pauwel De Wachter, the WWF coordinator for West Africa, said in a statement that appeared in Newsweek. “ These weapons hurt the animal, but do not kill them immediately. Once the elephant is on the ground, the poachers cut his tendons to immobilize it, condemning them to a painful death. So that the elephant empties more quickly of his blood, they cut his trunk.”
So from the above information, it is clear that poachers using Kalashnikovs and poisoned arrows as a weapon to hunt the elephants.
Data capturing for Poacher attacks
- Kalashnikovs without noise - 1 min
- Bush arrow impact without noise - 1 min
- Kalashnikovs with noise - 5 min
- Bush arrow impact with noise - 5 mins
- Common noises in Forest region - 4 mins
Capturing Kalashnikovs sounds effects
Recorded Audio of AK47 sounds from YouTube open source videos.
A one min samples are collected for Kalashnikovs
Rain forests sound can be uploaded as wav format as below.
Mixing Kalashnikovs with Forest background noise
Step 1 and step 2 will be same like the model 1 method. So please refer the steps mentioned in Model1 for step1&2.
Step 3: Data acquisition
Please make sure, the device connected as Phone and select accelerometer for 3-axis data. Give unique name Labeling.
Step 4: Labeling - Model 2
Labeling plays a important role in machine learning to categorize the data sample, it helps to train the model based on number of labels available.
In Our Model 2 -> Datasets will be Triple axis accelerometer Project, The labeling will be categorized as below diagram. This is based on use cases and environment noises in the wildlife region.
Labels of model 2
- Slow_walk
- Running
- Aggresive
- Sit Position
- Idle
4.1 Capturing triple axis accelerometer data
Capturing the elephant actions was the toughest task in the project. Very rare 3 axis data is available in opensource. So it is highly impossible to simulate the tripe axis data for various elephant actions.
Then I decided to simulate the similar kind of data with four legged animal. For my project I have chosen my pug dog. I have made the customized belt for my dog to hold the mobile phone.
I have placed the mobile phone on the dog and made the following label movements and captured more than 4 mins data. Here the glimpse of capturing video.
4.2 Create Impulse Section
In a create impulse section, Window size 3000ms and increasing window size is 500ms. For a learning block, Neural Network (keras) and k-means anomaly detection is selected.
The minimum confidence is chosen as 65% in NN classifier.
5. Testing the model
In live classification, connect the mobile and test the data.
Here the snapshots of some tested data.
The accuracy defines the quality of the Trained model . Here I achieved 87.2% in model 1 where the input data is Audio. In Model 2 ( Accelerometer data) I achieved 77% .
Model 1 Accuracy
Model 2 Accuracy
In model 2 , the accuracy loss is due to capturing the data through real dog. In future I planned to collect more data for training the model.
DeploymentThe deployment is the final process of the project. The trained model can be deployed in different formats as per the requirement. The list of deployment option is given below:
The process will be same for Model1. I have deployed the model as C++ library.
The two models are deployed in C++, Arduino format and GitHub repository link is added.
Activity Classification based on two modelsBased on the results of these two models, the activity can be classified in to three categories.
RedAlert :
Red alert indicates the immediate inspection needs to be taken from ranger's side. Whenever there is poacher activity, it can be identified by elephant movements. The elephants mostly in defensive mode or aggressiveness. It can be clearly shown in the elephant movements [ Running, Aggressive].
Apart from this, If poacher attacking is identified through model 1 (audio input). So If a •Kalashnikovs sound or bush arrow attack sound is detected, then elephant is in risk of poaching. The rangers needs to be deployed for the action.
In recent days, Poachers using poisonous Bush arrows to attack the elephants, When they attack the elephant with poisonous arrow, the elephant won't die instantly. Instead of that, the poachers will follow the wounded elephants. After several hours, the elephant will be grounded down.
The above situation can be notified as warning to the dashboard. Monitoring the bush arrow impact sound or the movements of elephants are idle for long hours, then it can be treated as warning to the ranger's.
Whenever there is no poacher activity detected in model 1 (audio input) and the elephant activity is normal like idle, walking, sit position and few running movements (playful mood). It can be marked as normal activity.
By these two edge impulse models, the elephant activity can be monitored and helps to safeguard the endangered species from risks.
Comments