Application of Convolutional Neural Network (CNN) Method in Fluctuations Pattern

: In the acquisition of amplitude data, the inaccuracy of a signal with the occurrence of an unstable peak value of the amplitude in the data is called a fluctuation. This study uses High-High Fluctuation (HHF) signal data from the acquisition of Multi-Spectral Capacitive Sensors (MSCS) with Hydrogen Dioxide (H 2 O) and Hydrogen Dioxide (H 2 O) objects mixed with Sodium Hydroxide (NaOH) that have been organized into a matrix form. The data acquisition results in previous studies have several parts that are difficult to distinguish with the naked eye. The method used in this study applies the CNN method for image recognition of signal fluctuations of type HHF from H2O and H2O mixed with NaOH, using the architecture known as AlexNet. Then, the H2O and H2O data groups mixed with NaOH were grouped into training data groups of 280 image data for each data type, and 70 image data for test data for both groups. During the training stage, the number of epochs used is 20. However, by the time the number of epochs reaches 15, the accuracy rate is already high, reaching 98%. Furthermore, at the testing stage, the CNN program can correctly recognize the entire 70 image data for both materials, achieving perfect recognition for the total amount of the two materials.


Introduction
In the process of computer image processing, there is often a condition of signal inaccuracy and a state of rise and fall of the peak amplitude value during data acquisition; this is referred to as fluctuation. The acquisition process causes the acquired data to mix with noise and produce fluctuations, making these fluctuations very complex [1]. Generally, the acquisition process uses a large amount of data, so recognizing the information in the data requires a lot of work. Therefore, an analysis is needed to process signal fluctuations and produce fluctuation results from the data [2][3][4].
In recent years, fluctuation signal processing methods have been widely developed. Processing signal fluctuations is quite difficult to achieve satisfactory results using ordinary methods. The analysis method for processing multi-spectral fluctuation signals in previous studies involves using Wavelet and Fourier transforms [1]. This research shows that the information content is important to reflect the state of a material, and the material has a nonstationary nature. Therefore, fluctuation is an inevitable event [1,4].
This study uses data obtained from previous research, namely pure water (H2O) and pure water materials mixed with alkaline solutions (H2O mixed with NaOH); the data will be represented not in the form of images but in the form of 2D matrices with pixel size [650 x 420] [5]. The fluctuation pattern of the material is generated from the acquisition process of a multi-spectral capacitive sensor (MSCS) [6]. Then, three different fluctuation patterns are obtained, namely Mean Fluctuation (MF), High Fluctuation (HF), and High-High Fluctuation (HHF) [7,8]. This study focuses on the HHF fluctuation pattern because it produces the most contrasting pattern based on the signal amplitude.
The application of the CNN method contributes to obtaining a method of processing fluctuation pattern data by classifying H2O fluctuation pattern matrix data and H2O mixed with NaOH, which has been converted into image form. In the CNN method, the main purpose of convolution and subsampling operations is to extract features from raw input data. The convolution operation involves the multiplication of a small kernel matrix and a certain area of the two-dimensional matrix input [9]. The reason for choosing the CNN method is that there has been no previous research proposing this method to observe the similarity of the fluctuation pattern matrix data; the classification is not so clear between H2O and H2O mixed with NaOH because the fluctuation patterns of the two materials cannot be distinguished by the naked eye or at first glance, as they are almost the same. Therefore, using the CNN method is expected to enable the computer to distinguish the two fluctuation patterns. Previous research using one convolution layer resulted in a higher accuracy value (81.5%) compared to using 2 convolution layers (70.7%) [10]. Additionally, previous research using 7 convolution layers for face recognition resulted in an accuracy rate of 99.6% [11].
Each process in the CNN method involves several layers, such as a convolution layer, a pooling layer to increase the position variance of a feature, a fully connected layer to connect the neurons before and after, and a dropout layer to speed up the learning process. These steps allow the algorithm to recognize the characteristics of the material based on its fluctuation pattern with a high level of accuracy [12−15]. Determining the CNN architecture and the number of epochs affect accuracy. In previous research, the MF, HF, and HHF data patterns from H2O and H2O mixed with NaOH were challenging to identify directly, so using the CNN method can facilitate the identification process of the two materials. The benefit of this research in the future was that it could recognize signal fluctuation patterns by processing signals using image processing on a material with a CNN method that utilized spectral-based material.

Materials and Methods
The problem-solving approach in this study is to apply the stages as shown in Figure 1, as follows: fluctuation pattern data preparation, modeling (preprocessing and classification), evaluation and measurement of system performance (accuracy, precision, recall, F-score).

Materials.
This research takes the data used in previous studies, chemical data from fluctuations using MSCS [1−4]. In this study, the matrix data type of the HHF fluctuation pattern image totaling 350 data was used; for H2O material (data A), 175 images were used, and for H2O mixed with NaOH material (data B), 175 images are used as shown in Figure 2, which is a sample of the two materials. This study uses a computer device with specifications sufficient to run the classification process (Table 1).  In image processing, a cropping process was needed to get certain parts needed to facilitate the next process. If the cropping stage was not done, then the computer analyzed all objects in the image [16].

Augmentation.
The purpose of augmentation was to enable the system to recognize the basic variances in the object image that would be processed in the subsequent stage. Additionally, there exist Preparation of fluctuation pattern data Modeling Evaluation Performance measures; accuracy, precision, recall, fscore translational data and reflection data, which form integral parts of the augmentation process. Translational data represents the original data shifted in a straight line, while reflection data comprises reflections or mirror images of the original data [17].

Convolutional Neural Network (CNN).
The Convolutional Neural Network (CNN) constitutes a feature extraction and classification technique. Yann Lecun was the pioneer who introduced CNN in 1988. CNN stands as one of the methods that have paved the way for the development of Deep Learning. In terms of image classification, CNN processes an input image prior to classifying it into a specific category [18]. CNN is a development of Multilayer Perceptron (MLP) intended to process twodimensional data [13]. Convolutional neural networks aim to process data that possess a network shape, such as topology. The CNN stages can be observed in Figure 3.

Convolution layer.
In this layer, the filter size is considered the most significant factor in CNN, each layer has a different filter size. In image processing, convolution can be defined as applying a kernel to an image at all possible offsets. The weights in the layer specify the convolution kernel used so that the kernel can be trained based on the input given to the CNN [19].

Fully connected layer.
The fully connected layer connects the neurons generated in the previous layer and the neurons generated in the next layer [20]. Fully connected layers can improve the performance of CNN models and can reduce the time needed to choose between different architectures, such as deeper and shallower layers.

Pooling layer.
The pooling layer serves to reduce or reduce the number of parameters by using down-sampling operations to improve the positional invariance of a feature [13]. Based on Figure 4, the feature map obtains convolution results using a type of max pooling operation with a smaller size, namely a 2x2 matrix size [20].

Dropout.
The purpose of augmentation is so that the system can recognize the basic variance in the object image that will be processed to the next stage. In addition, there are translational data and reflection data, which are part of the augmentation process ( Figure 5). Translational data is the original data shifted in a straight line, while reflection data is a reflection or reflection of the original data [17].

Accuration.
By considering recall and specificity simultaneously [23]. The results are analyzed by calculating the accuracy, recall, precision, and F-score values from Equation (1) to Equation (4) [24].

Program Implementation.
This section describes the application of the CNN method before and after the training and testing processes on data sets A and B, as shown in Figure 2. The data obtained from previous research was converted from the .bat extension to .txt and entered into Excel with a matrix of 31 x 8192. Then, a program simulation was carried out using MATLAB to produce fluctuation graphs of data groups A and B as images. For the training and testing processes, the program simulation used PYTHON for both groups of materials. If the accuracy level in the training process was not as expected, the number of epochs was increased, and if the accuracy level was as expected, then the testing stage proceeded. Based on Figure 6, the initial stage of this study was to obtain images of the signal fluctuation pattern using Matlab programming. Furthermore, the images underwent a preprocessing stage using Python programming. After experiencing the pre-processing stage, the A and B data that had been grouped underwent the training stage using Python programming. Furthermore, the last stage, the testing stage in this study, also used Python programming to support the implementation of the expected program. It required software and hardware specifications that could run the program.

Pre-pocessing results of H2O and H2O material data mixed with NaOH.
In the pre-processing section, the results of image changes on both research materials, namely data A and data B, were obtained by changing color, scale, and cropping using the PYTHON programming language installed on the Windows 10 operating system. The input of data A and data B was an image with a pixel size of 560 x 420 per unit image before undergoing preprocessing. In this pre-processing stage, the original image went through a down-sampling process so that the image changed to a smaller pixel size into a matrix with dimensions of 100 x 100. Then, the matrix was plotted into an image using the matplotlib library. This process was done so that the image could be easily recognized in the subsequent training and testing stages. The results before and after the pre-processing stage can be seen in Table 2, which consists of data images A and B in the order of 141 and 142. It can be observed that the image, after pre-processing, had its pixel size reduced, and the color change occurred due to the use of the matplotlib library in the Python program. Among all the images obtained through the pre-processing stage, there was no significant difference when viewed directly.

Architecture determination result.
The CNN architecture used in this study is a modified AlexNet, for more details can be seen in Table 3. Based on Table 3, it is evident that the data underwent two convolutions using the Re-Lu activation function. Additionally, the max-pooling technique was utilized to determine the value of the new matrix for processing in the subsequent stage. Afterward, the data was processed in the fully connected layer. The flattening technique was applied to convert the multi-dimensional matrix measuring 23x23x32 into a one-dimensional matrix measuring 16,928. Subsequently, the 16,928 matrices were transformed into a size of 128 using the Re-Lu activation function. Further, the 128-sized matrix was converted into a 2-sized matrix using the softmax activation function. In this system, the dropout technique was also employed to randomly select and eliminate neurons, thereby preventing overfitting and expediting the learning process. Throughout the learning process, the total parameters or weights amounted to 2,177,314.

Training results and dataset validation.
After the pre-processing stage, data A and B were subjected to the training and validation stage. At this stage, the two materials were divided into two groups: test data and training data. The training data was further divided into two groups, namely the training group and the validation data group, each containing 224 images from each material, resulting in a total of 112 images. The validation group consisted of 56 images from each material, with a total of 28 images for each material. During the training and validation of datasets from data materials A and B, the relationship between epochs and the accuracy and loss of the CNN model was analyzed, as depicted in Figure 7. In Figure 7(a), the training accuracy graph (blue) showed that at 14 epochs, the accuracy level during the training process was very high, reaching an accuracy value close to 100%. Meanwhile, the accuracy validation graph (red) indicated that it took 13 epochs to achieve an accuracy value of 98%. Based on the obtained graphs, it was evident that the higher the number of epochs used during the training and validation of the CNN model, the higher the accuracy level. Similarly, in Figure 7(b), the training loss graph (blue) demonstrated that at 15 epochs, the loss rate during the training process was remarkably low, with a loss value below 10%. On the other hand, the loss validation graph (red) revealed that it took 15 epochs to reach a loss value below 10%. Based on these graphs, it was evident that the more epochs used during the training and validation of the CNN model, the lower the resulting error rate would be. The validation results of data A and B are shown in Figure 8.  Based on Figure 8, the validation results of the H2O and H2O mixed with NaOH materials indicated that the image was divided into 4 parts, and then further divided into two groups of parts. The black part represents the portion of error or loss at the validation stage for data A and B. It can be observed from the image that neither of the two materials experienced errors in recognition during the validation stage. The soft pink group represents the data group that correctly recognized the two materials at the validation stage. From the image, it can be seen that a total of 28 images for data A and all 28 images for data B were correctly recognized during the validation stage. The recognition rate of the two materials was correct at the validation stage, with no errors in their recognition.

Testing result.
During the testing stage, a total of 70 image data were used, with each material having 35 image samples. The testing process resulted in an accuracy rate of 100% for both materials. Each of the 35 test images for data A and B was correctly recognized. Table 4 displays the test results for data A and B from 2 sample images used for each data. It can be observed that both data A and B had a total of 35 test images each, and both achieved an accuracy rate of 100%.  Table 4, the test results of H2O and H2O mixed with NaOH demonstrated that the image was divided into 4 parts and further categorized into two groups of parts. The black part represents the portion of error or loss at the testing stage for data A and B. It can be observed from the image that neither of the two materials experienced errors in recognition during the testing phase. The soft pink group represents the data group that correctly recognized the two materials during the testing stage. It can be seen from the image that both data A and B had all 35 images correctly recognized during the testing stage. At this stage, the recognition rate of the two materials was correct, with no errors in their recognition.
Based on Figure 9, accuracy, recall, precision, and F-Score were calculated for data A and B using Equations 1 to 4. By applying 7 convolution layers from CNN, as in previous research [11], this study obtained test results with higher accuracy in detecting fluctuation patterns, as shown in Table 5. The program successfully recognized data A and B correctly as a whole, as evidenced by the accuracy, recall, precision, and F-Score values, all reaching 100%.

Conclusions
The image of the signal fluctuation pattern of H2O and H2O mixed with NaOH could be recognized using the CNN architecture developed in this study, achieving an accuracy rate of 100%. At first glance, distinguishing the fluctuation pattern images of the two materials with the naked eye seemed challenging, making this CNN method even more significant in demonstrating its ability to recognize the images accurately. The research yielded CNN evaluation parameters, including accuracy, precision, recall, and F-Score, all reaching 100%. These exceptional results were obtained because both H2O and H2O mixed with NaOH test data were recognized correctly. The model was trained for 20 epochs; however, the level of accuracy significantly increased after just 15 epochs. For future work, this study could expand the application of the CNN method to identify other materials, such as H2O mixed with HCl or images of fluctuation patterns of various other materials. Additionally, the quality of materials could be assessed using the Peak Signal to Noise Ratio (PSNR) as a measure. This extension would contribute to enhancing the potential applications and usefulness of the CNN-based approach in material identification and quality evaluation.