Authors: Aniket Gat, Hrishikesh Gaikwad, Rahul Giri, Dr. Mohini P Sardey, Milind P Gajare
Certificate: View Certificate
Today, even without the help of technology, monitoring wildlife has become a challenging job. To address this problem, we have developed a solution for animal classification cameras that can detect and store data of these animals in SD card. The system can also be used to protect wildlife in zoos. The system is also able to identify new species. When a new species is discovered, it stores its data in a separate database for further study. It is also possible to control the system remotely if there is internet in the area. The system uses Python-based code that includes pretrained classification models. We have used the pi camera to feed live footage to the Raspberry Pi. It then uses the OpenCV module to segment the image into frames and compares the obtained frames with the pretrained module and gives labels accordingly. The system and stored data can also be accessed through the mobile application Rasp Controller and through computer using the software named VNC viewer. The system is also able to move from one place to another and also as it is a part of whole system it is also remotely monitored.
Wildlife monitoring is very important these days as many animal species are threatened with extinction, some of which have already disappeared. Therefore, it is necessary to keep records of wild animals. But keeping these records becomes a daunting task without the help of technology. Traditional methods, such as setting up camera traps in the forest, manually clicking on photos, and then classifying and tagging animals by looking at the images, require too much time and effort. Also, it is impossible for a person to take pictures in the forest around the clock.
With modern techniques such as machine learning, we can classify animals based on images and videos taken by them. Information can also be stored in the system.
Therefore, we developed an animal classification system in the project. Our devices are able to identify animals by capturing real-time images of the animals and storing the data in a database.
We have used Python Idle of Raspbian OS, Raspbian OS Buster, OpenCV module, pretrained detection model and Raspberry Pi, camera as hardware. The objectives of this work are aiming to classify animals using their images/ live video and store the
respective data to help forest monitoring process
The objectives of this work are:
The system consists of five main parts:
a. Connect the SD card to the Raspberry Pi.
b. Connect the camera module to the Raspberry Pi.
c. Take videos/pictures of animals and categorize them accordingly.
d. View the output on a computer or smartphone and save the information.
e. Remotely access the system and obtain information (depending on the network).
This type of system is useful for monitoring wildlife and also contribute to wildlife conservation in zoos. It is also useful to maintain safety of animals in zoos as well as domestic animals also, there are so many threats for the domestic animals such as attack by other wild animals, person trying to steal them etc.
This paper is organized as follows: The section 2 discusses the literature survey. In section 3, Machine learning is discussed followed by OPEN CV in section 4. Raspberry Pi module description is provided in section 5. The proposed system is discussed in section 6 followed by methodology in section 7. Results are discussed in section 8. The paper is concluded in section 9.
II. LITERATURE SURVEY
Slavomir Matuska et al., proposed a device referred to as ASFAR (automated system For Animal recognition) is primarily based on disbursed so-called `looking tool' in targeted location and important computing unit (MCU) performing as server and system manager. Looking devices are located in wild nature and their challenge is to discover animal and then ship facts to MCU to assessment. The primary venture of whole machine is to decide migration corridors of untamed animals in specified area. To create object representation, visible descriptors were chosen and assist Vector gadget (SVM) turned into used to categories descriptors.
Priya Sharma et al.,  proposed the system which can protect the crop from animals those who can harm the crop. The proposed system uses raspberry-pi and PIR sensor. The PIR sensor detects the motion of the animal and then camera starts to capture the images. These images are sent to raspberry-pi for the classification of the animal. According to the detected animal the appropriate action is taken.
Morrow-Tesch J et. al.  has developed a video data base system to kick off a system that uses a multi-object tracking and reasoning system to extract animal motion information from an input animal activity video clip. The material will eventually be examined and summarised using standard animal behaviour definitions.
DP Gibson et. al.  proposed a system, from a minimal set of monitored data, a system that recognises gait and quadruped structure Because the motion information in this work is generated from dynamic wildlife film footage, it is incredibly complex and loud. Gait analysis is performed on footage containing quadrupeds that typically walk in silhouette towards the camera, but this part of the system is poseagnostic and often useful for gait detection. The main motion is considered to be produced by the background and its relationship to the camera motion, so it can be removed as a first step. Together with the frequency analysis, eigenmodes are used as templates to synchronize point clusters and establish the underlying spatiotemporal structure. Given this synchronized structure, further tracking observations were used to deform the structure to better match the overall motion. They show that using the eigengait model enables spatiotemporal localization of walking animals, helping to overcome difficulties caused by occlusions, tracking errors, and noisy measurements
T Burghardt and J Calic  focused on algorithm detection system which uses Haar-like features and AdaBoost classifiers to mimic a human face detection method. Face tracking is accomplished with the Kanade-Lucas-Tomasi tracker and a special interest model applied to the detected face.
Matthias Zeppelzauer  proposed a system which is vigorous to impediments (e.g., by vegetation) and accurately handles camera movement and different lighting conditions. There system show that both allover far-off elephants can be distinguished and followed dependably. The proposed technique empowers scientists productive and direct admittance to their video assortments which works with additional social and environmental examinations. The strategy doesn't make hard limitations on the types of elephants themselves and is in this way effectively versatile to other creature species.
Prajna. P et. al.  have worked to design a system that will monitor the field. That is, it will first use a sensor to detect trespass surrounding the field, then use a camera to capture the intruder's image and categorise them using image processing, and finally take appropriate action based on the type of invader and at the last it will send notification to the farm owner.
Rasool and Moorthy  proposed a system which highlights the issue of safety and security of animals in the zoological parks. The proposed system uses Raspberry-pi, pi-camera and OpenCV platform to classify the data. The camera takes the footage from the cage or from a required area and forward it to the raspberry-pi and the data is classified using OpenCV. Deep Zhou,  has proposed a system for real time animal detection with criteria such as detection accuracy, detection time, and system energy consumption. They have used the LBP adopting AdaBoost algorithm in the first stage. Using Two HOGSVM based classifiers, the second stage rejects the false positive ROIs.
Sk. Almas Tabassum et. al.  proposed the system which prevent the crops from animals. Sometimes animals like cow, buffalo, elephants etc. enters in crop yield and by running here there or eating the crop keeps vandalizing it. So, this system detects the animals and send the photo of detected animal to the farmer also it continuously keeps on making the buzzer sound until the animal is in front of camera.
In summary, many researchers have proposed their work for animal monitoring and detection. Most of the work carried out in literature focuses on controlling in a specific geographical area within a certain range. Our proposed system can be controlled remotely from any place of the world using pitunnel that allows raspberry-pi to be controlled from any host or network. Some of the machine learning algorithms used cannot work properly on raspberry-pi as they require high computing power but they are accurate, they might take time to classify but the time varies from model to model. There are other models that require very less time but are not accurate. So, to meet these both requirements i.e., computing power and the time required we are using ssd-Mobilenet v3.
III. MACHINE LEARNING
Machine learning algorithms study the historical data to predict the new output. Machine learning algorithm uses such historic data which can be termed as training data to build a model which is going to be really helpful in predictions and to take decisions accordingly. There are three most important machine learning methods: supervised learning, unsupervised learning, and reinforcement learning. Supervised learning: Supervised learning is a method of machine learning in which already labelled data is provided as input. Based on these inputs the model predicts the output when an unlabeled data is given. From the total available data 20% data is used for testing purpose and 80% data is used for training the model. Unsupervised learning: In this method of machine learning, no trained data or labelled data is provided as an input. Instead of labelled data unlabeled data is directly given to the model. In this method the machine combines the unsorted information according to the similar patterns and any other similarities. Here no trainer is provided like as in supervised learning. Reinforcement learning: Reinforcement learning has a learning agent. This type of machine learning need feedback as input received from the learning agent. As the name suggests the learning agent gets trained on its own and it learns from the environment. Some points are credited to this learning agent if the decision taken is correct. More the points more is the accurate the model will be.
OpenCV (Open-Source Computer Vision Library) is an open-source library for machine learning and computer vision. OpenCV has more than 2500 algorithms which also includes machine learning and computer vision algorithms. These algorithms are able to detect the objects and also detect and identify human faces, detects motion of a moving object and many other operations related to computer vision and machine learning. That’s why OpenCV library plays an important role in our system.
OpenCV library supports languages like Python, Java and C++ and MATLAB interface. OpenCV can also be used on operating systems like Linux, MAC OS, Windows and Android. OpenCV library is written natively in C++. OpenCV library can run on any device that can execute C program. As it is written in C++ the execution of OpenCV is quite fast also it uses low RAM. OpenCV library has more than 400 image-processing functions which are most useful for computer vision and machine learning applications. OpenCV works on BGR (Blue Green Red) color format.
The Raspberry Pi is a cheap, small-sized computer but have low performance compared to laptops and desktops. Raspbian OS is the official OS which is installed in this small computer. This small sized computer is able to perform all the operations that a computer performs in a day-to-day life. Also, this computer can be used for machine learning, computer vision, real time applications and many more. As it is compact in size it is possible to reduce the hardware in the robotics applications.
Raspberry Pi comes with ram size ranging from 512mb up to 8 GB depending upon the model of Raspberry pi. Raspberry pi has a clock frequency/CPU speed which can ranges from 700MHz up to 1.2GHz again depending on the model of Raspberry pi. The figure 1 shows the Raspberry Pi module.
VI. PROPOSED SYSTEM
The figure 2 shows the block diagram of proposed system. After setting up the raspberry-pi for wireless or wired manner, and after coding for the required operations to be executed the raspberry-pi and the whole system is all set to execute the operations. The system is initialized after booting up of raspberry-pi. Locate the code and run the program.
At very first step pi-camera will initialized and will start to stream the real time video. If there is nothing in front of the camera no data will be stored and no images will be captured. Once the identical animal is in the frame of pi-camera the video will be processed using OpenCV library and after processing the video the obtained output will be compared with the pretrained model’s dataset and it will label the animal accordingly. The information i.e., the name of animal and the time and date of appearance will be stored in the form of text in a new text file. Also, the images of animals will be captured and the images will be stored in a separate folder. Along with the above process the information i.e., the name of animal and the real time video will be displayed on the screen at the same time.
If the animal appeared in the camera frame is not identical i.e., it is not detected then using some program for motion detection its information will also be stored in the separate folder named as ‘New Animals’. Motion detection program is used because if animal is not detected by detecting any kind of motion, the system will capture images. Images will be captured only if the animal is not detected and there is certain movement in the camera frame. These images can be studied later to get the more information about the unidentified animals. This can be useful for the wildlife researchers if any new species or animal is found. This system can be controlled remotely using the pitunnel (www.pitunnel.com). Pitunnel allows to control raspberry-pi remotely, hence it is not necessary to have a common network connectivity between PC and raspberry-pi. The proposed system also consists of a moving robot which allows whole system to travel. As it is a part of whole system it is also controlled remotely.
A. Step 1: Set up Raspberry-pi
Set up the raspberry-pi using Raspberry pi imager software which is available on www.raspberrypi.com To set up Raspberry-pi a SD-card of 16 GB or more than that storage capacity should be used for better performance. There are number of Raspberry-pi OS are available install the required OS. The ‘Raspbian OS
Buster’ is used in our system.
Insert the micro-SD card in the pc (Format the SD card before using it for set up). Open Raspberry-pi imager and select the OS. Select storage type as your inserted SD card. Click on the gear icon and make necessary settings there (if you are not using any external monitor for set up). Click on the write button and OS will be installed on the SD card. Insert the SD card in Raspberry pi and power on.
(Note: Need not to follow Step 2 if external monitor is connected to Raspberry-pi)
B. Step 2: Set up Raspberry-pi (headless set up using VNC viewer)
If an external monitor is not available, it is possible to control the Raspberry-pi wirelessly. After selecting the storage type click on the gear icon and give the information about Wi-Fi available in the room, select the Wi-Fi country so that when the pi will boot up it will connect automatically to that Wi-Fi. This is necessary to make a connection with raspberry-pi using our PC. The default host name of Raspberry-pi is raspberrypi. local, it is possible to change the host name while setting up. Open the command shell as admin in the PC and type command ‘ssh -p 22 email@example.com’, then it will ask to join type ‘Yes’ and it will ask for the password the default password is ‘raspberrypi’, password can also be changed at set up. After hitting enter PC will log in the raspberrypi command shell. Type ‘raspi-config’ and select ‘Interface options’ and enable the VNC option there. Reboot raspberry-pi, open VNC viewer software installed in pc, click new connection and enter hostname it will again ask for password type the password and the screen of raspberry-pi will be visible in the VNC.
C. Step 3: Install OpenCV, pandas, NumPy, ssd-Mobilenet v3
Install the most important library OpenCV for the detection. Install other required libraries like pandas, NumPy. Most of the times they are pre-installed, if they are not install using the command shell. Download the pretrained model ssd-Mobilenet v3 which has data of no of objects and few animals.
D. Step 4: Coding
Prepare a code for animal detection in such a way that it will process the image/video sent by camera. After processing the processed image should compared with the pretrained model and if animal is detected the data should be stored accordingly and if not, then its data should be stored separately.
VIII. RESULTS AND DISCUSSION
The input given to the system is in the form of image/video obtained using pi-camera. After processing the video, the video is further compared with the model and the name of animal is given as output. The data of the detected animals is also stored in text format in a new text file. The text file contains information like time and date of the animal detected and also the name of that animal. This kind of information is useful for further study and monitoring of the forest area. One of the most important features of the system is that it can be remotely monitored.
As the system uses ssd-Mobilenet v3 the system is sometimes not accurate as expected but the system performs faster in the detection process. The main reason to use ssd-Mobilenet v3 is that its lightweight and the computational power of raspberry-pi is also low compared to the normal computer. Hence ssd-Mobilenet performs better on raspberry-pi than other detection models. ssd-Mobilenet v3 takes less time for the detection purpose. As shown in the figure 3, it is displaying real time image of the animal appeared in the camera frame and also the name of animal is displayed along with box. The box indicates that the animal is detected. The same image is captured and stored in the folder of SD card.
Also, name of animal i.e., ‘Elephant’ here is stored in the text file along with the timestamp.
It is observed from the above experimentations, the system is capable of detecting animal and storing its data. Even if the animal is not detected system can store its images for the further studies and research. The system can be controlled remotely using PC and also smartphone. The proposed system is prepared in a such a way that it will be very helpful for the wildlife researchers and the forest officers. They will be able to keep records of the animals in the forest without any extra efforts. The traditional way of doing this kind of jobs is a bit harder. The above discussed system will reduce their efforts. Along with the researchers and the forest officers the system can also help farmers, those who allow their domestic animals to live in an open space having a large area and compound. The system will monitor each and every action of animals in the area so that any outsider will not harm them or any animal will not escape from that open space. After doing some modifications in the system it can be used as an alert device for the farmers. The system will alert the farmers if any animal enters their farm. As most of the times animals cause harm to the crop in the farms the system can alert the farmers. In future the system can also used for identification of new species, new animals in more precise way so that it will be more accurate.
 S. Matuska, R. Hudec, M. Benco, P. Kamencay and M. Zachariasova, \"A novel system for automatic detection and classification of animal,\" 2014 ELEKTRO, 2014, pp. 76-80, doi: 10.1109/ELEKTRO.2014.6847875.  Priya Sharma, Sirisha C K, Soumya Gururaj, and Padmavathi C, “Neural Network Based Image Classification for Animal Intrusion Detection System”, IJPRSE, vol. 1, no. 4, pp. 1–7, Jul. 2020.  Morrow-Tesch J, Dailey JW, Jiang H. A video data base system for studying animal behavior. J Anim Sci. 1998 Oct;76(10):2605-8. doi: 10.2527/1998.76102605x. PMID: 9814900.  D. P. Gibson, N. W. Campbell and B. T. Thomas, \"Quadruped gait analysis using sparse motion information,\" Proceedings 2003 International Conference on Image Processing (Cat. No.03CH37429), 2003, pp. III-333, doi: 10.1109/ICIP.2003.1247249.  Burghardt, T. & Calic, Janko. (2006). “Analysing animal behaviour in wildlife videos using face detection and tracking”, Vision, Image and Signal Processing, IEE Proceedings -. 153. 305 - 312. 10.1049/ip-vis:20050052.  Zeppelzauer, M., “Automated detection of elephants in wildlife video”, J Image Video Proc 2013, 46 (2013). https://doi.org/10.1186/1687-5281-2013-46  Prajna. P, Soujanya B.S, Mrs. Divya, “IoT-based Wild Animal Intrusion Detection System”, International Journal Of Engineering Research & Technology (IJERT) ICRTT – 2018 (Volume 06 – Issue 15).  Sk. Nayab Rasool and T. SR.CH.Murthy, “Wildlife Monitoring in Zoological Parks Using RASPBERRYPI and Machine Learning”, International Journal of Recent Technology and Engineering (IJRTE), ISSN: 2277-3878, Volume-8, Issue-2S11, September 2019  Depu Zhou, “Real-time Animal Detection System for Intelligent Vehicles”, Depu Zhou, Ottawa, Canada, 2014  Sk. Almas Tabassum, B. Sri Vaishnavi, Dr. K. S. Sagar Reddy, “SMART CROP PROTECTION WITH IMAGE CAPTURE OVER IOT”, International Journal of Research in Engineering, IT and Social Science, ISSN 2250-0588, Impact Factor: 6.565, Volume 09, Special Issue 2, May 2019.
Copyright © 2022 Aniket Gat, Hrishikesh Gaikwad, Rahul Giri, Dr. Mohini P Sardey, Milind P Gajare. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.