## 1 Introduction  
The rapid expansion of industries into forested areas has had a profound and long-lasting impact on the dynamics between animals and surrounding communities [1; 2]. Animals are being increasingly pushed closer to human settlements, leading to potential conflicts and posing significant challenges for farmers [3]. These conflicts result in crop destruction, encroachment on farmland and a loss of productivity. Necessitating increased financial resources for recovery after such damages occur [4]. Traditionally, farmers have relied on electric fences to prevent animals from entering their fields, aiming to mitigate the effects of these challenges [5]. However, it is crucial to recognize that while the primary objective is safeguarding crops and maintaining productivity, ensuring humans' and animals' health and safety remains the utmost priority in this complex coexistence [6]. In our research, we resolve the challenges posed by industrial expansion into forested areas by implementing an IoT-based detection model linked to cloud computing infrastructure and specialized hardware solutions. This integrated approach enables real-time monitoringof animal movements, efficient data analysis and the automatic activation of deterrent devices, ensuring the protection of crops and the safety of humans and wildlife in areas where agriculture and animal habitats are prone to conflict. Despite its importance, the detection and identification of animals have yet to be thoroughly investigated promptly [7]. Implementing an advanced surveillance system capable of automatically monitoring the area and detecting animal presence is becoming crucial to address this issue effectively [8]. The development of various technical alternatives for intrusion detection has frequently surpassed the limitations associated with traditional methods. One such system is intrusion detection, which focuses on identifying moving targets in the surrounding area [9]. Moreover, the IoT and other sensing technologies have revolutionized environmental monitoring and natural safeguarding efforts. These low-cost, pervasive technologies allow for the collection and analysis of data in real time, making them valuable instruments for protecting natural ecosystems and biodiversity [10]. IoT systems and technologies such as Wireless Sensor Networks (WSNs) and Unmanned Aerial Vehicles (UAVs) are now widely used to monitor and protect the environment, including wildlife conservation, forest fire detection and climate change monitoring. These technologies provide real-time data, facilitating prompt response and proactive environmental protection measures [10]. Computer vision has gained immense popularity for its classification capabilities and robust detection capabilities [11]. In recent years, several studies [3; 12; 13; 14; 15; 16] involving Internet of Things (IoT) [17] and deep learning (DL) [18] have been conducted to detect animals that can damage farmers' crops. In their research, they utilized machine learning (ML) and deep learning (DL) techniques; however, most of the previous studies focused solely on detecting moving objects without considering the safety of animals. To address this limitation and prioritize animal welfare, our research aims to develop an animal-detection system that protects crops and ensures endangered animals' well-being. This research focuses on developing an animal detector that activates an alarm system when animals approach fields, prompting them to retreat and eliminating the need for harmful measures like killing. The project workflow starts with preparing a dataset, where we collect images or recordings of endangered animals near agricultural areas and label them accordingly. Next, we deployed a model to detect animals accurately and save the best-performing model weights for future hardware implementation. An IoT system is then created to detect and notify farmers and animals, promoting ecological balance.