## 1 Introduction  
The adoption of suitable agricultural management practices aimed at enhancing productivity, minimizing environmental costs, and supporting the development of ecosystem services is a challenge for modern agriculture [1]. Integrated pest management (IPM), within the broader field of precision agriculture (PA), may be the answer to this challenge. Precision agriculture is a farming management idea that allows us to carry out interventions specifically targeted to optimize and increase soil quality and productivity by effective strategies and tools. PA employs information technology for ensuring that cultivations and soil have everything they need to stay healthy and to maximize productivity whilst minimizing unintended impacts on wildlife and the environment too. Consequently, PA can be considered as an efficient and smart farm management approach, which adopts modern information technologies for collecting field data from several sources and making decisions about the crop production. Soil typology, climatic conditions, yield data, and cultivar and irrigation problems are just a few aspects considered by PA [2; 3]. The adoption of embedded tools/airborne systems, the increase in farm profitability, and the reduction in soil erosion and nitric nitrogen losses are some of the agronomic, technological, and economic challenges to which PA has to provide answers [2]. Information communication technology such as the Internet of Things, artificial intelligence, cloud computing, and block-chain are crucial for PA to manage, interpret, use, and store the large number of information collected by smart sensors, satellites, unmanned aerial vehicles, robots, and so on. The early and accurate detection and control of pests and diseases is a core element of PA. Integrated Pest Management (IPM) is a strategy to fight pests through a mix of sustainable techniques whose aim is to keep pest levels below the threshold, which could potentially lead to economic damage [4]. Pest monitoring is a necessary step to ensure that the most appropriate measures are timely carried out [5]. Traditional IPM strategies require human intervention to monitor crops, to check for pest presence, to identify the specific pest, and to evaluate the effects/damages of infestation. These methods are time-consuming and are consequently susceptible to errors and misclassifications. For these reasons, automatic monitoring systems have been developed which rely on smart traps, located in the crop under analysis. Smart pest management systems are generally equipped with image processing procedures for pest classification and counting [6]. Deep learning is nowadays gaining increasing attention in the field of pest image recognition due to its capability to equip machines with solutions to automatically solve complex tasks within a reasonable time [7]. Machines are able to learn complex patterns from past data distributions and use the acquired knowledge to make decisions on how to act in real-case scenarios. In real natural environments, the great differences in shape, size, color, background, illumination of pests, and the non-uniformity of the collected data/image distribution results in the creation of imbalanced datasets make the classification task a challenging objective. Furthermore, the intrinsic imbalance linked to the natural distribution of insect species in nature increases the degree of imbalance even more. This aspect is a key factor affecting the performance of deep learning models because of biases that may lead automatic models to make decisions in favor of high-represented classes while disregarding classes with low cardinality [8]. For instance, a binary classifier model trained on an extremely imbalanced dataset may achieve high performance in terms of accuracy, even if all the samples belonging to the minority class are misclassified. When dealing with imbalanced datasets, the challenge therefore consists of extracting knowledge from less-represented classes.