## 5 Discussion  
The approach presented in the paper for the construction of a balanced dataset based on the initial unbalanced dataset allows a significant increase in the metrics for the classification of the smallest classes. For some models, this increase is incredibly significant-from zero metrics, when the model does not see this class at all, to TPR values more than 0.6. At the same time, there is always a slight deterioration (by a few percent) in metrics for large classes. The proposed approach was tested on various unbalanced datasets that contained color and grayscale images. The metrics for small classes for all datasets were significantly improved.  
In fact, the proposed approach is an ensemble approach for preprocessing unbalanced datasets. It includes two steps.  
The first step is to reduce all classes except the smallest one. However, unlike other approaches, we suggest reducing not to the size of the smallest class, but to the size of the smallest class + 15% of it. The second step is a random augmentation of the smallest class. Thus, on the one hand, we balance the dataset, while retaining more information than with conventional downsampling. However, the dataset is not too clogged with artificially generated information, as with conventional upsampling.  
At the same time, it is of interest to what percentage we can augment the smallest class without losing the quality of training the model. This may be the subject of further study. It is also the subject of interest to what extent the proposed approach can improve the models' metrics for datasets containing non-image samples.  
The suggested approach can help to solve the problem of small class recognition in various important computer vision problems where unbalanced datasets are widespread, for example, medical tasks of computer vision, and tasks of recognizing non-standard or critical situations in many fields of science and technology.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Metrics** & **alt\_initial\_ds** & **alt\_small\_ds\_1** & **alt\_small\_ds\_2** & **alt\_small\_ds\_3** & **alt\_aug\_ds** \\ \hline \multicolumn{6}{c}{**DeIT-base-patch16-224**} \\ F1 & 0.87 & 0.80 & 0.77 & 0.75 & 0.79 \\ Accuracy & - & 0.80 & 0.77 & 0.75 & 0.78 \\  & & \multicolumn{4}{c}{Normal} \\ TPR & 0.89 & 0.93 & 0.92 & 0.89 & 0.95 \\ TNR & 0.98 & 0.96 & 0.96 & 0.96 & 0.94 \\  & & \multicolumn{4}{c}{Osteopenia} \\ TPR & 0.28 & 0.64 & 0.75 & 0.68 & 0.67 \\ TNR & 0.95 & 0.89 & 0.79 & 0.80 & 0.85 \\  & & \multicolumn{4}{c}{Osteoporosis} \\ TPR & 0.94 & 0.85 & 0.64 & 0.68 & 0.73 \\ TNR & 0.70 & 0.85 & 0.90 & 0.86 & 0.89 \\ \hline \hline \end{tabular}
\end{table}
Table 16: _Cont._  
**Author Contributions:** Conceptualization, M.B.; methodology, M.B.; software, S.O. and I.U.; validation, S.O., I.U. and A.S.; formal analysis, S.O.; investigation, I.U.; resources, M.B.; data curation, A.S.; writing--original draft preparation, I.U. and S.O.; writing--review and editing, M.B.; visualization, S.O.; supervision, M.B. and A.S.; project administration, M.B.; funding acquisition, M.B. All authors have read and agreed to the published version of the manuscript.  
**Funding:** This research received no external funding.  
**Institutional Review Board Statement:** Not applicable.  
**Informed Consent Statement:** Not applicable.  
**Data Availability Statement:** Not applicable.  
**Acknowledgments:** Thanks to management and scientists of Research Institute of Traumatology, Orthopedics and Neurosurgery (Saratov, Russia) for support.  
**Conflicts of Interest:** The authors declare no conflict of interest.