# Research on Fault Diagnosis Method for Rotating Machinery Based on Edge Computing
## 3 Theoretical Background and Edge Node Design  
### Convolutional Neural Networks  
Convolutional neural networks (CNNs) are a typical deep learning technique that can process raw data with minimal preprocessing. A classic CNN primarily consists of an input layer, alternating convolutional layers, pooling layers, and fully connected layers. The alternating convolutional and pooling layers primarily extract features from the input data. After feature extraction, the fully connected layers and the Softmax function are used to learn and classify the extracted feature information [24]. Convolutional layer: this is the core component of a convolutional neural network (CNN). Each randomly initialized convolutional kernel performs convolution along the length of the input. The convolution results of multiple kernels are concatenated to produce a feature map [24]. A convolution kernel (Kernel or Filter) is a core computational unit used for feature extraction from input data. Essentially, it is a small matrix (tensor) that slides over the input feature map and performs a convolution operation [25]. In this study, the ReLU function is selected as the activation function, and its expression is:  
\[x_{j}^{l}=f(\sum_{i\in M_{j}}x_{i}^{l-1}*w_{ij}^{l}+b_{j}^{l}) \tag{1}\]  
\[f(x)=\text{Relu}(x)= \begin{cases}x,&x>0\\ 0,&x\leq 0\end{cases}  \tag{2}\]  
where \(x_{j}^{l}\) represents the j-th feature map at the l-th layer; \(f(x)\) is a nonlinear activation function; \(M_{j}\) is the set of input images; and \(*\) represents the convolution operation. \(w_{ij}^{l}\) is the weight matrix of the convolutional kernel; \(b_{j}^{l}\) is the bias term. The value in the k-th channel of the feature map in the l-th convolutional layer can be expressed as:  
\[h_{\rm k}^{\rm l}=w_{\rm k}^{\rm l}*x^{\rm l}+b_{\rm k}^{\rm l} \tag{3}\]  
where \(x^{\rm l}\) is the input to the l-th convolutional layer; \(w_{\rm k}^{\rm l}\) is the weight of the k-th convolutional kernel in the l-th convolutional layer; and \(b_{\rm k}^{\rm l}\) is the bias of the k-th convolutional kernel in the l-th convolutional layer. Pooling layer: the pooling layer primarily performs nonlinear subsampling on the feature maps of the preceding layer using pooling kernels; therefore, it is also referred to as the subsampling layer. In this study, max-pooling is employed, which represents regional features by extracting the maximum value of local features [26]. The expression for max-pooling is as follows:  
\[x_{\rm j}^{\rm l}=\max(\omega(s_{1},s_{2})\cap x_{\rm j}^{\rm l-1}) \tag{4}\]  
where \(x_{\rm j}^{\rm l}\) represents the feature map after the pooling operation; \(\omega(s_{1},s_{2})\) represents the local region of the pooling operation; \(s_{1}\) and \(s_{2}\) denote the size of the pooling region; \(\cap\) represents the overlap between the pooling region and the output feature map of the channel; and \(x_{\rm j}^{\rm l-1}\) is the feature map of the previous layer. Fully connected layer: to achieve feature fusion of the dual input layers, the features from both input layers can be flattened and then connected before being fed into the fully connected layer [27]. Suppose the flattened feature of the first input layer is \(X_{1}\) with a size of \(m\times n_{1}\) and the flattened feature of the second input layer is \(X_{2}\) with a size of \(m\times n_{2}\). Here, \(m\) represents the batch size (i.e., the number of samples), and \(n_{1}\) and \(n_{2}\) are the feature dimensions of the first and second input layers, respectively. \(X_{1}\) and \(X_{2}\) are concatenated column-wise to form a new feature matrix \([X_{1},X_{2}]\) with a size of \(m\times(n_{1}+n_{2})\). The weight matrix of the fully connected layer is \(W\), with a size of \(k\times(n_{1}+n_{2})\), where \(k\) is the dimension of the output features. The bias vector of the fully connected layer is \(b\) with a size of \(k\times 1\). The activation function is \(f\).