## 3 Proposed Approach
### Feature Extraction/Classification
#### 3.2.2 Proposed Mean-CAM Methodology  
The CNN model proposed here uses a GAP layer and a densely connected softmax layer. For each image, \(I\), the model generates the final convolutional feature map, \(f=F(I)\), where \(F\) is a sequence of operations performed by the CNN, comprising convolution, pooling, and activation. Additionally, \(f_{k}\) denotes the \(k^{th}\) channel of the feature map, and \(f_{k}(x,y)\) represents the value at spatial location \((x,y)\). As per [PERSON] et al. [12], the CAM retrieves the class activation map and specifies the object region, as displayed in Figure 6. The CAM ideally retrieves the class activation map from the ground truth, which aggregates each channel of the weighted feature map. For a global image, \(f_{k}(x,y)\) represents the activation of a spatial location \((x,y)\) in the \(k^{th}\) channel of the output of the final convolutional layer, where \(k\in\{1,2,...,K\}\). For ResNet-50, this layer contains 2048 activation maps, each with dimensions of \(7\times 7\). The subsequent average pooling layer reduces the previous layer's size to \(1\times 1\times 2048\), calculating the average of each feature map. The weights, \(W_{k}^{c}\), connect the predominant predicted class with the \(k^{th}\) node in the flattening layer, indicating the potency of each activation map for the predicted class (as shown in Figure 7). Using Equation (6) as inspiration, we calculate the CAM for each image within the same class, like those in the second row of Figures 8 and 9. Therefore:  
\[H_{c}(x,y)=\sum_{k=1}^{K}W_{k}^{c}f_{k}(x,y) \tag{7}\]  
where \(H_{c}\) represents the CAM for class \(c\) and \(W_{k}^{c}\) is the \(k^{th}\) weight of the softmax layer for class \(c\). Additionally, we denote \(f_{k}\) as the activation map in Figure 6.  
Figure 6: Class activation mapping. For a given class \(c\) that consists of \(N\) images denoted as \(I_{n}^{c}\), where \(n\in\ \{1,2,...,N\}\), the average class activation map is obtained by computing the sum of activation maps of all images in the class and dividing it by \(N\). Please refer to Figure 7 for illustration. \[Mean\_H_{c}(x,y)=\frac{1}{N}\sum_{n=1}^{N}\sum_{k=1}^{K}W_{k}^{n}f_{k}^{n}(x,y) =\frac{1}{N}\sum_{n=1}^{N}H_{n} \tag{8}\]  
where \(Mean\_H_{c}\) represents the average class activation map (Mean-CAM), indicating the collective importance of each pixel in the original images of a class \(c\). \(W_{k}^{n}\) denotes the  
Figure 8: The process of discriminative region generation for the MAI dataset. (**Top**) Original ear images of the same class for the global stage. (**Top-down**) The output’s visualization of mask inference using the CAM technique. The most important characteristics are red and blue for the lower ones. (**Bottom-up**) The output’s visualization of the mask inference using the Mean-CAM technique. Green bounding boxes denote the discriminative region. (**Bottom**) Cropped and resized images as the input images size from the green bounding boxes, used as an input to the local stage. Figure 7: Graphical flowchart of the Mean-CAM process. global stage. It encompasses of five blocks, succeeded by a GAP layer and an FC layer for classification. Ultimately, the output vector \(S_{g}(c\mid I)\) is normalized using a softmax layer:  
\[P_{g}(c\mid I)=\frac{\exp\left(S_{g}(c\mid I)\right)}{\sum_{c=1}^{C}\exp\left(S_{ g}(c\mid I)\right)} \tag{10}\]  
where \(I\) represents the global image, \(P_{g}(c\mid I)\) indicates the probability score of \(I\) fitting into the \(c^{th}\) class, \(c\in\ \{1,2,...,C\}\), \(C\) represents the total number of classes, and \(S_{g}\) refers to the input vector elements for the softmax function. The local stage aims to mitigate some of the disadvantages of the global stage but focuses solely on the local area. Both stages utilize the ResNet-50 convolutional network structure, but are not designed to share weights due to their distinct functions. The probability score of the local stage is determined through Equation (10), denoted as \(P_{l}(c\mid l_{crop})\).