## 2 Proposed Method for Fault Diagnosis in Milling Machines
### Convolutional Neural Network  
A CNN is a specialized class of deep learning model particularly adept at processing data with a grid-like structure, such as images. In the context of this research, a CNN is utilized to analyze CWT scalograms generated from AE signals. These scalograms provide a detailed time-frequency representation of the signals, which is important for identifying faults in milling machines. A traditional CNN architecture is mainly composed of several key components: convolutional layers, pooling layers, and flattened layers [33]. The convolutional layer is the fundamental building block of a CNN, responsible for automatically learning spatial hierarchies of features from the input images. This layer applies a set of filters across the input data, performing a convolution operation to produce feature maps. Each filter is designed to detect specific patterns, such as edges, textures, or shapes within the scalograms. The operation of a convolutional layer can be mathematically described by Equation (3) as follows:  
\[\mathbf{Y}_{j}^{\ddagger}=\mathbf{f}\Big{(}\sum_{i=1}^{N}\mathbf{X}_{i}^{\ddagger-1}*W_{ ij}^{\ddagger}+\mathbf{B}_{j}^{\ddagger}\Big{)} \tag{3}\]  
where \(\mathbf{Y}_{j}^{\ddagger}\) represents the output feature map at layer 1 for the \(j\)-th filter. \(\mathbf{X}_{i}^{\ddagger-1}\) denotes the input feature map at the previous \(\ddagger-1\). \(\mathbf{W}_{ij}^{\ddagger}\) is the convolutional kernel applied between the \(i\)-th input and the \(j\)-th output feature map. \(\mathbf{B}_{j}^{\ddagger}\) is the bias term added to the output. This layer can detect important features at different levels of abstraction and is key to the success of CNNs in fault detection from CWT scalograms. Pooling layers are typically inserted after convolutional layers to reduce the spatial dimensions of the feature maps while retaining the most important features. This down-sampling process helps to make the network more efficient by reducing the number of parameters, thus reducing the risk of overfitting and speeding up computation. The operation of a pooling layer, particularly max pooling, can be expressed as shown in Equation (4). \[\mathbf{Z}_{j}^{\ddagger}=\mathbf{pool}\Big{(}\mathbf{Y}_{j}^{\ddagger-1}\Big{)} \tag{4}\]  
where \(\mathbf{Z}_{j}^{\ddagger}\) is the pooled output corresponding to the \(j\)-th feature map at the layer \(\ddagger\), and \(\mathbf{Y}_{j}^{\ddagger-1}\) is the input feature map of the pooling layer. The pooling layer helps in summarizing the feature maps, thereby preserving the essential patterns while reducing the spatial resolution, which is beneficial for further layers. Figure 3: CWT scalograms before and after applying a Gaussian filter: (a) CWT scalogram before filtering and (b) CWT scalogram after filtering. The flattened layer serves as the bridge between the convolutional/pooling layers and the fully connected layers that follow. It takes the multi-dimensional output of the convolutional and pooling layers and converts it into a one-dimensional vector. Mathematically, if the output of the final pooling layer is a feature map of size \(\mathbf{h}\times\mathbf{w}\times\mathbf{d}\) (height, width, depth), the flattened layer reshapes it into a vector of length \(\mathbf{h}\times\mathbf{w}\times\mathbf{d}\), as shown in Equation (5). \[\mathbf{v}=\mathbf{flatten}(\mathbf{Z}) \tag{5}\]  
where \(\mathbf{Z}\) is the input feature map tensor of the shape (\(\mathbf{h}\times\mathbf{w}\times\mathbf{d}\)), and \(\mathbf{v}\) is the resulting one-dimensional vector, as can be seen in Figure 4.  
In this work, CNN extracts and processes features from CWT scalograms derived from AE signals. By using a convolutional layer for feature detection, pooling layers for dimensionality reduction, and flattened layers for preparing the data for the next round of processing, CNN enables efficient fault diagnosis in milling machines. Figure 4 is the architecture diagram of the CNN for the proposed method.