## 2 Materials and Methods
### Methods
#### 2.2.2 Double-Branch-CNN Feature Extraction  
To automatically extract features from the prepared RGB images, we use a double-branch convolutional neural network. Both paths employ similar pre-trained ResNet-50 architecture consisting of a set of convolutional and identity blocks (Figure 4) [27]. ResNet is a representative deep CNN  
Figure 2: General scheme of a proposed hemorrhage detection model. The same architecture applies for each classification task (five ICH subtypes vs. healthy brain). The preprocessing is a common step for all five models.  
yielding efficient results in the image classification domain. As a deeper network, it allows the extraction of more advanced features. However, a large number of layers might cause vanishing gradients and accuracy to decrease. The skip-connections in ResNet architecture minimize that risk [27]. The network accepts input data of a 224 \(\times\) 224 \(\times\) 3 size, so the images prepared during preprocessing are resized to match the required format.  
We trained both ResNet networks separately using our training data. As mentioned in Section 1, we tested both ResNets to assess their performance (note Experiment #1 described in Section 3). However, in our model, we have taken the features extracted by either branch after the average pooling layer and concatenated them to set up a joint feature vector for classification.  
The training of either network was performed using the adaptive moment estimation optimizer (Adam). We applied image augmentation, including data rotation (\(\pm\)15\({}^{\circ}\)), scaling (0.8-1.25), shear (0\({}^{\circ}\)-45\({}^{\circ}\) horizontally and vertically), and translation (\(\pm\)25 pixels horizontally and vertically). Due to the dominance of non-hemorrhage slices within the database, we performed class distribution weighting in each ICH subtype, leading to different numbers of images for classification into categories (this concerned both the balancing of class sizes and the application of weighted cross-entropy loss during training). In each experiment, we randomly partitioned the database into the training, validation, and test subsets with a 80%:10%:10% ratio in a patient-wise manner. The patient-wise assigning of datasets secures the presence of data from each patient in a single subset only. That makes the framework robust against the impact of a subject's slice-to-slice similarity on the classification accuracy. The network parameters, including the mini-batch size (8) and the number of epochs (60), were chosen experimentally. The training was terminated automatically if the validation loss did not decrease for ten epochs.  
After the training, features from the last block preceding the ResNet-50's fully connected layer were taken from either branch and concatenated. The joint feature vector containing 4096 elements was subjected to the classification process.  
Figure 3: Illustration of the results of subsequent preprocessing stages in three sample CT slices (**a–c**). Columns (left to right): raw CT slice before region of interest (ROI) extraction, subdural-window image, brain-window image, bone-window image (first three before and next three after skull removal), a stack of three CT-windowed images (Branch #1), a stack of three neighboring slices (Branch #2).