# Breast Cancer Diagnosis Using YOLO-Based Multiscale Parallel CNN and Flattened Threshold Swish
## 2 Material and Methods
### Activation Function  
In model training, the choice of an activation function is crucial, as it transforms input signals into output while introducing non-linearity, essential for effective classification. Traditional activation functions like Sigmoid, ReLu, and Tanh are commonly used, but each has limitations. For instance, Sigmoid and Tanh can lead to gradient disappearance in deep layers due to diminishing propagation values, and Sigmoid's complex power operations can slow training. ReLu, despite its strong convergence rate, is prone to creating dead neurons and fails to constrain the scale of data points as the network depth increases. To overcome these drawbacks, newer and more stable activation functions like Flatten-T Swish (FTS) have been proposed. In our study, we adopt the FTS activation function for our proposed multilevel and multiscale CNN architecture, replacing ReLu. FTS, formulated in Equation (3), with a threshold of \(-\)0.20, offers enhanced stability and performance in handling data nonlinearity.  
\[\text{FTS}(x)=\begin{cases}\frac{x}{1+e^{-x}}+Thr\,\ if\ x\geq 0\\  
components, namely, BB localization loss (\(Loss_{Loc}\)), BB dimension loss (\(Loss_{Dim}\)), class confidence loss (\(Loss_{Conf}\)), and classification loss (\(Loss_{Class}\)).  
The general loss is illustrated in Equation (4).  
\[Loss(P_{BB}\,GT_{BB}\ )=Loss_{Loc}+Loss_{Dim}+Loss_{Conf}+Loss_{Class} \tag{4}\]  
The localization loss for bounding boxes is denoted as \(Loss_{Loc}\) and is detailed in Equation (5). This loss is calculated based on the center coordinates of predicted and ground truth BB, ensuring precise localization.  
\[Loss_{Loc}=\lambda_{Coord}\sum\limits_{i=0}^{S}\ \sum\limits_{j=0}^{S}\ \sum\limits_{k=0}^{K}\ \prod\limits_{ijk}^{ Lesion}\left[\left(C\_x\ _ij}-C\_x\_ij}\right)^{2}+\left(C\_y\ _ij}-C\_y\_ijk}\right)^{2}\right] \tag{5}\]  
The dimensions of a BB are crucial and are determined using its width and height. We calculate the BB dimension loss, denoted as \(Loss_{Dim}\), described in Equation (6). This calculation is pivotal for maintaining the accuracy of the BB size in the model's predictions.  
\[Loss_{Dim}=\lambda_{Coord}\sum\limits_{i=0}^{S}\ \sum\limits_{j=0}^{S}\ \sum\limits_{k=0}^{K}\ \prod\limits_{ijk}^{ Lesion}\ \left[\left(\frac{W_{ij}-\hat{W}_{ijk}}{\hat{W}_{ijk}}\right)^{2}+\left( \frac{H_{ij}-\hat{H}_{ijk}}{\hat{W}_{ijk}}\right)^{2}\right] \tag{6}\]  
Alongside the dimensions and location, our model also predicts the class of each BB. To calculate the loss associated with the confidence score, we use Equation (7).  
\[\begin{array}{c}Loss_{Conf}=\lambda_{NoLesion}\sum\limits_{i=0}^{S}\ \sum\limits_{j=0}^{S}\ \sum\limits_{k=0}^{K}\ \prod\limits_{ijk}^{NoLesion}\left[\left(CS_{ij}-C\dot{S}_{ijk}\right)^{2} \right]\\ +\lambda_{Vehicle}\sum\limits_{i=0}^{S}\ \sum\limits_{j=0}^{S}\ \sum\limits_{k=0}^{K}\ \prod\limits_{ijk}^{ Lesion}\left[\left(CS_{ij}-C\dot{S}_{ijk}\right)^{2}\right]\end{array} \tag{7}\]  
Furthermore, the classification result of each BB is denoted as \(Class=[Class_{1}\,\ Class_{2}\,\ \ldots,Class_{c}\ ]^{T}\). Then, the \(P_{r}\ (Class_{l})_{l\ \in\ C}\) denotes the GT, while the predicted probability of the lesion belonging to the \(l\) class is denoted as \(\hat{P}\ (Class_{l})_{l\ \in\ C}\). The class loss is estimated as explained in Equation (8).  
\[Loss_{Class}=\lambda_{Class}\sum\limits_{i=0}^{S}\ \sum\limits_{j=0}^{S}\ \sum\limits_{k=0}^{K}\ \prod\limits_{ijk}^{ Lesion}\ \sum\limits_{l=0}^{C}\ \left[-P_{r_{ij}}\ \left(Class_{l} \right)\log\hat{P}_{r_{ij}}\ \ (Class_{l})\right] \tag{8}\]