## 4 Bearing Fault Detection Using YAMNet and Transfer Learning
### YAMNet Fine-Tuning  
It is claimed that the features detectable by the YAMNet framework (Figure 5) provide a source of knowledge to classify bearing spectrograms as well. To verify this assumption, the fully connected and the output layers of YAMNet were replaced with new layers and the convolutional part remained unaltered. The weights of the replaced layers were consequently optimized by training the model with CWRU data. Given the inherent similarities between source and target domains, the replacement of the only fully connected layer was effective. The main hyperparameters featuring the training phase are reported in Table 3.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Dataset** & **Classes** & **Labels** & \begin{tabular}{c} **Training** \\ **Samples (70\%)** \\ \end{tabular} & \
\begin{tabular}{c} **Validation** \\ **Samples (20\%)** \\ \end{tabular} &
\begin{tabular}{c} **Test Samples** \\ **(10\%)** \\ \end{tabular} \\ \hline \multirow{4}{*}{A} & \multirow{4}{*}{4} & B & 101 & 29 & 14 \\  & & IR & 102 & 29 & 14 \\  & & OR & 76 & 21 & 11 \\  & & Normal & 22 & 6 & 3 \\  & & **Total** & **301** & **85** & **42** \\ \hline \multirow{4}{*}{B} & \multirow{4}{*}{12} & B007 & 25 & 7 & 4 \\  & & B014 & 25 & 7 & 4 \\  & & B021 & 25 & 7 & 4 \\  & & B028 & 25 & 7 & 4 \\  & & IR007 & 26 & 7 & 4 \\  & & IR014 & 25  
The Adam optimizer was employed for adapting the learning rate during training [53]. The batch normalization process [59] normalizes mini batches of data for each network channel independently. Such a normalization occurs within layers, thus preventing exploding gradients issues. Over an entire iteration, a mini batch set is passed through the network, whereas a whole epoch involves the complete training set. The validation frequency specifies the number of iterations elapsed between validations. The trend of the loss functions was monitored over the training process. As an example, Figure 8a shows the loss function resulting from training with dataset C.  
In this dataset few samples were portioned in a considerable number of classes (Table 1) and overfitting issues manifested. This is evident by the fact that the validation loss remained considerably higher than the training loss. To comply with overfitting matters, a dropout layer with 90% dropout probability was added before the fully connected layer. Dropout layers represent an effective strategy to prevent overfitting in deep networks. Those layers set input elements to zero with a given probability and significantly reduce the number of network parameters. Converge issues can be hypothesized. Figure 8b shows the improvements for network performances due to the dropout layer. A smoother training process is achieved, and overfitting is remarkably mitigated. Training times and epochs are reported in Table 4. For all the datasets, the training stopped either if maximum accuracy was stably reached or if the maximum epochs were met.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Hyperparameter** & **Value** \\ \hline Optimizer & Adam \\ Initial learning rate & 0.0003 \\ Mini batch size & 64 \\ Max epochs & 40 \\ Validation frequency 1  & 4 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Fine-tuning hyperparameters.  
Figure 7: Mel spectrograms drawn from CWRU data: (**a**) Normal; (**b**) OR; (**c**) IR; (**d**) B.