## 2 Development of the Algorithm
### Dataset Structure
These differences were evident in size, brightness histograms, and the positioning of retinal layers within the B-scans. To streamline the process of identifying key predictors for the stages of AMD while filtering out irrelevant data, the following stages of image preprocessing were implemented:  
Normalizing pixel brightness levels to remove any color distortions;
* Generating new image samples by randomly flipping them horizontally, ensuring that all possible C-scan image positions were accounted for;
* Standardizing and reducing image size to ensure uniformity in visualizing images obtained from various tomographs, considering the retina's distinct horizontal orientation. The optimal image size for input data into the developed hybrid neural network was determined iteratively during the first stage of encoder training, as detailed in Section 2.2. Throughout this process, the width of the images was systematically reduced from 600 pixels to 404 pixels, considering the most diminutive dimensions of each image variant and the aspect ratio for the REVO NX. Ultimately, an image size of 64 by 128 pixels was selected, demonstrating the best accuracy for the trained model with minimal signs of low generalization ability. This was assessed by measuring deviations in the learning error graph for training and validation samples. Developing a Classifier Structure and Identifying the Problem of Direct Classification of Medical Data  
The modern approach to image analysis relies on processing images at the level of individual pixels. To analyze an image, the brightness of each pixel is determined, as well as its location in the entire image and other clusters of pixels [53]. These features, obtained through analysis, form a vector representation of the image in a feature space. The more distinct the vectors representing one class are from those of others, the greater the classification effectiveness will be [54]. Convolutional neural networks (CNNs) are effective for extracting features from images. These networks can separate image vectors in feature space when there are enough representative examples for each class in classification problems [55; 56]. However, additional steps are required when the number of images is limited or there is a class imbalance to ensure the stability of deep computer vision algorithms [57; 58]. To address these challenges, we selected a base classification model and then modernized it step by step, evaluating the effectiveness of each change. We selected a four-layer CNN-based encoder model as our classifier structure to implement the direct classification of AMD stages. This model has demonstrated effectiveness in tackling classification problems in computer vision, mainly when dealing with a limited number of classes [59]. We conducted an ablative analysis to evaluate whether the numbers of layers and parameters were sufficient to address the problem. The results of this analysis enabled us to draw the following conclusions:  
1. When layer 4 was removed from the model, the precision for class N increased by 25%, while the average precision for the other classes remained unchanged. 2. When layers 3 and 4 were removed, the average precision level dropped below 0.5 for all classes except for class N, which maintained an average precision level of 0.65. 3. When layers 2, 3, and 4 were removed, the average precision level for all classes dropped below 0.25. 4. Incorporating a fifth layer into the encoder structure led to a slight improvement in the accuracy of classifying class N. In contrast, the accuracy for the remaining classes either remained at the same level as the model with four layers or decreased. This decline is attributed to model retraining, as indicated by the divergence in the error rates between the training and validation samples throughout the training process. Consequently, we decided to concentrate on the encoder's architecture, which consists of four layers.