A metal corrosion degree calculation method based on a pixel clustering transformer model algorithm

By using the pixel clustering Transformer model algorithm and MATLAB GUI, fully automated calculation of metal corrosion degree is realized, which solves the problems of low efficiency and large error in corrosion degree calculation in industry, provides an easy-to-use visual interface, and improves the efficiency and accuracy of metal corrosion diagnosis.

CN115841471BActive Publication Date: 2026-03-27XIAN MODERN CHEM RES INST
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-06
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

The fully automated calculation of metal corrosion in existing technologies is difficult to achieve in industry. Manually annotating the corroded parts of metal cross-section images is inefficient and has large errors, which cannot meet the daily diagnostic needs of industry.

Method used

A fully automated metal corrosion calculation system was designed using a pixel clustering Transformer model algorithm combined with MATLAB's GUI visualization interface. The system uses the pixel clustering Transformer model for adaptive training and the k-means clustering algorithm to generate pseudo-labels, thereby enabling the automatic identification and calculation of the metal corrosion part and degree.

Benefits of technology

It achieves fully automated calculation of metal corrosion, reduces errors, improves industrial diagnostic efficiency, and provides an easy-to-use visual interface for quick and convenient analysis of metal corrosion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115841471B_ABST
    Figure CN115841471B_ABST
Patent Text Reader

Abstract

The application discloses a metal corrosion degree calculation method based on a pixel clustering Transformer model algorithm, generates pseudo labels by using a k-means clustering algorithm, and then performs self-adaptive training through a pixel clustering Transformer model; finally, the metal corrosion degree is obtained by inputting a metal cross-section image to be measured into the trained model, and the recognition result of a metal corrosion part and a metal corrosion degree is obtained. The application is used for detecting a metal corrosion part and calculating a metal corrosion degree, and compared with a traditional technology, can realize completely automatic processing after loading an image, can be more convenient for industrial related personnel to improve the efficiency in daily diagnosis of a metal corrosion condition, and greatly reduces errors.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a metal corrosion degree calculation method based on a pixel clustering Transformer model algorithm. BACKGROUND

[0002] Metal materials are damaged by the action of the surrounding medium, which is called metal corrosion. Rusting of metal is the most common form of corrosion. When corrosion occurs, a chemical or electrochemical multiphase reaction occurs at the interface of the metal, causing the metal to enter an oxidized (ionic) state. This significantly reduces the mechanical properties of the metal material, such as strength, plasticity, toughness, etc., destroys the geometric shape of the metal component, increases the wear between parts, deteriorates the physical properties such as electrical and optical properties, shortens the service life of the equipment, and even causes disastrous accidents such as fire and explosion. The corrosion rate refers to the weight loss of the metal material per unit area per unit time, or the thickness loss of the metal material per unit time. In practical applications, the main significance of corrosion mechanism, corrosion rate and cause analysis lies in estimating the service life of the component. Different corrosion processes depend on the type of corrosion layer and can be roughly divided into protective corrosion layers and non-protective corrosion layers. At present, the full-automatic calculation of the metal corrosion degree is a difficult problem in the industry.

[0003] Machine learning is increasingly being applied to emerging industrial fields, with a large amount of resources available to integrate computer science and statistical information into industrial problems. Supporters of machine learning praise its ability to handle large, complex and different data, and believe that machine learning is the future of industrial research, personalized industry and computer-aided industry, which can significantly promote the development of global industrial level. The concept of machine learning is not unfamiliar to many industrial professionals, and using machine learning as a research tool also has untapped potential.

[0004] Each image of the metal cross-section has a significant difference in image color or light intensity, and since industrial personnel have a large amount of daily work to do, it is not feasible for industrial personnel to manually annotate the corrosion part in the metal cross-section and then calculate the corrosion area and corrosion ratio of each image of the metal cross-section. Therefore, it is urgent to apply unsupervised algorithms in machine learning to metal corrosion degree calculation to realize the cross between the industry and computer science. SUMMARY

[0005] In view of the deficiencies in the prior art, the purpose of the present application is to provide a metal corrosion degree calculation method based on a pixel clustering Transformer model algorithm, design and implement a full-automatic metal corrosion degree calculation system, and realize an automatic metal cross-section corrosion area and corrosion ratio system through the GUI visualization interface of App designer in MATLAB; it can more conveniently improve the efficiency of industrial personnel in daily diagnosis of metal corrosion conditions, and greatly reduce errors.

[0006] To solve the above technical problems, the present application adopts the following technical solutions to achieve it:

[0007] A metal corrosion degree calculation method based on a pixel clustering Transformer model algorithm, comprising the following steps:

[0008] Step 1, data input and preprocessing:

[0009] Input the metal cross-section image sample, use the full-automatic recognition circular area function in MATLAB to find the metal whole part in the metal cross-section image, then get the RGB three-channel pixel value of the metal whole part; find the clean metal area in the metal standard image, denoise the area by median filtering, then get the average RGB three-channel pixel value of the whole pixel as the standard metal chroma pixel; the metal standard image refers to the metal cross-section image sample without corrosion in the same batch input;

[0010] Step 2, divide the metal corrosion part and the metal corrosion degree:

[0011] Step 2.1, divide the metal corrosion part:

[0012] Subtract the RGB three-channel pixel value of the metal whole part obtained in step 1 from the standard metal chroma pixel, and the negative value part is the metal corrosion part; denoising the metal corrosion part, and using MATLAB to visually output the denoised metal corrosion part;

[0013] Step 2.2, divide the metal corrosion degree:

[0014] The metal integral part obtained in step 1 and the metal corrosion part obtained in step 2.1 are overlapped, and then the RGB pixel value of the image of the overlapped metal corrosion part is converted into a gray image, and the RGB pixel value of the remaining part is all set to 255; the metal integral part is clustered using a k-Means clustering algorithm with k=3 to obtain three categories with different metal corrosion degrees, the first category is a non-corrosion area, the second category is a suspected shallow corrosion area, and the third category is a suspected deep corrosion area; then the second category suspected shallow corrosion area and the third category suspected deep corrosion area are accurately divided into non-corrosion areas, shallow corrosion areas and deep corrosion areas by comparing the gray values;

[0015] Step 3, full-automatic identification:

[0016] The clustering results of different metal corrosion degrees obtained in step 2 are used as pseudo-labels, and the original metal cross-section image and the pseudo-labels are input into a pixel clustering Transformer model algorithm for training, and the trained model parameters are saved; the metal cross-section image to be detected is input into the trained model, and finally the metal corrosion part and the identification result of the metal corrosion degree are obtained, the pixel number of the metal integral part is calculated using the area calculation function of MATLAB, then each position in the metal integral part is traversed, the pixel number of the metal corrosion part is calculated, and the metal corrosion degree is calculated using the following formula:

[0017]

[0018] The application also includes the following technical features:

[0019] Specifically, in step 2.2, if the gray value of the clustering center of the second category suspected shallow corrosion area is greater than 200, the suspected shallow corrosion area is divided into a non-corrosion area; if the gray value of the clustering center of the second category suspected shallow corrosion area is less than 200, the suspected shallow corrosion area is divided into a shallow corrosion area; and if the gray value of the clustering center of the third category suspected deep corrosion area is less than 200, the suspected deep corrosion area is divided into a deep corrosion area.

[0020] Compared with the prior art, the application has the following technical effects:

[0021] The application applies an automatic metal corrosion degree calculation method based on a pixel clustering Transformer model algorithm of weakly supervised learning, which is used for detecting a metal corrosion part and calculating a metal corrosion degree, and compared with traditional technologies, can realize complete automatic processing after loading an image; the detection of the metal corrosion part and the calculation of the metal corrosion degree are obtained through a visual method in MATLAB App Designer.

[0022] The application uses weakly supervised learning in artificial intelligence, generates pseudo labels by using a k-means clustering algorithm, and then performs adaptive training through a pixel clustering Transformer model, so that the method can quickly and effectively make accurate clustering division for a large number of metal corrosion images. The GUI visualization interface of App designer in MATLAB realizes a full-automatic calculation system of metal corrosion degree. An image of a detection area is automatically generated by one-click editing, and the corrosion degree of the metal cross-section image processed automatically is divided. Industrial practitioners can also select a screenshot according to the results analyzed by the software combined with their own needs, which is convenient, fast and easy to use. BRIEF DESCRIPTION OF DRAWINGS

[0023] Figure 1 Flow chart for dividing metal corrosion part of the application;

[0024] Figure 2 Flow chart for dividing metal corrosion degree of the application;

[0025] Figure 3 Flow chart for full-automatic identification of the application. DETAILED DESCRIPTION

[0026] The following gives a specific embodiment of the application, and it should be noted that the application is not limited to the following specific embodiments, and any equivalent transformation based on the technical solutions of the application falls within the protection scope of the application.

[0027] Example 1:

[0028] The embodiment provides a metal corrosion degree calculation method based on a pixel clustering Transformer model algorithm, including the following steps:

[0029] Step 1, data input and preprocessing:

[0030] Input the metal cross-section image sample, find the metal whole part in the metal cross-section image by using the full-automatic recognition circular area function in MATLAB, then obtain the RGB three-channel pixel value of the metal whole part; find the clean metal area in the metal standard image, perform median filtering denoising on the area, then obtain the average RGB three-channel pixel value of the whole pixel as the standard metal chroma pixel; the metal standard image refers to the metal cross-section image sample without corrosion in the same batch of input metal cross-section image sample;

[0031] Step 2, divide metal corrosion part and metal corrosion degree:

[0032] Step 2.1, divide metal corrosion part (Task1):

[0033] For example,Figure 1 As shown, the RGB three-channel pixel values ​​of the overall metal part obtained in step 1 are subtracted from the standard metal color pixels, and the negative value part is the metal corrosion part; the metal corrosion part is denoised by a combination of erosion, dilation, opening and closing operations to prevent the influence of outliers, and the denoised metal corrosion part is visualized using MATLAB.

[0034] Step 2.2, classify the degree of metal corrosion (Task 2):

[0035] like Figure 2 As shown, the overall metal part obtained in step 1 and the metal corrosion part obtained in step 2.1 are overlapped. Then, the RGB pixel values ​​of the overlapping metal corrosion part image (overlapping part) are converted into grayscale images, and the RGB pixel values ​​of the remaining parts (uncorroded parts) are all set to 255. The overall metal part is clustered using the k-Means clustering algorithm with k=3 to obtain three categories with different degrees of metal corrosion: the first category is the uncorroded area, the second category is the suspected shallow corrosion area, and the third category is the suspected deep corrosion area. Then, by comparing the grayscale values, the second category of suspected shallow corrosion area and the third category of suspected deep corrosion area are accurately divided into uncorroded area, shallow corrosion area, and deep corrosion area.

[0036] If the gray value of the cluster center of the second type of suspected shallow corrosion area is greater than 200, it means that the gray value is basically the same as the background, and the suspected shallow corrosion area is classified as a non-corrosion area; if the gray value of the cluster center of the second type of suspected shallow corrosion area is less than 200, the suspected shallow corrosion area is classified as a shallow corrosion area; if the gray value of the cluster center of the third type of suspected deep corrosion area is less than 200, the suspected deep corrosion area is classified as a deep corrosion area.

[0037] Step 3: Fully Automatic Recognition (Task 3):

[0038] like Figure 3 As shown, the clustering results of different metal corrosion degrees obtained in step 2 are used as pseudo-labels. The original metal cross-section image and pseudo-labels are input into the pixel clustering Transformer model for training, and the trained model parameters are saved. The metal cross-section image to be tested is input into the trained model to finally obtain the identification results of the metal corrosion part and the degree of metal corrosion. The area function of the region built into MATLAB is used to calculate the number of pixels (area) of the whole metal part. Then, the number of pixels (area) of the metal corrosion part is calculated by traversing each position within the whole metal part. The degree of metal corrosion is calculated using the following formula:

[0039]

[0040] The pixel clustering Transformer model is mainly based on the ideas of clustering and Transformer. Firstly, the Resnet-50 model is used as a feedforward neural network to extract 2048-dimensional features. Then, the method of skip connection is used for upsampling operation, and the kMax Decoder module is added between each layer of skip connection to extract semantic information. The kMax Decoder module is based on the multi-head attention idea in the Transformer Decoder, and the clustering centers of each category are used as the original input. The features of each skip connection layer are updated, and finally the clustering centers of each category are obtained as semantic labels. The image is input into the network for training, and the trained model parameters are saved. Finally, the test image to be detected is input into the saved model, and the recognition result is obtained. The metal corrosion ratio is calculated according to the metal corrosion degree calculation formula.

Claims

1.A metal corrosion degree calculation method based on a pixel clustering Transformer model algorithm, characterized in that, The method comprises the following steps: Step 1, data input and preprocessing: Input the metal cross-section image sample, find the whole metal part in the metal cross-section image using the full-automatic recognition circular area function in MATLAB, and then obtain the RGB three-channel pixel value of the whole metal part; Find the clean metal area in the metal standard image, perform median filtering denoising on the area, and then obtain the average RGB three-channel pixel value of the whole pixel as the standard metal chroma pixel; The metal standard image refers to the metal cross-section image sample in the same batch without corrosion; Step 2, divide the metal corrosion part and the metal corrosion degree: Step 2.1, divide the metal corrosion part: Subtract the RGB three-channel pixel value of the whole metal part obtained in step 1 from the standard metal chroma pixel, and the negative value part is the metal corrosion part; perform denoising processing on the metal corrosion part, and use MATLAB to visually output the denoised metal corrosion part; Step 2.2, divide the metal corrosion degree: Overlap the whole metal part obtained in step 1 and the metal corrosion part obtained in step 2.1, then convert the RGB pixel value of the overlapped metal corrosion part image into a gray-scale image, and set the RGB pixel value of the remaining part to 255; use k-Means clustering algorithm with k=3 to cluster the whole metal part, and obtain three categories with different metal corrosion degrees, the first category is the non-corrosion area, the second category is the suspected shallow corrosion area, and the third category is the suspected deep corrosion area; Then, the second category of suspected shallow corrosion area and the third category of suspected deep corrosion area are accurately divided into non-corrosion area, shallow corrosion area and deep corrosion area by comparing the gray-scale values; Step 3, full-automatic recognition: The clustering results of different metal corrosion degrees obtained in step 2 are used as pseudo-labels, the original metal cross-section image and the pseudo-labels are input into the pixel clustering Transformer model algorithm for training, and the trained model parameters are saved; the metal cross-section image to be tested is input into the trained model, and finally the recognition results of the metal corrosion part and the metal corrosion degree are obtained, the pixel number of the whole metal part is calculated using the area calculation function of MATLAB, then each position in the whole metal part is traversed, the pixel number of the metal corrosion part is calculated, and the metal corrosion degree is calculated using the following formula: ; In step 2.2, if the gray-scale value of the clustering center of the second category of suspected shallow corrosion area is greater than 200, the suspected shallow corrosion area is divided into non-corrosion area; If the gray-scale value of the clustering center of the second category of suspected shallow corrosion area is less than 200, the suspected shallow corrosion area is divided into shallow corrosion area; if the gray-scale value of the clustering center of the third category of suspected deep corrosion area is less than 200, the suspected deep corrosion area is divided into deep corrosion area.

Citation Information

Patent Citations

  • Metal plate corrosion degree judgment method and system based on machine vision

    CN113706531A

  • Metal corrosion grade evaluation method based on image processing

    CN114708623A

  • In-situ identification method and device for metal matrix corrosion and coating aging

    CN114757945A