Research on the internal defect detection algorithm of pre-baked anode based on machine learning

. To improve the quality of the pre-baked anode products, it is necessary to check the internal cracks of the pre-baked anode. The developed automatic knocking device is used to determine whether there are cracks in the pre-baked anode by using the obtained sound signal of the pre-baked anode knocking and machine learning. In this paper, first, the Fast Fourier Transform (FFT) is used to transform the sound signal to obtain 10 features in the frequency domain. Then, the main features of the pre-baked anode are obtained by principal component analysis (PCA). Next, the binary classification of support vector machine (SVM) is used to determine whether the pre-baked anode contains cracks, and finally, satisfactory results are obtained.


Introduction
Pre-baked anode is the anode material for the electrolytic production of aluminum. Its internal cracks are easy to cause the carbon block to drop slag and block on the electrolytic cell, affecting the normal operation of the electrolytic cell, and seriously affecting the quality of aluminum products [1]. Due to the complexity of the pre-baked anode production process and raw materials, it is currently impossible to eliminate defects by improving the carbon block production process [2]. Therefore, it is necessary to improve the inspection technology of defective carbon blocks. At present, whether there is an internal crack is judged by the manual hammering method, which depends on the work experience of inspectors and has low detection efficiency. The location and quantification of internal cracks have high requirements on the working ability of inspectors, and the cost of training this type of quality inspection personnel is very high. Therefore, using nondestructive testing technology to locate and quantify the internal cracks of carbon blocks and standardize the quality management of carbon blocks are urgent problems to be solved.
At present, there is little research on nondestructive testing of pre-baked anode at home and abroad. In literature [3], X-ray is used to automatically detect the internal defects of the cathode carbon block. However, the X-ray environment is not friendly and is not suitable for factory application and promotion. In literature [4], impact-echo technology was used to evaluate the cathode quality of aluminum electrolytic cells, and whether there were cracks was determined according to the reflection time difference of the stress wave. This method is only suitable for small-size anodes. Compared with several common internal nondestructive testing methods, the acoustic vibration method is low-cost, high-efficient, and convenient to use. Many scholars at home and abroad have used it for internal damage detection. Literature [5] extracted the central modal frequency feature and input it into the support vector machine to identify qualified samples and defect samples through the variational modal decomposition of the acoustic and vibration signals of the magnetic bearing. Quantitative damage location detection was not conducted. Literature [6] proposed a damage location method based on the neural network. It can evaluate the damage situation, but the input characteristics of this method are only based on natural frequency, and the relative error is large. Literature [7] proposed to quantify the damage degree by the square ratio of the first order natural frequency change of the blade, and completed the identification of the crack damage degree, without locating the damage location. Document [8] proposed a method of blade damage location detection and damage degree estimation based on the modal frequency and modal shape difference curvature, but it is not easy to detect the pre-baked anode modal shape.
Principal component analysis (PCA) is used to reduce data dimension and extract main features, which can prevent over-fitting [9]. Support vector regression (SVR) refers to the use of the support vector machine (SVM) in regression issues, mainly used to address small sample and nonlinear problems [10]. Therefore, the above algorithm is used in this paper for data processing to study the internal defect detection algorithm of pre-baked anode. The knocking acoustic vibration method is used to extract the frequency domain characteristics by analyzing the acoustic vibration signal of the pre-baked anode in the frequency domain. PCA compresses the main frequency and amplitude characteristics of the spectrum, and SVR classifies the pre-baked anode to realize the quality detection of the pre-baked anode.

Detection principle of the pre-baked anode hammering method
As shown in Figure 1, the pre-baked anode is a 1630*800*500 rectangular body, which can be regarded as an elastic body of the continuous medium, with multiple vibration modes. After being hammered, its sound signal is the combination of its modal vibration at all levels. When there is a crack inside, its modal frequency will change, and its vibration mode will also change, so the combination law of the modal vibration at all levels contained in its sound signal is also different. As a result, the human ear will feel different after hearing. Therefore, the pre-baked anode with cracks can be detected by analyzing the sound signal and extracting features.

Sound signal acquisition
Using the developed automatic hammering device, as shown in Figure 2, the specially developed electronic stethoscope is used for hammering the pre-baked anode at the designated station on the production line to collect the sound signal. The electronic stethoscope is attached to the pre-baked anode to pick up the sound signal, thus effectively shielding the workshop noise.  The first step is the determination of the crack sound characteristics. The audio signal is intercepted with a fixed length of 6000. Since only the signal within 3000HZ is analyzed, a new sampling frequency of 6000HZ is taken as the sampling frequency. As shown in Figure 3, the audio signal with a sampling frequency of 6000HZ is taken. The signal is a pulse response signal. Because it is a time domain signal, and its characteristics are not obvious. In this paper, 84 pre-baked anodes were hammered to obtain their audio signals, including 49 qualified pre-baked anodes and 35 internally cracked pre-baked anodes. The second step is FFT transformation. The Fourier transform length is 6000, so the frequency resolution is 1HZ. Figure 4 is the Fourier transform diagram of the audio signal. It demonstrates that the signal contains various frequency components, and its amplitude is different. Because cracks in the material will cause its mode to change, frequency and amplitude are important characteristics to judge whether there are cracks.  Considering that different hammering forces may lead to different responses, the proportion of amplitude height in the total frequency domain energy is used as the feature. Finally, the proportion of energy at each frequency and its frequency are obtained, a total of 10 features.

PCA analysis.
The amplitude and frequency characteristics of the sound spectrum signal of the pre-baked anode are reduced to dimension. The most commonly used linear dimensionality reduction technique is PCA dimensionality reduction. In order to achieve fewer data dimensions while keeping the features of more original data points, it aims to map high-dimensional data into low-dimensional space using a linear projection and expects the most amount of data on the projected dimension, i.e., the largest variance. A total of 84 amplitude and frequency samples and 840 features of audio signals were obtained in the study, which were analyzed as follows: First, calculating the sample mean: Where is the sample, is the number of samples. Second, calculating the sample variance: Third, calculating the sample and the sample covariance: Fourth is the singular value decomposition of the covariance matrix. In PCA, it is necessary to find the eigenvalues of the covariance matrix λ compared with the eigenvector V. If the matrix is large, it will consume too much memory. The eigenvalues can be obtained by singular value decomposition without the covariance matrix λ and the eigenvector V.
Finally, obtaining the contribution rate. The initial definition of obtaining the contribution rate is the ratio of the variance of the extracted principal component to the total variance of the original variable. The cumulative contribution rate is used to select the appropriate number of principal components. For example, when the value of principal components makes the cumulative contribution rate reach more than 85%, it can be considered as a relatively appropriate number of principal components.  demonstrates the cumulative contribution rate obtained in this study. As shown in Figure 5, the cumulative contribution rate of the first four features is 87%. Therefore, in this study, four features were selected as final features according to the contribution rate after feature compression with PCA. Figure 5. The cumulative contribution rate.

SVM analysis. Support vector machines (SVM) is a two-class model. Its basic model is a linear
classifier with the largest interval defined in the feature space. SVM also includes kernel techniques, which makes it a nonlinear classifier in essence. The detection of cracks in the pre-baked anode is a twoclass problem. The SVM model was used to train the training set, and a hyperplane was obtained as the dividing line between the defective parts and the qualified parts as the boundary between defective parts and qualified parts, and -1 and 1 are used as labels to represent defective parts and qualified parts respectively. In this paper, 30 qualified pre-baked anodes and 30 cracked pre-baked anodes are used as training data sets for classification training, and the remaining 24 are test sets for testing.

Conclusion
In this paper, the detection algorithm of internal defects in pre-baked anode was studied. The sound signal was transformed by FFT to obtain 10 features in the frequency domain. Then principal component analysis (PCA) was used to obtain the main features of the pre-baked anode, and support vector machine (SVM) binary classification was used to determine whether the pre-baked anode contained cracks. Finally, satisfactory results were obtained. After this technology becomes mature, it can be widely used in the quality detection of the pre-baked anode. For future studies, the algorithm can be further improved and the technology can be applied in more aspects, such as the crack detection of large mechanical parts and the crack investigation in the pipeline inside the building to obtain the precise shape and location of the cracks.