## 2 Materials and Methodology
### Fault Diagnosis Methodology
#### 2.2.4 Transfer Learning Training  
Following the order established in the methodology, we proceed to adapt the previously trained convolutional neural network \"SqueezeNet\" to carry out the task of classifying scalograms. It is important to note that \"SqueezeNet\" has previously been subjected to rigorous training with a dataset of more than one million images, which has allowed it to acquire highly enriched feature representations. In the transfer learning technique, a pre-trained network is taken and used as a starting point for a new task. This approach is considerably more efficient in terms of time and resources compared to training a network from scratch with randomly initialized weights. In addition, it enables the rapid transfer of learned features, even with a smaller training dataset.  
Specifically, in \"SqueezeNet\", the convolutional layer called \"conv10\" is used for the extraction of key features of the image and the classification layer identified as \"ClassificationLayer_predictions\" to carry out the classification of the input image. Both layers are essential in the process of combining the features extracted by the network into probabilities associated with each class, thus determining the loss value and the prediction labels. When \"SqueezeNet\" needs to be retrained to classify new images, it is necessary to replace the layers with new layers that are specifically adapted to the characteristics of the images of interest.  
In most neural network architectures, the last layer that can be fine-tuned during training is usually a layer known as the \"fully connected\" or \"fullyConnectedLayer\". However, in networks like SqueezeNet, this last layer is 1 by 1 in size. In this work, this convolutional layer is replaced with a new one that has several filters equal to the number of classes we want to classify. Additionally, the classification layer that assigns the network's output classes is replaced by a new layer that does not include class labels. By using the \"trainNetwork\" function, it automatically adjusts the output classes during the training process.  
To control the learning rate in the transferred layers, we made use of the \"trainingOptions\" function in Matlab and set a relatively low initial learning rate. Then, after havingcreated the new convolutional layer, we increased the learning rates in the new final layers. This combination of learning rate settings results in fast learning exclusively in the newly added layers, while the other layers learn more gradually. Moreover, during the transfer learning process, it is not necessary to perform many training epochs. It is worth mentioning that one epoch is equivalent to a complete training cycle covering the entire dataset. On the other hand, the \"ValidationFrequency\" option in the \"trainingOptions\" function allows validating the network at each iteration during training by setting a specific value.  
The following parameters have been used in the network training options consistently, to evaluate the influence of the wavelet transform and the learning rate:  
* MaxEpochs = 4 (maximum number of training epochs)
* Shuffle = every-epoch (change the order of training and validation data before each training epoch)
* Validation frequency = 30 (validation frequency in number of iterations)
* MiniBatchSize = 20 (minibatch size for each training iteration)