Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 574 https://internationalpubls.com A Deep Learning-Based Model for the Detection and Tracking of Animals for Safety and Management of Financial Loss 1Nidhi Jain, 2Neema Gupta, *2Ambuj Kumar Agarwal, 3Megha Sharma, 4Soumi Datta 1Department of Commerce, Shyam Lal College (University of Delhi) 2University School of Business Chandigarh University Mohali, Punjab, India, *2Department of Computer Science and Engineering, Sharda School of Engineering and Technology, Sharda University, 3Greater Noida, IIMT, Greater Noida, 4Sister Nivedita University. India Article History: Received: 23-05-2024 Revised: 05-07-2024 Accepted: 22-07-2024 Abstract: Introduction: The paper presents a deep learning-based model for detecting and tracking animals to protect agricultural fields. It addresses the challenge of crop destruction by stray animals, a significant issue for farmers, by proposing an intelligent camera-based solution. This solution utilizes IoT for real-time information transfer and employs advanced image and video processing methods, including YoloV5, for efficient animal detection and classification. The study evaluates various existing solutions and highlights the advantages of the proposed model in terms of accuracy and cost-effectiveness, offering a promising approach to mitigate animal raids on crops. Keywords: YOLOv5, Detection, Learning, IoT, Animal 1. Introduction Agriculture is one of the major service sectors in India which contributes around 18% of the GDP. Farmers around the globe face many issues like weather conditions, water shortages and animal raids. The issue like weather conditions and water shortage are beyond the control of the farmer, but the major issue of animal raid can be controlled. In India every year more than twenty thousand cases of crop destruction by stray animals were reported which results in major loss of crop and the farmer. To prevent the animals raid farmers are using many traditional methods like preparing trench in the fields, using barbed wire for fencing etc. The traditional methods are not much efficient and may also results in security breach and animal injuries too. So, in this work an intelligent camera-based solution will be proposed to timely detect and prevent the entry of stray animals. The detecting of animal will also help in saving the farmers life as in case of any wild animal the farmer can take all the safety precautions. 1.1 IoT based Management and Solutions IoT network nowadays are widely used in most of the fields like medical, defense, security, and many more for the information transfer. The IoT devices are capable to sense the environment to collect the information from the state of environment, then the collected information will be sent to destination. IoT network will helps in the real time information transfer maintaining its reliability and integrity. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 575 https://internationalpubls.com Figure 1: Model based on Internet of Things for Animals Detection [1] The IoT network is composed of one or several small sensor devices. As shown in figure 1, the IoT network requires a 12-volt power source to run the network. The camera along with light is used to sense and gather information from the environment. The collected information is further stored over IoT cloud for data processing. The setup is programed using Raspberry or Arduino to perform the sequence of defined steps. The cloud acts as a storage medium to store all the sensed data. This data can be captured using an IoT setup or any pre-captured multimedia data can directly be feed-forward to intelligent data processing model. The model will be trained to detect and classify the detected animal in the frame and share the information with the farmer. This will help the farmers to prevent the crops from animal’s raid. 1.2 Image or Video Processing Based Methods for Animals Detection Image or video-based processing methods provide an easy and affordable solution to the farmers for the animal’s detection in the field. These methods do not require any storage space, as the data will be processed by the detection model in Realtime. The frames recorded by the camera will be processed by detection model. The detection model will be specially trained using an efficient learning method for the detection and classification of the animals. YoloV5 is one of the latest and efficient method for the object’s detection and classification. These networks are based on the theory of ‘You Only Look Once’ that is an intelligent method based on DNN for the object detection. Object detection methods will look to identify all the objects in an image of frame by making all objects using b- box as shown in figure 2. The network starts with detection and the prediction model will start marking the percentage of detected object with predicted object. The network training is the most important parameter as the accuracy of objects classification and detection completely depends on the training accuracy. Figure 2: CNN based Animals Detection Images Further in video processing methods a stable high-speed internet is required to reduce the time lag between frame capturing and processing. The video processing hardware also require special graphical Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 576 https://internationalpubls.com processing units with specialized hardware. The cost of set up and maintaince is one of the major considerable for farmer as initial cost and maintaince cost for the setup is higher. 2. Motivation Agriculture is the backbone of the Indian economy as half of the population is dependent on agriculture for their daily needs. In India variety of crops were grown that vary from state to state according to the climate. Every year many hectors of crop areas were destroyed by the entry of stray animals in the fields. Many researchers are working on this problem to prevent the crops from animal’s raids. Also, every year more than 1500 cases of wild animals attack on farmer were reported. So, it is very important to correctly detect and recognize the animal to alert the farmer in advance. This helps in saving the farmers life and crop. Many existing solutions based on artificial intelligence vision and IoT requires a complex setup and needs an expensive hardware. The processing of heavy video data needs to process quickly using deep learning networks. So, in this work a learning model will be proposed to reduce the complexity and can classify the detected objects with higher accuracy. 3. Literature Review In this study, a variety of recent studies were analyzed. The table below will discuss the various existing studies with their outcomes: Author Proposed System Results [1] The goal of this paper is to prevent the crop destruction from the animal’s raid using machine learning and internet of things. The CNN-based learning algorithm was employed to identify the animal that was in the video input. Author was able achieve an accuracy of more than 80%. The system does not provide an accuracy higher than the previous level when low light is present. The major drawback of this study was failure of system in low light of night. [2] In this study several cost saving and friendly ways for the crop protection were suggested for saving the crops from the raid of wild animals. In this work author suggested to use the environmentally sustainable practices rather than relying on new technology. It can also be helpful in reducing the chance of wild animals invading your property. Shelter guards from entering in the field. can also be used to prevent animals. These methods are environmental friendly and saves the cost too. [4] IoT-based crop protection monitoring against wild animals The author used a repelling method that did not use any camera- based detection. Alarms are generated by buzzer-based systems. The method can be prone to false alarms. This method does not provide any information to the farmer regarding the detected object, which can be very dangerous from farmers life in case of any wild animal. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 577 https://internationalpubls.com [5] Author has suggested a smart method that could be used to detect both flying and domestic animals. The proposed model did not use video but rather relied on sound sensor-based devices to detect flying insects and domestic animals. The accuracy of the detection is one of the major concern due to low range of the devices. Also to setup these devices everywhere in the field is not a feasible an idea. This method fails in case object enters in the field beyond the range of the sensors. [6] Author proposes a smart intrusion detection method for animals that utilizes the IOT architecture. This solution is applicable in controlled forest fields in which all animals are free to move with unique RIFD tagged placed under their skins. These tags were created using RIFD device, which sends signals to alarm. As soon as any animal enters the restricted are an alarm will be generated by detecting RIFD tag. This solution is not applicable to common fields. [7] IoT-based farm protection and power generation solutions The network deployment using multiple sensor devices were used by the author for the detection of excessive rainfall which could damage crops. Camera can be used to detect all the activities and send the message directly to farmer through an IoT network. In case of extra water in the fields the farmers need to build up the channels to remove excessive water. The excessive water can also be helpful in generating small amount of electricity required to run all the sensor devices. But the accuracy of detection does not attract much attention due to traditional used detection model. [8] The author suggests an intelligent method that integrate WSNs and Machine Learning for object detection. The system was trained to sense the environment and based on sensed data through WSNs the decisions will be taken. Sensitivity to temperature and soil is monitored by sensor devices. The information can be shared over ML server and then analyzed. This method can further be extended for object detection for a complete field’s solution. [3], [9] Author had developed a system using Arduino for detecting stray animals in field. This system aims to detect different kinds of activity like fire, entry of human, animal in the field. The large ultra-sonic sensors were used to detect the all such activities. All the data sensed by the model will be delivered to farmer with least time lag. Also, all important notifications were sent out. The detection accuracy was greater than 88%. 4. Research Gaps 1. Environmental factors: The environmental factors are very important for the accurate detection of the objects in any frame. Most of the used cameras does not support the night vision also the night vision cameras are quite costly in the market. The deployed cameras were also not able to detect the Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 578 https://internationalpubls.com objects clearly in the foggy and rainy season. To reduce all these problems special cameras may be deployed with motion sensors and high-quality vision. 2. Predictions and Datasets: Most of the existing models for stray animal’s detections were not using any prediction algorithm for the accurate object detection. The prediction algorithm is very important for the better accuracy of the system. As in certain condition when the captured frames are blur the trained system will not be able to detect and classify the object accurately. Also, the existing datasets are not standardized, due to the variation of stray animals from region to region [11, 12]. 3. System Computing Hardware/Software: It is extremely expensive to install 24x7-hour monitoring systems for crop safety. IoT devices are quite expensive to maintain, and the equipment required, including the CPUs and GPUs, can be quite costly. The system needs a fast stable internet connection, but still many villages still had no internet connectivity. The internet is required to upload the captured frames over cloud, this data requirement can be reduced by directly using the wireless enabled cameras. 4. Data transformation into information: The transformation of the captured data in form of frames will be transformed into information by the learning model. The regular processing of the similar detected frames may result in adding the delay in data processing. Most of the time the frames will remain static as only in case of any object detection the processing is required. To reduce the data processing burden, the similar frames can be eliminated. 5. Information sharing channel or medium: Sharing the information with farmers in time is the most vital part of the system. As in case of delay the information may be not useful for the farmers as the damage was already done. The information sharing medium channel needs a reserved bandwidth for real time information sharing. 5. Proposed Methodology The main goal of developing this model is to detect and acknowledge the entry of wild animals in the fields. Most of the existing studies had used the framework integrating IoT and Computer vision. These devices are costly to install and require regular maintenance. This low-cost method of tracking and detection was developed to lower the overall costs. The common steps involved in developing the system are as shown below in Figure 3. Figure 3: Steps Involved in Processing a Video for Classification Input •Realtime captured video Pre- Processing •Video Enhancement and Resize Feature •CNN Extraction Dataset Detection Classificatio n & Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 579 https://internationalpubls.com a) Camera setup Stage for Video Capturing: The cameras were deployed all around the field to capture the video in live mode. The captured video can be stored in the cloud or any storage medium. The video will be captured in high-definition mode for better clarity and the cloud can store up to 12-24 hours of recording. Today motion detection cameras are widely used for the better detection of any kind of moment in the field. b) Captured Video feed forwarded as Input: The model will receive the video data directly from cloud storage. The data will be processed in real-time by the model. In case of any detected object, a further classification algorithm works and shares the information with the farmer. c) Video Pre-processing and Filtration: The captured video will be divided into frames. The captured frames are subjected to many types of noises and distortion. The induced noise in the frames may result in image blur of pixels degrade. Therefore, the images are pre-processed or cleaned before processing by the learning model. The identical frames are also detected by the system, in case two consecutive frames are similar the last received frame will not be processed. This will reduce the data burden and also help in faster object detection. d) Frame-based feature mapping: Relevant features were derived from the keyframe. The non-key frame will be considered as the duplicate frame whose features are almost identical to the key frame. The non-key frames need to be discarded as the processing of similar frames will only result in a waste of computing power. The features are extracted from each frame to identify the identical frames. The features that are extracted are fed into learning architecture. The goal of the network is to create a feature map from the extracted feature which id used for the classification. Figure 4: System Model for Frame Detection and Feature Extraction [13] e) Learning Model: In this work a transferred learning model will be used for network training. The transfer learning models are the pre-trained models based on deep neural network architecture. These models are trained on million of images or bigger datasets to perform the similar type of batch jobs. These models are less complex rather than training a CNN model directly from scratch. The existing models like Alex-Net, Google-Net, Res- Net and VGG-Net are some pre-trained models that can be used for the network training. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 580 https://internationalpubls.com Figure 5: Convolution Neural Network Structure with Layers 6. Results And Conclusion The results showed the effectiveness of the proposed deep learning-based model for animal detection and tracking in agricultural fields. The model achieved an impressive mean average precision (MAP) of 99.43% in identifying and classifying various animals using a combination of Kaggle and real-time datasets. This high level of accuracy indicates the model's robustness and reliability in real-world scenarios, significantly outperforming baseline models in similar tasks. The success of the model is attributed to its advanced algorithmic approach, combining YOLOV5 with Google Lens for superior image and video processing capabilities. This performance showcases the potential of the proposed solution in effectively mitigating the problem of crop destruction by stray animals through accurate and timely detection. Model Dataset Network MAP [5] Animal 50 CNN-A 92.7% [6] Others YOLOV3 79% [7] ImageNet YOLOV5 94.5% [8] ImageNet IWPOD-NET (YOLO Based) 98.43% Proposed ImageNet + any real time YOLOV5 + Google Lens 99.43% References [1] K. Balakrishna, F. Mohammed, C. R. Ullas, C. M. Hema, and S. K. Sonakshi, “Application of IOT and machine learning in crop protection against animal intrusion,” Global Transitions Proceedings, vol. 2, no. 2, pp. 169–174, Nov. 2021, doi: 10.1016/j.gltp.2021.08.061. [2] Rwetsiba and T. Rusoke, “CROP PROTECTION INTERVENTIONS AND WILDLIFE DAMAGE MANAGEMENT AROUND KIBALE NATIONAL PARK, UGANDA,” International Journal of Agriculture, Environment and Bioresearch, vol. 06, no. 04, pp. 88–128, 2021, doi: 10.35410/ijaeb.2021.5653. [3] K. Mahajan, R. Parate, E. Zade, S. Khante, and S. Bagal, “REVIEW PAPER ON SMART CROP PROTECTION SYSTEM,” International Research Journal of Engineering and Technology, 2021, [Online]. Available: www.irjet.net [4] S. Giordano, I. Seitanidis, M. Ojo, D. Adami, and F. Vignoli, “IoT Solutions for Crop Protection against Wild Animal Attacks,” IEEE Access, 2018. http://www.irjet.net/ Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 31 No. 8s (2024) 581 https://internationalpubls.com [5] Vayssade, JA., Arquet, R., Troupe, W. et al. CherryChèvre: A fine-grained dataset for goat detection in natural environments. Sci Data 10, 689 (2023). https://doi.org/10.1038/s41597-023-02555-8. [6] S. Santhiya, Y. Dhamodharan, N. E. Kavi Priya, C. S. Santhosh, and M. Surekha, “A SMART FARMLAND USING RASPBERRY PI CROP PREVENTION AND ANIMAL INTRUSION DETECTION SYSTEM,” International Research Journal of Engineering and Technology, vol. 5, no. 3, 2018, [Online]. Available: www.irjet.net [7] C. A. Kumar, S. R. H, and S. M. S Asst, “IOT in Agricultural Crop Protection and Power Generation; IOT in Agricultural Crop Protection and Power Generation,” International Journal of Engineering Research & Technology (IJERT), vol. 9, no. 5, 2020, [Online]. Available: www.ijert.org [8] S. L. Shylaja, S. Fairooz, J. Venkatesh, D. Sunitha, R. P. Rao, and M. R. Prabhu, “IoT based crop monitoring scheme using smart device with machine learning methodology,” in Journal of Physics: Conference Series, Sep. 2021, vol. 2027, no. 1. doi: 10.1088/1742-6596/2027/1/012019. [9] S. Deepa and A. Professor, “Implementation of Crop Protection System against Wild Animals Attack,” Annals of R.S.C.B, vol. 25, no. 5, pp. 3638–3646, 2021, [Online]. Available: http://annalsofrscb.ro [10] R. Agale, “2017 International Conference on Computing, Communication, Control and Automation (ICCUBEA),” 2017. [11] R. Anusha, T. Nirmala, and N. T. Chitra, “SYSTEM FOR SMART PROTECTION OF CROP USING IOT,” International Journal of Grid and Distributed Computing, vol. 13, no. 2, pp. 1707–1715, 2020. [12] L. S. and H. B., “Design and Implementation of IOT based Smart Security and Monitoring for Connected Smart Farming,” International Journal of Computer Applications, vol. 179, no. 11, pp. 1–4, Jan. 2018, doi: 10.5120/ijca2018914779. [13] H. Zhu, H. Wei, B. Li, X. Yuan, and N. Kehtarnavaz, “A review of video object detection: Datasets, metrics and methods,” Appl. Sci., vol. 10, no. 21, pp. 1–24, 2020, doi: 10.3390 http://www.irjet.net/ http://www.ijert.org/ http://annalsofrscb.ro/