## 1 Introduction
The correct classification of minority classes is often of primary importance when the model is applied to real-world scenarios (e.g., fraud detection, biomedical imaging processing for ill people detection, and so on). Common and conventional strategies to create models that have similar performance whatever the classes involve data modification techniques aimed at overcoming the limitations introduced by imbalanced data distributions. These data rebalancing techniques try to even out data distribution by oversampling undernumbered classes and by downsampling overnumbered classes. Although advanced techniques such as cluster-based undersampling or generative-based modeling prove to be effective in removing or adding new samples for data balancing processes, an incorrect use of such tools can still lead to poor classification performance. In the case of undersampling, data cancellation may reduce the feature space where the model can learn from. The generation of synthetic data that does not add any new information to the dataset may instead lead to the overfitting of classifiers. To overcome the above-mentioned limitations, a novel data preprocessing technique to reduce biasing in high unbalanced multi-class datasets is presented in this paper. The idea is to even the cardinality of the classes in the dataset both by avoiding sample deletion and reducing the generation of synthetic augmented samples. Overnumbered samples are equally distributed among new categories, to this end. As a result of this process, the model is still able to learn from the whole set of samples but it is not biased towards any of the classes. The high correlation between classes composed of samples from the original category makes the classification a challenging phase for the model. If the training process is correct, most misclassifications concern groups of correlated subcategories and the confusion matrix displays a block diagonal trend. For assessing the effectiveness of the designed approach and its capacity of operating in real-life situations, two models in the frame of PA are indicated for the localization and recognition of pests belonging to several species. The public IP102 dataset is considered a test bench which involves multi-class collection, characterized by a high degree of imbalance. In particular, the first model (referred to as model A) is able to detect and then classify several insects while the second model (mentioned with model B) performs at once the pest classification task. The main contributions of this paper are as follows:  
* A novel, general-purpose balancing technique to reduce biasing and variability in the presence of high-unbalanced multi-class datasets is proposed, thus improving classification performance. The designed method is a multi-stage pipeline comprising initial feature analysis, data cleaning, and data filtering steps. The actual balancing process tackles the problem of overnumbered classes by partitioning in multiple subclasses rather than deleting samples, so that the model can still learn from the original feature space. During inference, most of the misclassifications are related to the high correlation between subclasses originated from the same category. The generated confusion matrix will therefore have a block-diagonal trend in which all the errors in a specific sub-block must not be counted as classification errors. * The construction of a balanced and enhanced version of the IP102 dataset to improve the classification accuracy and robustness of the methods is developed. * The development of two multi-class insect pest detection and classification models trained on the proposed balanced IP102 dataset is proposed. which reached good performance with challenging images too and outperformed state-of-the-art models trained on the same dataset. The rest of the paper is organized as follows. Section 2 presents a brief survey of papers concerning both pest classification methods and techniques for data imbalance handling which have been published in the literature in the last five years.