## 2 Materials and Methods
### Rotational Axis Detection Module
#### 2.3.2 Training  
The network training was conducted on the training and validation sets described in Table 3. The Dice coefficient was used as the cost function to evaluate segmentation effectiveness. The Adam optimizer was utilized for training. The initial learning rate was set to 0.001, and, similarly to the training of the network for front detection and segmentation, it decreased as the cost function calculated on the validation set approached a plateau. The initial weights of the encoder were initialized with weights pre-trained on the ImageNet dataset. This ensured that the network training did not start with random weights and allowed for faster model convergence. The training was scheduled for 50 epochs, with all training and validation images used in each epoch. To mitigate overfitting, an early stopping function was implemented, which detected the point when the cost function on the validation set ceased to decrease.  
Next, a five-channel input is prepared for the neural network. The first three channels correspond to the RGB image (Figure 2). The fourth channel represents the handle mask, which includes the detection of all handles in the image, even if these handles belong to translational fronts (Figure 2). The last channel represents the mask of all rotational fronts for which handles are detected (Figure 2).  
Postprocessing is applied to the output from the neural network to obtain the rotational axis model. First, noise is eliminated from the mask obtained from the CNN output using a morphological opening, which removes isolated pixels while preserving the size of larger objects. Next, the two endpoints of each identified pivot axis are located on the denoised mask. The Canny algorithm is utilized to find edges in the mask. Based on the detected edges, individual contours are extracted, with their upper and lower vertices representing the two endpoints of the axis of rotation in the image. This method is limited to rotational fronts with a vertical axis of rotation.  
Using the determined endpoints, the directional coefficients of the straight line forming the rotational axis are calculated. These directional coefficients are then used to assign the axis of rotation to a specific front. Initially, a decision is made for each pivot front regarding which side of the front contained the axis of rotation. This decision is based on the distance of the handle from the side edges of the front mask. It is important to note that the resulting front segmentation mask may not be perfect, so the edge alone cannot be relied upon to determine the axis of rotation. The side on which the object's axis of rotation is located is determined by the side whose edge is at a greater distance from the handle. Subsequently, the distance between the center of this edge and each of the straight lines representing the detected axes of rotation is calculated. The axis of rotation for a given front is the axis that lies closest to the center of the edge on the rotating side of that front, provided it falls below a certain distance threshold. If the closest distance exceeds a certain threshold, then the front does not have an assigned axis of rotation. In cases where a front attempts to assign a pivot axis already assigned to another front, it is only allowed if the distance to that axis is smaller than the distance to the original front. After analyzing all rotational fronts, rotation axis predictions that have not been assigned to any front are discarded.