## 5 Conclusions  
Pest detection and identification is a critical activity in open fields because of the presence of a complex background in the captured image, different light conditions, and the varying postures and sizes of the same insect due to the multi-distance and multi-angle views in image capturing. Unfortunately, prompt action is required where a pest attack is taking place because of the rapid spread of the infestation. It is evident that one of the most effective strategies for pest control is the accurate and timely pest detection. Artificial Intelligence techniques and Information and Communication Technologies are playing an ever-increasing role in smart agriculture, offering solutions to several problems like pest management, smart irrigation, and so on. Nevertheless, the performance of deep learning models depends on several factors like model complexity compared to data distribution, training data quality and quantity, hyperparameter tuning, and many others. When developing applications for real-world scenarios, one of the key requirements for training data is to closely reflect the real-world data distribution to avoid any performance degradation when deploying the model with in-field collected data. However, real-world data rarely have a uniform distribution,  
Figure 14: Model B performance in pest localization and classification versus image noise. Figure 13: Model A performance in pest localization and classification versus image noise. and this aspect is reflected in the strong imbalance of the datasets. Data imbalance is a challenging problem because it leads the model to prefer the most represented classes, while struggling to extract relevant information from the minority ones. The most widely adopted techniques in the literature involve resampling techniques based on augmentation and downsampling. The latter causes data deletion and the loss of useful information. To avoid any loss of information and to reduce biasing in the presence of high-unbalanced multi-class datasets, a novel data balancing technique is introduced in this work. The idea is to preserve dataset expressiveness by avoiding sample removal from over-numbered classes and, at the same time, reduce the generation of synthetic samples. For this aim, supernumerary classes are split into several subsequent sub-classes for balancing the representativeness of each category in the dataset without deleting any sample. The proposed approach is context-free and can be used to tackle the biasing problem with any kind of dataset. To evaluate the efficacy of the proposed method, a framework for the automatic localization and classification of several crop pests in outdoor conditions is also indicated. The method is based on deep learning strategies and is computationally efficient. The system's effectiveness is validated, taking into account a freely available database composed of challenging images as the test bench. The obtained results highlight the method's validity and its immunity towards resolution degradation. Future studies include the development of a special-purpose system which will integrate the procedure detailed above. The system will also be equipped with suitable hardware devices and software tools for image acquisition, processing, and transmission to a remote platform in charge of collecting and displaying the received data. Data gathered will be managed to analyze the growth rate of the infestation and to take prompt measures to tackle the pest problem. Moreover, future developments will investigate both the method's performance on various datasets from different domains and the possibility to adopt the proposed approach with non-image-based datasets. In addition, special care will be taken to verify the possibility to integrate learning-based methods capable of selecting the images to cut out. Conceptualization, C.G. and A.L. ; methodology, A.L., M.R. and C.G. ; software, A.L. ; validation, A.L. and M.R. ; formal analysis, A.L. and M.R. ; investigation, A.L., C.G. and M.R. ; resources, C.G. ; data curation, A.L.