## 4 Verification  
To validate the proposed methodology, it was tested on an alternative dataset that consisted of densitometry images of the pelvic joints and lower spine. All images were labeled as normal (1281 images), osteopenia (870 images), and osteoporosis (2526 images). The class distribution of the images in the alternative dataset is shown in Figure 10. The dataset was obtained at the Research Institute of Traumatology, Orthopedics, and Neurosurgery (Saratov, Russia). Examples of images from the dataset are shown in Figure 11.  
\begin{table}
\begin{tabular}{c c c c c c} \hline
**Metrics** & **Initial ds** & **small_ds\_1** & **small_ds\_2** & **small_ds\_3** & **aug\_ds** \\ \hline  & & & C5 & & \\ TPR & 0.47 & 0.49 & & 0.56 & 0.57 & 0.70 \\ TNR & 0.99 & 0.93 & & 0.95 & 0.92 & 0.94 \\  & & & C6 & & \\ TPR & 0.64 & 0.72 & & 0.82 & 0.60 & 0.76 \\ TNR & 0.99 & 0.93 & & 0.92 & 0.94 & 0.96 \\ \hline \end{tabular}
\end{table}
Table 15: _Cont._Four datasets were formed according to the approach described in Section 2.1:  
1. The first dataset (alt_initial_ds) was the whole alternative dataset.
2. alt_small_ds_1, alt_small_ds_2, alt_small_ds_3 were obtained by cutting off alt_initial_ds by the smallest class. These datasets contained 870 images in each class.
3. alt_aug_ds-classes \"normal\" and \"osteoporosis\" were cut off to 1044 images (size of the smallest class \"osteopenia\" +15%) and class \"osteopenia\" was augmented up to 1044 images with the help of the transform described in Section 2.1.  
Due to the limited size of the article, we present the metrics of only two models-ResNet34 and DeIT (Table 16).  
\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 \hline \multirow{2}{*}{F1} & \multicolumn{4}{c}{**ResNet34**} & \multicolumn{1}{c}{0.65} & \multicolumn{1}{c}{0.66} & \multicolumn{1}{c}{0.69} \\ Accuracy & - & 0.68 & 0.65 & 0.66 & 0.71 \\ \multicolumn{4}{c}{Normal} \\ TPR & 0.78 & 0.90 & 0.86 & 0.75 & 0.81 \\ \multicolumn{4}{c}{} \\ TNR & 0.97 & 0.90 & 0.95 & 0.95 & 0.94 \\ \multicolumn{4}{c}{Osteopenia} \\ TPR & 0.52 & 0.56 & 0.51 & 0.66 & 0.69 \\ \multicolumn{4}{c}{} \\ TNR & 0.81 & 0.79 & 0.79 & 0.75 & 0.77 \\ \multicolumn{4}{c}{Osteoporosis} \\ TPR & 0.75 & 0.66 & 0.56 & 0.58 & 0.63 \\ TNR & 0.85 & 0.82 & 0.76 & 0.81 & 0.88 \\ \hline \hline \end{tabular}
\end{table}
Table 16: Metrics for DeIT and Resnet34 for the alternative dataset.  
Figure 11: Samples from the alternative dataset: The left pelvic joint, the lower spine and the right pelvic joint.  
Figure 10: Class distribution of images of the alternative dataset.  
As can be seen in Table 16, both the DNN ResNet34 and DeIT had stable improvement for predicting rare class images on the alt_aug_ds dataset. Note, that TNR can be worsening for the rare class for all constructed datasets. However, the amount by which the value decreased was less for the alt_aug_ds dataset.  
So, we can conclude that we can avoid the disbalance of the dataset by constructing the new dataset according to the following approach:  
1. to cut all classes to a value equal to the size of the smallest class + 15%.
2. to augment the smallest class by random transformations similar to shifting, scaling, rotation, cropping, flipping, RGB shifting, and brightness contrasting.