# Two-Stage Deep Learning Method for Breast Cancer Detection Using High-Resolution Mammogram Images
## 3 Methodology
### RoI Generation
All generated patches from the previous step are fed to the Faster R-CNN model to obtain corresponding bounding boxes, class names, and confidence scores for detected masses. However, these bounding boxes represent detected tumors for the patches (i.e., corresponding to generated \(x\), \(y\) coordinates). Therefore, we need to map these bounding boxes to locate breast tumors on the original image. Given the original image boundaries, each detected tumor (let us denote \(i\)-th detection as \(x^{{}^{\prime}}_{i}\), \(y^{{}^{\prime}}_{i}\), \(w^{{}^{\prime}}_{i}\), \(h^{{}^{\prime}}_{i}\)) is mapped to the original image using Equation (2):

\[ \begin{array}{l}x_{mi}\ :=\ x^{{}^{\prime}}_{i}+x\\ y_{mi}\ :=\ y^{{}^{\prime}}_{i}+y\\ w_{mi}\ :=\ w^{{}^{\prime}}_{i}\\ h_{mi}\ :=\ h^{{}^{\prime}}_{i}\end{array}  \tag{2}\]

where \((x^{{}^{\prime}}_{i}\), \(y^{{}^{\prime}}_{i}\), \(w^{{}^{\prime}}_{i}\), \(h^{{}^{\prime}}_{i})\) represents the \(i\)-th detection corresponding to the extracted breast area with a bounding box of (\(x\), \(y\), \(w\), \(h\)). Thus, the mapped bounding boxes are denoted by \((x_{m},\ y_{m},\ w_{m},\ h_{m})\). Since multiple patches are used to detect breast tumors, some tumors might be present in more than one patch. The duplication removal algorithm is used to find the unique bounding box for each tumor. Algorithm 2 describes the duplication removal process in detail. Our duplication removal algorithm is inspired by how conventional object detection models handle multiple detections for the same object. We use an intersection over union (IoU) threshold of 0.5, obtained by the original Faster R-CNN model. Lastly, we locate the unique detections on the original image to derive the final output. ```
1:Input: list of detections, \(det[]\)
2:Output: updated list, \(newDet[]\)
3:\(newDet\leftarrow\)\(det[0]\)
4:\(noDuplicate\leftarrow\)True
5:for\(i=1\) to \(len(det)-1\)do
6:for\(j=0\) to \(len(newDet)-1\)do
7: Compute IoI for \(bbox[i]\) and \(bbox[j]\)
8:if IoI \(\geq\) 0.5 then
9:if\(conf[i]>conf[j]\)then
10: Replace \(newDet[j]\) with \(det[i]\)
11:end
12:end
13:\(noDuplicate\leftarrow\)False
```

**Algorithm 2**Duplication removal \begin{table}
\begin{tabular}{c c c} \hline \hline
**Method** & **Recall** & **Mean IoU** \\ \hline Mask R-CNN & 0.932 & 0.59 \\ Faster R-CNN & 0.954 & 0.63 \\ YOLO & 0.938 & 0.48 \\ SSD & 0.95 & 0.55 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Detection accuracy comparison between popular object detection models. ### Intra-Class Classification Improvement

Having a separate classification model to boost the performance of the detection models is not a new approach in literature of medical diagnosis. Through a comprehensive survey on DL-based breast cancer diagnosis approaches, [PERSON] et al. (2018) showed that artificial neural networks (ANN) ([PERSON] et al., 2017), deep belief networks (DBN) ([PERSON] et al., 2017) as well as CNN models can help CAD systems improve the classification accuracy by solely focusing on unique and deep features of detected tumors. In this study, we employ a standalone CNN-based classification model to combine its softmax scores with the detection model's classification scores. As shown in Figure 1, this classification model receives detected tumors (which are the outputs of the detection model) as inputs and performs an inference to classify the type of the tumor. However, first, detected tumors should be upscaled as shown in Figure 3. Note that CNN classification takes place after we find unique bounding boxes for each tumor by mapping back and removing duplication from generated patches. Figure 3 shows the rescaling of bounding box coordinates, which, evidently, is crucial for the classification model. Empirically, we found out that rescaling the bounding box by a factor of 1.7 improves the classification accuracy the best compared to other rescaling factors (e.g., 1.5\(\times\), 2\(\times\)).