# Real-Time Pipeline Leak Detection: A Hybrid Deep Learning Approach Using Acoustic Emission Signals
## 2 Proposed Methodology
### CNN and LSTM Hybrid Structure
#### 2.3.1 Convolutional Neural Network  
CNN is a specialized deep learning model designed primarily for image processing tasks, as illustrated in Figure 4. It efficiently captures spatial hierarchies of features by applying a series of convolutional layers, which use learnable filters to detect local patterns such as edges, textures, and shapes within the input data. This automated feature extraction process allows CNNs to identify intricate relationships in image data, making them highly effective for tasks involving visual pattern recognition and classification. CNN is primarily composed of convolutional, pooling, and activation layers. The central component is the convolutional layer, which performs the convolution operation essentially as an inner product between sections of the input data and a filter matrix. This process is important for extracting feature information from the input data. By utilizing different convolutional  
Figure 3: Filtered CWT scalograms (**a**) normal and (**b**) leak conditions. kernels, a variety of features can be extracted, with the size of these kernels playing a significant role in determining the features that are captured. The mathematical representation of the convolution operation is as follows:  
\[X_{j}^{\gamma}=f\left(\sum_{i=0}^{C-1}X_{i}^{\gamma-1}*K_{ij}^{\gamma}+B_{j}^{ \gamma}\right) \tag{3}\]  
where \(\gamma\) denotes the current layer, \(X_{j}^{\gamma}\) is the \(j^{th}\) eigenmatrix of the current layer, f (\(\cdot\)) is the activation function, \(X_{i}^{\gamma-1}\) is the data element of the \(\gamma-1\) layer, \(C\) is the number of kernels, \(K_{ij}^{\gamma}\) is the weight matrix of the corresponding convolution kernel, and \(B_{j}^{\gamma}\) is the bias matrix. The CNN architecture for the proposed model is described below in Table 1. The pooling layer performs downsampling by adjusting the filter on the input data and selecting the maximum or average value within the sliding window. The activation function used in this model is rectified linear unit (ReLU), which is defined as:  
\[f\left(x\right)=\left\{ \begin{array}{cc}\max\left(0,x\right),&x\geq 0\\ 0,&x<0\end{array} \right. \tag{4}\] \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Layer Types** & **No. of Filters** & **Kermal Size** & **Output Shape** & **Activation Function** \\ \hline \multirow{8}{*}{CNN} & input\_layer (Input Layer) & - & - & - & - \\ \cline{2-5}  & Conv2D (block1\_conv1) & 32 & 3 \(\times\) 3 & (654, 873, 32) & ReLU \\ \cline{2-5}  & MaxPooling2D (block1\_pool) & - & 2 \(\times\) 2 & (327, 436, 32) & - \\ \cline{2-5}  & Conv2D (block2\_conv1) & 64 & 3 \(\times\) 3 & (325, 434, 64) & ReLU \\ \cline{2-5}  & MaxPooling2D (block2\_pool) & - & 2 \(\times\) 2 & (162, 217, 64) & - \\ \cline{2-5}  & Conv2D (block3\_conv1) & 128 & 3 \(\times\) 3 & (160, 215, 128) & ReLU \\ \cline{2-5}  & MaxPooling2D (block3\_pool) & - & 2 \(\times\) 2 & (80, 107, 128) & - \\ \cline{2-5}  & Flatten & - & - & (1,095,680) & - \\ \hline \multirow{2}{*}{LSTM} & Input Layer & - & - & (1, 1,095,680) & - \\ \cline{2-5}  & lstm & 64 & - & 64 & tanh \\ \hline \hline \end{tabular}
\end{table} 
Table 1: CNN-LSTM hybrid model architecture for pipeline health identification. Figure 4: CNN architecture for the proposed model. The ReLU (rectified linear unit) activation function is applied to the output of each convolutional layer in a CNN. It is a non-linear function that allows all positive inputs to pass unchanged while mapping negative inputs to zero. This activation introduces essential non-linearity into the model, enabling it to learn complex patterns and relationships in the data. Additionally, ReLU helps to mitigate the vanishing gradient problem, a common issue with other activation functions like Sigmoid or Tanh, thereby improving the training efficiency and convergence speed of deep neural networks.