Contact rusting image recognition method and system

Through image recognition method, using YOLO algorithm and feature index calculation, the problems of inefficiency and inaccuracy of traditional detection methods are solved, and efficient and accurate contact corrosion detection is achieved to ensure equipment safety.

CN119295735AActive Publication Date: 2025-01-10HENAN XINFENG NEW MATERIALS CO LTD

Patent Information

Application Number
CN202411403106.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-01-10
Estimated Expiration
2044-10-09

AI Technical Summary

Technical Problem

The existing contact corrosion detection methods are inefficient and inaccurate. Especially in corrosive environments, traditional artificial visual inspections are easily affected by human factors and it is difficult to ensure the consistency and accuracy of the detection results.

Method used

The image recognition method is used to obtain the contact image to be detected for pre-processing, and the suspected rust area is selected using the YOLO algorithm box, and the surface fading index and the comprehensive rust feature index are calculated to determine whether there is rust. The specific steps include clustering pixel points, calculating the Euclidean distance and average gradient, forming roundness, and calculating the final comprehensive rust feature index based on texture features fusion.

Benefits of technology

It improves the efficiency and accuracy of contact corrosion detection, can quickly identify the rust area, reduce misjudgment, enhances the reliability and consistency of the inspection, and ensures the safe and reliable operation of the equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295735A_ABST
    Figure CN119295735A_ABST
Patent Text Reader

Abstract

The invention discloses an image recognition method and system for contact corrosion, and the method comprises the following operation steps: obtaining a to-be-detected contact image, and carrying out the preprocessing of the to-be-detected contact image, and obtaining a contact gray image; acquiring a defect area of the contact gray level image to obtain a plurality of suspected areas; clustering is carried out according to the brightness values of the pixel points in the suspected areas, and a rusted area is obtained; calculating a surface fading index according to the brightness value of each pixel point in the suspected area, and calculating a corrosion comprehensive characteristic index of the corrosion area according to the surface fading index; and judging whether corrosion exists in the corrosion area or not through the corrosion comprehensive characteristic index, and obtaining a final recognition result of the to-be-detected contact image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition, and in particular to a method and system for image recognition of contact corrosion. Background Art

[0002] In industrial production and equipment maintenance, the state of the contact directly affects the performance and safety of the equipment. During use, especially in corrosive environments, the contact is prone to rust. This not only affects the electrical performance of the contact, but may also cause equipment failure and safety hazards. Therefore, timely and accurate detection of contact corrosion has become an important task to ensure the normal operation of the equipment.

[0003] For example, during the use of electrical contacts, common corrosive media deposition corrosion is found: when corrosive media are deposited in certain areas of the metal surface, local corrosion may occur. These areas are usually circular or irregular in shape. For example, corrosive media generally include sulfides or organic acids, among which hydrogen sulfide (H2S) can react with metals to form sulfides, causing corrosion. Organic acids: such as acetic acid, citric acid, etc., can also promote metal corrosion under certain conditions.

[0004] Traditional contact corrosion detection methods mainly rely on manual visual inspection, which is not only inefficient but also easily affected by human factors, making it difficult to ensure the accuracy and consistency of the detection results. With the rapid development of computer vision and machine learning technology, automated detection methods based on image recognition have gradually become a research hotspot. However, existing image recognition methods still face many challenges in the field of contact corrosion detection.

[0005] Contact corrosion takes various forms, including different types of oxides such as rust and verdigris, and the degree of corrosion varies. However, our researchers have found that the degree of corrosion may range from slight surface oxidation to severe structural damage. Depending on the different types of oxides, these forms of corrosion vary in color, texture, and shape. At the same time, they are affected by the deposition corrosion phenomenon of corrosive media, and there is often a corresponding relationship between color, texture, and shape. Therefore, based on this phenomenon, the above-mentioned detection and evaluation of contact corrosion is complicated. Summary of the invention

[0006] Therefore, there is an urgent need for an efficient, accurate and adaptable contact corrosion image recognition method to solve the above problems, improve the efficiency and accuracy of contact corrosion detection, and ensure the safe and reliable operation of the equipment.

[0007] The purpose of the present invention is to provide a contact corrosion image recognition method and system to solve the above technical problems pointed out in the prior art.

[0008] The present invention provides an image recognition method for contact corrosion, comprising the following steps:

[0009] Acquire a contact image to be detected, pre-process the contact image to be detected to obtain a contact grayscale image; acquire a defect area from the contact grayscale image to obtain a plurality of suspected areas;

[0010] Clustering is performed according to the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas; calculating the surface fading index according to the brightness values ​​of the pixels inside the suspected areas, and calculating the comprehensive rust characteristic index of the rusted areas according to the surface fading index;

[0011] Whether there is rust inside the rust area is determined by the comprehensive rust characteristic index, and a final recognition result of the contact image to be detected is obtained.

[0012] Preferably, the defect area is acquired from the contact grayscale image to obtain a suspected area, and the specific operation steps are as follows:

[0013] Performing candidate frame selection on the contact grayscale image by using a YOLO algorithm to obtain multiple rust candidate frames;

[0014] Evaluate the confidence scores of all rust candidate frames, set the confidence score threshold a, and determine whether the confidence score of the rust candidate frame is greater than or equal to the confidence score threshold a;

[0015] If not, the rust candidate frame is determined to be a normal area;

[0016] If not, the rust candidate box is determined to be a suspected area.

[0017] Preferably, clustering is performed according to the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas, and the specific operation steps are as follows:

[0018] Calculate the brightness value of each pixel in the suspected area, sort the pixels in descending order according to their brightness values, and select the pixel with the highest brightness value as the first pixel;

[0019] If there are two or more pixels with the highest brightness value in each suspected area at the same time, a pixel with the highest brightness value is randomly selected as the first pixel point;

[0020] Calculate the Euclidean distance between the pixels in each suspected area, and preset the Euclidean distance threshold r; determine whether the Euclidean distance between the pixels is greater than the Euclidean distance threshold r;

[0021] If not, the Euclidean distances between pixels that exceed the Euclidean distance threshold r are excluded;

[0022] If so, the Euclidean distance between the pixels within the Euclidean distance threshold r is taken as the dense area and used as the second pixel;

[0023] Determine the coordinate position of the second pixel point, cluster the pixel points within a Euclidean distance threshold r of the second pixel point, and obtain a pixel point cluster;

[0024] It is determined whether a first pixel point exists in the pixel point cluster, and the pixel point cluster in which the first pixel point exists is used as a rust area.

[0025] Preferably, the surface fading index is calculated according to the brightness value of each pixel point inside the suspected area, and the specific operation steps are as follows:

[0026] Determine the coordinates of the first pixel point and the coordinates of all other pixel points in the rust area;

[0027] Calculating the distance between the coordinates of the first pixel point and the coordinates of all other pixel points, and obtaining an average distance;

[0028] The average distance calculation formula is:

[0029]

[0030] Where Q represents the average distance of the pixels inside the rusted area; 9i0, j0) represents the coordinates of the first pixel in the rusted area; (i a , j a ) represents the coordinates of the ath pixel in the rust area; v represents the total number of pixels in the rust area;

[0031] Find edge pixel points in the rusted area, calculate gradients for the edge pixel points, and calculate average gradients based on the gradients of the edge pixel points;

[0032] The average gradient calculation formula is:

[0033]

[0034] Where T represents the average gradient of edge pixels in the rust area; Y a It is expressed as the gradient of the ath edge pixel in the rust area;

[0035] Counting the number of pixels inside the rusted area, and calculating the area W of the rusted area according to the number of pixels;

[0036] The average distance between the first pixel and all other pixels, the average gradient of the edge pixels, and the area of ​​the rusted area are multiplied to obtain the surface fading index of the pixels in the rusted area;

[0037] The calculation formula for the surface fading index of the pixel points in the rust area is:

[0038] D = eR × T × W;

[0039] Where D is the surface fading index of the pixel points in the rusted area; R is the average distance of the pixel points inside the rusted area; T is the average gradient of the edge pixel points in the rusted area; W is the area of ​​the rusted area; and e is a natural constant.

[0040] Preferably, the comprehensive characteristic index of rust is calculated for the rusted area according to the surface fading index, and the specific operation steps are as follows:

[0041] Obtain the edgemost pixel point of the rusted area, determine the coordinate position of the edgemost pixel point, and obtain the circumscribed rectangle of the rusted area according to the coordinate position of the edgemost pixel point;

[0042] Determine the coordinates of the diagonal points of the circumscribed rectangle of the rusted area, connect the diagonal points, and use the intersection point as the third pixel point;

[0043] Calculate the distance between the third pixel point and all edge pixel points of the rusted area, find the pixel point with the maximum distance as the radius, form a circle, and calculate the roundness of the rusted area;

[0044] The roundness calculation formula of the rusted area is:

[0045]

[0046] Wherein, C represents the roundness of the circle of the rusted area; A represents the area of ​​the circle of the rusted area; and P represents the circumference of the circle of the rusted area.

[0047] The comprehensive characteristic index of rust is calculated according to the roundness and the surface fading index.

[0048] Preferably, the rust comprehensive characteristic index is calculated according to the roundness and the surface fading index, and the specific operation steps are as follows:

[0049] Convert the rusted area into HSL color space and calculate the standardized value of the surface fading index;

[0050] The standardized surface fading index is combined with the roundness to preliminarily calculate the comprehensive characteristic index of rust:

[0051] Using a piecewise function to divide the roundness and the standardized surface fading index into intervals respectively;

[0052] Determine a correspondence between a roundness interval and a standardized surface fading index interval, and use the correspondence to construct an adjustment function between the roundness and the standardized surface fading index;

[0053] Determine the gray level, direction and distance of the pixel points in the rust area; calculate the frequency of the gray value of the neighboring pixel points within the specified direction and distance for each pixel point in the rust area, and construct a gray level co-occurrence matrix;

[0054] Dividing each element in the gray level co-occurrence matrix by the sum of all elements to generate a probability matrix;

[0055] Extracting texture features from the rusted area using the probability matrix;

[0056] The texture feature is combined with the initially calculated corrosion comprehensive feature index to obtain a final corrosion comprehensive feature index.

[0057] Preferably, the texture feature and the initially calculated corrosion comprehensive feature index are subjected to feature fusion calculation to obtain a final corrosion comprehensive feature index, and the specific operation steps are as follows:

[0058] Calculate the contrast and uniformity of texture features;

[0059] The contrast and uniformity of the extracted texture features are combined with the initially calculated comprehensive corrosion feature index to obtain the final comprehensive corrosion feature index.

[0060] Preferably, the corrosion comprehensive characteristic index is used to determine whether there is corrosion inside the corrosion area, and the final recognition result of the contact image to be detected is obtained. The specific operation steps are as follows:

[0061] Preset a comprehensive corrosion characteristic index threshold b, and determine whether the comprehensive corrosion characteristic index is greater than or equal to the preset comprehensive corrosion characteristic index threshold b;

[0062] If yes, then the rusted area has rust, and it is determined that the contact image to be detected has contact rust;

[0063] If not, the rusted area is not rusted, and it is determined that the contact image to be detected has no contact rust.

[0064] Accordingly, the present invention also proposes an image recognition system for contact corrosion, comprising: an acquisition module; a detection module; a final recognition module;

[0065] The acquisition module is used to acquire the contact image to be detected, pre-process the contact image to be detected, and obtain a contact grayscale image; acquire a defect area from the contact grayscale image to obtain multiple suspected areas;

[0066] The detection module is used to cluster the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas; calculate the surface fading index according to the brightness values ​​of the pixels inside the suspected areas, and calculate the comprehensive rust characteristic index of the rusted areas according to the surface fading index;

[0067] The final recognition module is used to determine whether there is rust inside the rust area according to the comprehensive rust characteristic index, and obtain the final recognition result of the contact image to be detected.

[0068] Compared with the prior art, the embodiments of the present invention have at least the following technical advantages:

[0069] It can be seen from the analysis of the above-mentioned contact corrosion image recognition method and system provided by the present invention that, in specific applications, the contact image to be detected is obtained by an acquisition device for denoising, smoothing, and grayscale preprocessing to obtain a contact grayscale image; the contact grayscale image is framed by the YOLO algorithm, and the suspected area where corrosion may exist is selected according to the confidence score evaluation, so that normal areas without corrosion can be quickly checked out, and areas where corrosion may exist can be screened out, thereby reducing the detection speed of subsequent recognition and increasing the accuracy;

[0070] Further, the brightness values ​​of the pixels in the suspected area are calculated, and the pixel with the highest brightness value is selected as the first pixel, as the significant area of ​​brightness, pointing to the possible rust, clarifying the target direction of identification, and increasing the recognition efficiency; and the Euclidean distance between the pixels in the suspected area is used to determine whether the pixel is within the Euclidean distance threshold r range, and the pixel within the Euclidean distance threshold r range is used as the second pixel, and the second pixel is clustered with the pixel within the Euclidean distance threshold r range to obtain a pixel cluster, and it is determined whether the first pixel exists in the pixel cluster, and the rust area is determined by the brightness of the significant area of ​​the first pixel, so that the rust area can be quickly determined and the detection accuracy can be increased;

[0071] Furthermore, the average distance between the first pixel point in the rusted area and the remaining pixels is obtained; at the same time, the edge pixels of the rusted area are found to calculate the average gradient and the area of ​​the rusted area; the average distance is multiplied by the average gradient and the area to obtain the surface fading index, and the characteristics of the rusted area are determined by the surface fading index, and the density change and brightness change between the pixels in the rusted area can also be determined;

[0072] Furthermore, the most edge pixel point among the edge pixel points of the rusted area is obtained, and the circumscribed rectangle is obtained through the most edge pixel point, and the intersection formed by diagonal connection is used as the third pixel point; a circle is formed according to the distance from the third pixel point to the edge pixel point as the radius, and the roundness of the rusted area is obtained; by calculating the roundness, the overall shape of the rusted area and the distribution of the pixel points can be calculated;

[0073] Furthermore, the roundness and surface fading index can reflect the significant characteristics of rust in the rust area. The rust distribution (i.e., the distribution of pixels) in the rust area can be judged according to the regularity of the roundness and the surface fading index can be used to calculate the comprehensive rust characteristic index of the rust area through the significant brightness in the rust area. According to the comprehensive rust characteristic index, an effective threshold is set to determine whether there is rust in the rust area, thereby improving the accuracy and speed of identifying contact corrosion. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 This is an overall flow chart of an image recognition method for contact corrosion in Example 1;

[0075] Figure 2 A schematic diagram of corrosion of an image recognition method for contact corrosion in Example 1;

[0076] Figure 3 A flowchart of a comprehensive characteristic index of corrosion of a contact corrosion image recognition method in Example 1;

[0077] Figure 4 A schematic diagram of obtaining a rusted area in a contact rusted image recognition method in Example 1;

[0078] Figure 5 This is a flow chart of obtaining a comprehensive corrosion feature index through a matrix in a contact corrosion image recognition method in Example 1;

[0079] Figure 6 This is a flow chart of calculating the comprehensive characteristic index of corrosion by texture features in a method for image recognition of contact corrosion in Example 1;

[0080] Figure 7 This is an overall flow chart of an image recognition system for contact corrosion in Example 2;

[0081] Figure 8 The present invention is a schematic diagram of the structure of a storage medium to which the above-mentioned contact corrosion image recognition method is applied.

[0082] Labels: acquisition module 10; detection module 20; final recognition module 30; processor 1110; communication interface 1120; memory 1130; computer storage medium 1140. DETAILED DESCRIPTION

[0083] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0084] The present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings.

[0085] like Figure 1 As shown, the present invention provides an image recognition method for contact corrosion, comprising the following steps:

[0086] S10: acquiring a contact image to be detected, preprocessing the contact image to be detected to obtain a contact grayscale image; acquiring a defect area from the contact grayscale image to obtain a plurality of suspected areas;

[0087] It should be noted that the image to be detected is collected by the camera device, and then the image to be detected is preprocessed. The preprocessing includes denoising, smoothing, graying and other operations. In order to improve the quality of the image of the contact to be detected, reduce noise and unnecessary details, and enhance the readability of the image, the original image (i.e., the image of the contact to be detected) may contain interference factors, which will affect the subsequent defect detection accuracy; and improve the detection efficiency and accuracy of the subsequent YOLO algorithm, ensure that effective information can be quickly obtained, and obtain the suspected area through the YOLO algorithm;

[0088] The defect area is obtained from the contact grayscale image to obtain a suspected area. The specific operation steps are as follows: the contact grayscale image is subjected to candidate box selection by using the YOLO algorithm to obtain multiple corrosion candidate boxes; the confidence scores of all corrosion candidate boxes are evaluated, and a confidence score threshold a is set to determine whether the confidence score of the corrosion candidate box is greater than or equal to the confidence score threshold a; if not, the corrosion candidate box is determined to be a normal area; if not, the corrosion candidate box is determined to be a suspected area;

[0089] First, the candidate boxes of the YOLO algorithm are used to select suspected areas of possible corrosion in the contact grayscale image, and the areas where problems may exist are quickly located. The confidence scores of these suspected areas of possible corrosion are evaluated, and the confidence score threshold is set to judge the screening of suspected areas of possible corrosion in these rust candidate boxes. These rust candidate boxes with a confidence score greater than or equal to the confidence score threshold a are used as suspected areas of possible corrosion. In this way, the suspected areas of corrosion can be quickly identified according to the YOLO algorithm, and those suspected areas where rust is unlikely to exist are eliminated, so as to facilitate the subsequent determination of these screened suspected areas of possible corrosion for more detailed identification, so as to find out whether there is rust; and the recognition speed and accuracy are also increased.

[0090] S20: clustering the brightness values ​​of the pixels in the multiple suspected areas to obtain the rusted areas; calculating the surface discoloration index (i.e., surface discoloration index (Surface Discoloration Index)) according to the brightness values ​​of the pixels in the suspected areas, and calculating the comprehensive rust characteristic index of the rusted areas according to the surface discoloration index;

[0091] It should be noted that in the analysis of the rusted area, the surface fading index is an indicator calculated by combining the average distance of pixels in the rusted area, the average gradient of edge pixels and the area of ​​the rusted area, which is used to measure the characteristics of the rusted area; the surface fading index reflects the compactness and brightness changes between pixels, and the higher the brightness, the more serious the rust; and the comprehensive rust characteristic index measures the shape and distribution characteristics of the rusted area by combining the roundness and the surface fading index; a roundness close to 1 indicates a regular shape, which usually implies that the rust is evenly distributed; conversely, a lower roundness may indicate irregular or severe rust; therefore, these two indicators together provide a comprehensive and in-depth assessment of the rusted area, helping to identify potential serious problems.

[0092] The study found that, affected by the deposition corrosion phenomenon of the corrosive medium, certain corrosion products (i.e. rust, chemical substances such as verdigris) produced thereby may aggregate on the surface of the above-mentioned contacts and then appear as circular corrosion spots.

[0093] S30: judging whether there is rust (patina (copper oxide) etc.) inside the rust area by the rust comprehensive characteristic index, such as Figure 2 As shown), the final recognition result of the contact image to be detected is obtained.

[0094] It should be noted that a preset corrosion comprehensive characteristic index threshold b is used to determine whether the corrosion comprehensive characteristic index is greater than or equal to the preset corrosion comprehensive characteristic index threshold b; if so, corrosion exists in the corrosion area, and the contact image to be detected is determined to have contact corrosion; if not, corrosion does not exist in the corrosion area, and the contact image to be detected is determined to have no contact corrosion. The corrosion comprehensive characteristic index can be used to make a final judgment on the corrosion area to determine whether corrosion exists in the corrosion area. When the corrosion comprehensive characteristic index is greater than a certain level, corrosion can be detected in the contact to be detected; when the corrosion comprehensive characteristic index is lower than a certain threshold, corrosion does not exist in the contact, thereby improving the accuracy and speed of recognition.

[0095] Specifically, Figure 3 As shown, in step S20, clustering is performed according to the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas; the surface fading index is calculated according to the brightness values ​​of the pixels inside the suspected areas, and the rust comprehensive characteristic index is calculated for the rusted areas according to the surface fading index. The specific operation steps are as follows:

[0096] S21: Calculate the brightness value of each pixel in the suspected area, sort the pixels in descending order according to their brightness values, and select the pixel with the highest brightness value as the first pixel;

[0097] If there are two or more pixels with the highest brightness value in each suspected area at the same time, a pixel with the highest brightness value is randomly selected as the first pixel point;

[0098] It should be noted that the brightness of each pixel in the detected suspected area is calculated. The pixel with higher brightness value usually represents more serious rust. Therefore, the pixel with the highest brightness is selected as the area with the most significant brightness, pointing to possible rust. In this way, the most obvious suspected area of ​​rust can be quickly identified, thus providing a clear target for subsequent analysis and ensuring the accuracy and efficiency of detection.

[0099] S22: Calculate the Euclidean distance between the pixels in each suspected area, preset the Euclidean distance threshold r; and determine whether the Euclidean distance between the pixels is greater than the Euclidean distance threshold r;

[0100] If not, the Euclidean distances between pixels that exceed the Euclidean distance threshold r are excluded;

[0101] If so, the Euclidean distance between the pixels within the Euclidean distance threshold r is taken as the dense area and used as the second pixel;

[0102] It should be noted that the Euclidean distance between adjacent pixels is calculated to determine the degree of aggregation of pixels within the suspected rust area; pixels with closer Euclidean distances are likely to be part of the same object in terms of brightness (i.e., they may be rusted). By screening out these dense areas, potential rust spots can be identified (i.e., rust spots refer to rusted areas formed on the surface of metal materials due to oxidation reactions or corrosion. These spots usually show color changes, surface roughness or depressions, which may lead to problems such as decreased metal strength and structural damage); the density of pixels within the rusted area can be used to enhance the ability to identify the rusted area, and effectively exclude those irrelevant and scattered pixels;

[0103] And by presetting the Euclidean distance threshold r, excluding pixels beyond the Euclidean distance threshold r can ensure that only pixels close to each other and with similar features are retained, so as to more accurately identify dense areas. This helps to reduce the impact of noise and irrelevant data, improve the clustering effect and the accuracy of subsequent analysis; retaining pixels within the range of the Euclidean distance threshold r can more effectively cluster potential cluster centers or similar areas;

[0104] S23: determining the coordinate position of the second pixel point, clustering the pixel points within a Euclidean distance threshold r of the second pixel point to obtain a pixel point cluster;

[0105] Determine whether there is a first pixel point in the pixel point cluster, and use the pixel point cluster in which the first pixel point exists as a rust area;

[0106] It should be noted that, during clustering, the validity of the pixel cluster is confirmed by determining whether the initially selected pixel with the highest brightness value (i.e., the first pixel) is in the clustered pixel cluster, and finally a set of rusted areas is formed, where rusted points may exist. Determining that the pixel with the highest brightness value is in the cluster helps to confirm that the area does have obvious rust features (i.e., it has been explained in step S21 that the pixel with the highest brightness value represents the severity of rust, and can also represent that the nearby area may also have similar rust). The pixel with the highest brightness value usually corresponds to the severity of rust. Therefore, if the first pixel is in the pixel cluster, it means that the surrounding pixels may also have similar rust features, and the pixel cluster is taken as the rusted area, such as Figure 4 As shown, analysis and detection can be effectively centralized to ensure that potential serious problems are not missed, which can improve the accuracy and efficiency of detection.

[0107] S24: Determine the coordinates of the first pixel point and the coordinates of all other pixel points in the rust area;

[0108] Calculating the distance between the coordinates of the first pixel point and the coordinates of all other pixel points, and obtaining an average distance;

[0109] The average distance calculation formula is:

[0110]

[0111] Where Q represents the average distance of the pixels inside the rusted area; (i0, j0) represents the coordinates of the first pixel in the rusted area (i.e., the pixel with the highest brightness); (i a , j a ) represents the coordinates of the ath pixel in the rust area; v represents the total number of pixels in the rust area;

[0112] Find edge pixel points in the rusted area, calculate gradients for the edge pixel points, and calculate average gradients based on the gradients of the edge pixel points;

[0113] The average gradient calculation formula is:

[0114]

[0115] Where T represents the average gradient of edge pixels in the rust area; Y a It is expressed as the gradient of the ath edge pixel in the rust area;

[0116] Count the number of pixels inside the rusted area, and calculate the area W of the rusted area according to the number of pixels (that is, calculating the area according to the number of pixels is common knowledge and will not be described in detail);

[0117] S25: multiplying the average distance between the first pixel and all other pixel points, the average gradient of the edge pixel points, and the area of ​​the rusted area to obtain the surface fading index of the pixel points in the rusted area;

[0118] The calculation formula for the surface fading index of the pixel points in the rust area is:

[0119] D = eR × T × W;

[0120] Where D is the surface fading index of the pixel points in the rust area; R is the average distance of the pixel points inside the rust area; T is the average gradient of the edge pixel points in the rust area; W is the area of ​​the rust area; e is a natural constant;

[0121] It should be noted that the average distance Q between the first pixel point and all other pixels in the rust area is calculated. When the average distance Q is smaller, it means that the pixels inside the rust area are more densely distributed and the distribution density is smaller (that is, the distance between pixels is smaller, which may indicate that the distribution density of the rust area is higher; at the same time, if the average distance Q is large, it means that the pixels are loosely distributed in the rust area, which may indicate that the distribution density inside the rust area is lower); at the same time, the surface fading index D of the pixels in the rust area is larger; when the average gradient T of the edge pixels in the rust area is larger, the brightness value of the pixels at the edge of the rust area is higher, so the surface fading index of the pixels inside the rust area appears The more prominent the edge feature is (that is, if the average gradient T is small, it may indicate that the brightness change of the edge is not obvious and the edge feature is weak); at the same time, the surface fading index D of the pixel points in the rust area is also larger; when the total number of pixels inside the rust area is more, it means that the area inside the rust area is larger, and it also means that after the pixel points are clustered, the brightness value of the rust area obtained is higher, indicating that the possibility of rust is greater; at the same time, the surface fading index D of the pixel points in the rust area is larger; when the surface fading index D of the pixel points in the rust area is larger, it means that the compactness of the pixel points inside the rust area is greater, and the density between the pixel points is greater, and the possibility of rust in the rust area is greater;

[0122] S26: Obtain the edge pixel point of the rust area, determine the coordinate position of the edge pixel point, and obtain the circumscribed rectangle of the rust area according to the coordinate position of the edge pixel point;

[0123] Determine the coordinates of the diagonal points of the circumscribed rectangle of the rusted area, connect the diagonal points, and use the intersection point as the third pixel point (i.e., as the center point);

[0124] Calculate the distance between the third pixel point and all edge pixel points of the rusted area, find the pixel point with the maximum distance as the radius, form a circle, and calculate the roundness of the rusted area;

[0125] The roundness calculation formula of the rusted area is:

[0126]

[0127] Wherein, C represents the roundness of the circle of the rusted area (i.e., the roundness, the value range is usually between 0 and 1; the closer the roundness is to 1, the more regular the shape is; the closer it is to 0, the more irregular the shape is); A represents the area of ​​the circle of the rusted area; P represents the circumference of the circle of the rusted area.

[0128] The comprehensive characteristic index of rust is calculated according to the roundness and the surface fading index.

[0129] It should be noted that, for the identified rusted area, the edge detection algorithm is used to extract the edgemost pixel points. The edge pixel points can clearly depict the outline of the area, which is helpful for the subsequent use of the coordinates of the edgemost pixel points to calculate the circumscribed rectangle of the rusted area and obtain a minimum rectangular frame that completely surrounds the rusted area; the coordinates of the two diagonal points of the circumscribed rectangle are calculated, the two diagonal points are connected, and the intersection of the connection is found to be the center point of the rusted area (i.e., the third pixel point); the circularity is calculated using the center point to make the circularity calculation more accurate and reflect the overall shape of the rusted area; the distance from all pixel points in the rusted area to the center point is calculated, and the maximum distance is found as the radius to obtain the radius value of the rusted area. The radius is a key indicator for calculating the circularity and can reflect the distribution of pixel points in the area;

[0130] In the above technical solution, the purpose of calculating the roundness is to evaluate the shape characteristics of the rusted area. For example, the closer the roundness is to 1, the closer the shape is to a circle; while a lower roundness may indicate that the shape of the rusted area is irregular. By analyzing the roundness, the severity of the rust can be identified.

[0131] The reason why the rust comprehensive characteristic index is calculated by using roundness and surface fading index is that these two characteristics can reflect the shape and texture of the rust area; roundness measures the regularity of the shape. The higher the roundness, the closer the shape is to a circle, which usually means that the rust is evenly distributed; while the surface fading index reflects the purity of the color, which affects the visual degree and severity of the rust (i.e., the compactness and density of the pixels inside the rust area can highlight the surface fading index. At the same time, because the pixels are too concentrated, the brightness of the rust area is too significant, and when the contact is corroded, dark rust (iron oxide), verdigris (copper oxide), etc. (i.e., rust, rust includes rust, verdigris, etc.) will appear on the contact surface; therefore, the surface fading index can reflect the color of the rust, that is, reflect the severity of the rust); combining the roundness and surface fading index, the characteristics of the rust area can be more comprehensively evaluated, so as to effectively identify and analyze the severity of the rust, and thus calculate the rust comprehensive characteristic index. The more severe the rust, the greater the rust comprehensive characteristic index;

[0132] Specifically, Figure 5 As shown, in step S26, the comprehensive characteristic index of rust is calculated according to the roundness and the surface fading index, and the specific operation steps are as follows:

[0133] S261: Convert the rusted area into the HSL color space and calculate the standardized value of the surface fading index; the standardized formula is:

[0134]

[0135] In the formula, C actual Expressed as the surface discoloration index of the rusted area; Cmin It is expressed as the minimum surface fading index of all pixels in the rust area; C max It is expressed as the maximum surface fading index among all pixels in the rusted area;

[0136] The standardized surface fading index is combined with the roundness to preliminarily calculate the comprehensive characteristic index of rust:

[0137] R pre =k1·(1-C)+k2·S;

[0138] Where k1 and k2 are weight coefficients, reflecting the relative influence of roundness and the normalized surface fading index;

[0139] It should be noted that in the above formula, (1-C) represents that since the higher the roundness C is, the more regular the shape is, (1-C) represents the irregularity of the shape. The higher the irregularity value is, the more irregular the shape of the rusted area is, thereby increasing the comprehensive characteristic index of rust; and k1(1-C) represents the effect of roundness on the comprehensive characteristic index of rust; if the roundness is low, the comprehensive characteristic index of rust will increase, reflecting the irregularity of the shape of the rusted area; k2·S represents the effect of the surface fading index on the comprehensive characteristic index of rust; the higher the surface fading index is, the greater the comprehensive characteristic index of rust will be, reflecting the obvious degree and severity of the color of rust;

[0140] HSL (hue, surface fading index, brightness) is more suitable for color analysis because, in HSL, the surface fading index S represents the purity of the color. The higher the value, the brighter the color, and the lower the value, the darker the color. In the rusted area, there may be multiple colors, and a single surface fading index value may not accurately reflect the overall characteristics of the area. In addition, by initially calculating the comprehensive characteristic index of rust, the rusted areas that need further analysis can be screened out, reducing the calculation burden of subsequent analysis and improving efficiency.

[0141] S262: using a piecewise function to divide the roundness and the standardized surface fading index into intervals respectively;

[0142] Determine a correspondence between a roundness interval and a standardized surface fading index interval, and use the correspondence to construct an adjustment function between the roundness and the standardized surface fading index;

[0143] It should be noted that, first, the value range of the roundness C and the surface fading index S is determined; for example, the range of the roundness C is 0 to 1; the range of the surface fading index S is 0 to 1; according to the actual situation, the values ​​of the roundness and the surface fading index are divided into several intervals, for example, the roundness C includes irregular 0.0-0.3, medium regular 0.3-0.7, regular 0.7-1.0; the surface fading index S includes low surface fading index 0.0-0.3, medium surface fading index 0.3-0.7, high surface fading index 0.7-1.0;

[0144] The corresponding relationship between the roundness C and the surface fading index S of the divided intervals is respectively found: low roundness and low surface fading index, medium roundness and medium surface fading index, and high roundness and high surface fading index;

[0145] The corresponding relationship adjustment strategy defined for each interval of roundness C and surface fading index S, for example: for low roundness and low surface fading index (C≤0.3, S≤0.3): R adjusted =R pre 0.5; for medium roundness and medium surface fading index (0.3 <C≤0.7,0.3<S≤0.7):R adjusted =R pre (1+(S-0.5)); For high roundness and high surface fading index (C>0.7, S>0.7): R adjusted =R pre ·e (S-0.5) ; In the above formula, the surface fading index S ranges from 0 to 1, 0.5 represents a medium surface fading index, and 0.5 is used as a reference point to distinguish between low surface fading index and high surface fading index; 0.5 is used to calculate the increment or adjustment range; For example, the formula R adjusted =R pre (1+(S-0.5)) means that when the saturation S is higher than 0.5, the rust comprehensive characteristic index will increase; when it is lower than 0.5, the rust comprehensive characteristic index will decrease; 0.5 as the dividing point helps to more accurately reflect the characteristic changes of the rust area, so that the adjustment can adapt to different surface fading index conditions;

[0146] In rust detection, a lower roundness usually indicates an irregular shape, while a lower surface fading index may indicate a less obvious color or lighter rust; therefore, different adjustment strategies need to be designed for different intervals in order to accurately reflect the characteristics of the rusted area;

[0147] Low roundness and low surface fading index: When both are low, the rust area is usually irregular in shape and the color is not obvious, which may indicate a lighter degree of rust, so the value of the comprehensive rust characteristic index needs to be lowered to reflect this feature; Medium roundness and medium surface fading index: Such areas may show a certain degree of rust, with variations in shape and color.

[0148] The adjustment strategy can introduce a linear increment based on the surface fading index, so that the rust comprehensive characteristic index increases with the increase of the surface fading index, reflecting the gradual aggravation of rust; high roundness and high surface fading index: indicates that the rust area is regular and the color is obvious, which usually means that the degree of rust is heavier; using an exponential function can make the rust comprehensive characteristic index increase rapidly to emphasize the severity of rust; exponential growth can more sensitively reflect the changes in the surface fading index and adapt to the strong changes in the rust area;

[0149] In practical applications, the morphology and color changes of rust are usually complex; by designing adjustment strategies for different feature ranges, these strategies can be continuously optimized based on actual data feedback, so that the comprehensive rust feature index can more accurately reflect the real situation;

[0150] S263: Determine the gray level, direction and distance of the pixel points in the rust area (that is, using multiple directions can capture texture features in different directions and enhance the description of regional features; select the direction according to the specific application, for example: if the texture of the rust area is mainly along a certain direction, you can give priority to this direction; the distance is 1 pixel, that is, calculate the relationship between the current pixel and its adjacent pixel points; the above-mentioned "distance" is not Euclidean distance, but represents the spatial relationship between two pixels in the rust area. The spatial interval used when calculating the relationship between adjacent pixels is usually measured in pixels and combined with a specific direction to generate texture features; in the gray level co-occurrence matrix, the distance value is 1 (that is, the adjacent pixel points are used as a reference)); for each pixel point in the rust area, calculate the frequency of the gray value of the neighboring pixel points within the specified direction and distance (that is, for example: for the direction 0°, the frequency refers to the number of times a specific pixel gray value combination appears in the image), and construct a gray level co-occurrence matrix;

[0151] Dividing each element in the gray level co-occurrence matrix by the sum of all elements to generate a probability matrix (i.e., the probability matrix can more intuitively represent the distribution of information. For example, if the probability of a pair of gray levels is high, it can be inferred that there are obvious texture features in the rust area; when calculating texture features (such as contrast and uniformity), the use of the probability matrix can more accurately reflect the texture complexity of the rust area, reducing the numerical instability that may be caused by the excessive frequency range of the gray value of the original pixel point, thereby improving the stability of the algorithm in the subsequent feature extraction and processing process);

[0152] S264: extracting texture features from the rusted area using the probability matrix;

[0153] The texture feature is combined with the initially calculated corrosion comprehensive feature index to obtain a final corrosion comprehensive feature index.

[0154] It should be noted that the rusted area has been converted into the HSL color space in step S261. Although the shape and color of the rusted area are important, the roundness and surface fading index alone may not fully reflect the characteristics of the rust. Different types of rust may have different surface textures. For example, slight rust may appear as a smooth surface, while severe rust may appear as a rough, granular texture. Therefore, texture features can better reflect the complexity and changes of the rusted surface.

[0155] The grayscale of the pixels in the rusted area is determined by constructing a grayscale co-occurrence matrix, and the frequency of occurrence of the grayscale value of each pixel in the neighborhood direction and distance is calculated for each pixel. Then, a probability matrix is ​​constructed based on each element in the grayscale co-occurrence matrix. The texture features of the rusted area are extracted through the probability matrix, which reduces the impact caused by the brightness change or different grayscale distribution of the rusted area, making the extracted texture features more stable and reliable.

[0156] Incorporating texture features into the calculation of the comprehensive rust feature index can make the final comprehensive rust feature index of the rust area more comprehensive. For example, the roundness of a rust area may be very high, but its texture is very rough, which may be ignored in a single index (i.e., roundness, surface fading index, contrast and uniformity). By combining texture features, the true condition of the rust area can be judged more accurately.

[0157] Specifically, Figure 6 As shown, in step S264, the texture feature and the initially calculated rust comprehensive feature index are subjected to feature fusion calculation to obtain the final rust comprehensive feature index. The specific operation steps are as follows:

[0158] S2641: Calculate the contrast of texture features (i.e., by calculating the contrast, the change in the grayscale intensity of the rusted area can be evaluated, and at the same time, the roughness of the texture can be reflected) and the uniformity (i.e., by calculating the uniformity, the smoothness of the rusted area can be reflected, and the higher the uniformity, the smoother the texture);

[0159] The formula for calculating contrast is:

[0160] Contrast=∑ i,j (ij) 2 P(i,j);

[0161] Where i and j represent different gray levels in the image, usually ranging from 0 to 255; P(ij) is an element in the gray-level co-occurrence matrix (GLCM), which is expressed as the frequency of occurrence of pixel pairs with gray values ​​i and j; (ij) 2 It is expressed as calculating the square of the difference between gray levels i and j;

[0162] It should be noted that (ij) 2 In the image, the larger the difference, the larger the square value, which reflects the grayscale difference between the two pixels and can be used to obtain the contrast of the overall image. The higher the contrast, the more obvious the texture and details in the image, because the grayscale difference between pixels is larger. Conversely, low contrast means that the rusted area is relatively flat and has fewer details.

[0163] The calculation formula for the mean value is:

[0164]

[0165] Where P(ij) is an element in the gray-level co-occurrence matrix (GLCM), which represents the frequency of occurrence of pixel pairs with gray values ​​i and j; |ij| represents the absolute difference between gray values;

[0166] It should be noted that |ij| is expressed as the absolute difference between grayscale values, which is different from the square difference in the contrast formula. Here, the absolute value is taken to emphasize the size of the difference; the term 1+|ij| is to avoid division by zero and increase the weight of smaller differences; uniformity measures the smoothness of the grayscale distribution in the rusted area; high uniformity means that the grayscale values ​​of adjacent pixels are similar, indicating that the surface of the rusted area is relatively smooth; low uniformity means that there is a large grayscale difference in the rusted area;

[0167] S2642: performing feature fusion calculation on the contrast and average value of the extracted texture features and the initially calculated comprehensive corrosion feature index to obtain a final comprehensive corrosion feature index;

[0168] The final calculation formula for the comprehensive corrosion characteristic index is:

[0169] R=(R pre +k3·Contrast+k4·Homogeneity)·R adjusted ;

[0170] Where R represents the final comprehensive characteristic index of corrosion; R pre It is expressed as the comprehensive characteristic index of rust initially calculated by roundness and normalized surface discoloration index; k3 and k4 are expressed as weight coefficients;

[0171] In the above feature fusion calculation process, emphasis is placed on integrating other important features collected (such as contrast, uniformity, etc.) into the aforementioned calculation model, and then performing "feature fusion calculation" to output a final comprehensive corrosion feature index.

[0172] It should be noted that the corrosion comprehensive feature index is calculated by adding the contrast and uniformity (i.e. uniformity) of the texture features to the initially calculated corrosion comprehensive feature index (i.e., the texture features extracted from the corrosion area are integrated into the initially calculated corrosion comprehensive feature index). The texture features include contrast, uniformity, energy, and entropy. The contrast and uniformity of the texture features are added because the contrast describes the difference between the gray levels in the corrosion area and can reflect the texture roughness of the corrosion area. High contrast usually means that there are obvious edges and texture changes in the corrosion area, which can reflect the severity of the corrosion.

[0173] The uniformity value is added to measure the similarity of the grayscale values ​​in the rusted area. High uniformity indicates that the grayscale changes in the area are small, which usually corresponds to less rust or a smoother surface. Uniformity helps to identify the stability of the rusted area and can effectively improve the recognition speed. Different rust conditions may show different contrast and uniformity. For example, some rusted areas may have complex shapes and obvious grayscale changes, while other modified areas may be more uniform. Therefore, by adding contrast and uniformity values, the comprehensive characteristic index of rust can be calculated more flexibly.

[0174] The reason why the energy and entropy in the texture features are not used to calculate the final comprehensive corrosion feature index is that adding energy and entropy may increase the computational complexity, especially when processing large-scale images, which may affect the processing speed and real-time performance; if the existing texture features (such as contrast and uniformity) can already describe the characteristics of the rust area well, the introduction of energy and entropy may lead to information redundancy and reduce the effectiveness of the calculation; in some specific applications, some texture features (such as contrast and uniformity) may be more concerned without considering the influence of energy and entropy.

[0175] Embodiment 2

[0176] like Figure 7 As shown, accordingly, the present invention also provides an image recognition system for contact corrosion, comprising: an acquisition module 10; a detection module 20; a final recognition module 30;

[0177] The acquisition module 10 is used to acquire the contact image to be detected, pre-process the contact image to be detected, and obtain a contact grayscale image; acquire a defect area from the contact grayscale image to obtain multiple suspected areas;

[0178] The detection module 20 is used to cluster the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas; calculate the surface fading index according to the brightness values ​​of each pixel inside the suspected area, and calculate the comprehensive rust characteristic index of the rusted area according to the surface fading index;

[0179] The final recognition module 30 is used to determine whether there is rust inside the rust area according to the comprehensive rust characteristic index, and obtain the final recognition result of the contact image to be detected.

[0180] Embodiment 3

[0181] On the other hand, this third embodiment is based on the contact rust image recognition method provided in the first embodiment of the invention, and further provides a computer storage medium 1140 (hereinafter referred to as storage medium). Figure 8 FIG. 1 is a schematic diagram of a computer storage medium structure framework provided in Embodiment 3 of the present invention, which includes:

[0182] A memory 1130, used for storing computer programs;

[0183] The communication interface 1120 is used to connect the memory 1130 to the processor 1110;

[0184] The processor 1110 is used to execute a computer program to implement an image recognition method for contact rust involved in an embodiment disclosed in combination with any of the above-mentioned implementation modes.

[0185] In summary, the present invention proposes an image recognition method and system for contact corrosion, which obtains the contact image to be detected by an acquisition device, performs denoising, smoothing, and grayscale preprocessing to obtain a contact grayscale image; the YOLO algorithm is used to select candidate frames for the contact grayscale image, and according to the confidence score evaluation, the suspected area where corrosion may exist is selected, so that normal areas without corrosion can be quickly checked out, and areas where corrosion may exist can be screened out, thereby reducing the detection speed of subsequent recognition and increasing the accuracy;

[0186] Further, the brightness values ​​of the pixels in the suspected area are calculated, and the pixel with the highest brightness value is selected as the first pixel, as the significant area of ​​brightness, pointing to the possible rust, clarifying the target direction of identification, and increasing the recognition efficiency; and the Euclidean distance between the pixels in the suspected area is used to determine whether the pixel is within the Euclidean distance threshold r range, and the pixel within the Euclidean distance threshold r range is used as the second pixel, and the second pixel is clustered with the pixel within the Euclidean distance threshold r range to obtain a pixel cluster, and it is determined whether the first pixel exists in the pixel cluster, and the rust area is determined by the brightness of the significant area of ​​the first pixel, so that the rust area can be quickly determined and the detection accuracy can be increased;

[0187] Furthermore, the average distance between the first pixel point in the rusted area and the remaining pixels is obtained; at the same time, the edge pixels of the rusted area are found to calculate the average gradient and the area of ​​the rusted area; the average distance is multiplied by the average gradient and the area to obtain the surface fading index, and the characteristics of the rusted area are determined by the surface fading index, and the density change and brightness change between the pixels in the rusted area can also be determined;

[0188] Furthermore, the most edge pixel point among the edge pixel points of the rusted area is obtained, and the circumscribed rectangle is obtained through the most edge pixel point, and the intersection formed by diagonal connection is used as the third pixel point; a circle is formed according to the distance from the third pixel point to the edge pixel point as the radius, and the roundness of the rusted area is obtained; by calculating the roundness, the overall shape of the rusted area and the distribution of the pixel points can be calculated;

[0189] Furthermore, the roundness and surface fading index can reflect the significant characteristics of rust in the rust area. The rust distribution (i.e., the distribution of pixels) in the rust area can be judged according to the regularity of the roundness and the surface fading index can be used to calculate the comprehensive rust characteristic index of the rust area through the significant brightness in the rust area. According to the comprehensive rust characteristic index, an effective threshold is set to determine whether there is rust in the rust area, thereby improving the accuracy and speed of identifying contact corrosion.

[0190] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. A person skilled in the art may modify the technical solutions described in the above embodiments, or replace part or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A contact corrosion image recognition method, characterized in that: The steps include: Acquire a contact image to be detected, pre-process the contact image to be detected to obtain a contact grayscale image; acquire a defect area from the contact grayscale image to obtain a plurality of suspected areas; Clustering is performed according to the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas; calculating the surface fading index according to the brightness values ​​of the pixels inside the suspected areas, and calculating the comprehensive rust characteristic index of the rusted areas according to the surface fading index; The comprehensive corrosion characteristic index is used to determine whether corrosion exists inside the corrosion area, and a final recognition result of the contact image to be detected is obtained.

2. The image recognition method for contact corrosion according to claim 1, characterized in that: The defect area is obtained from the contact grayscale image to obtain a suspected area. The specific operation steps are as follows: Performing candidate frame selection on the contact grayscale image by using a YOLO algorithm to obtain multiple rust candidate frames; Evaluate the confidence scores of all rust candidate frames, set the confidence score threshold a, and determine whether the confidence score of the rust candidate frame is greater than or equal to the confidence score threshold a; If not, the rust candidate frame is determined to be a normal area; If not, the rust candidate box is determined to be a suspected area.

3. The image recognition method for contact corrosion according to claim 2, characterized in that: Clustering is performed according to the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas. The specific operation steps are as follows: Calculate the brightness value of each pixel in the suspected area, sort the pixels in descending order according to their brightness values, and select the pixel with the highest brightness value as the first pixel; If there are two or more pixels with the highest brightness value in each suspected area, a pixel with the highest brightness value is randomly selected as the first pixel; Calculate the Euclidean distance between the pixels in each suspected area, and preset the Euclidean distance threshold r; determine whether the Euclidean distance between the pixels is greater than the Euclidean distance threshold r; If not, the Euclidean distances between pixels that exceed the Euclidean distance threshold r are excluded; If so, the Euclidean distance between the pixels within the Euclidean distance threshold r is taken as the dense area and used as the second pixel; Determine the coordinate position of the second pixel point, cluster the pixel points within a Euclidean distance threshold r of the second pixel point, and obtain a pixel point cluster; It is determined whether a first pixel point exists in the pixel point cluster, and the pixel point cluster in which the first pixel point exists is used as a rust area.

4. The image recognition method for contact corrosion according to claim 3, characterized in that: The surface fading index is calculated according to the brightness value of each pixel point inside the suspected area. The specific operation steps are as follows: Determine the coordinates of the first pixel point and the coordinates of all other pixel points in the rust area; Calculating the distance between the coordinates of the first pixel point and the coordinates of all other pixel points, and obtaining an average distance; The average distance calculation formula is: Where Q represents the average distance of the pixels inside the rusted area; (i0, j0) represents the coordinates of the first pixel in the rusted area; (i a , j a ) represents the coordinates of the ath pixel in the rust area; v represents the total number of pixels in the rust area; Find edge pixel points in the rusted area, calculate gradients for the edge pixel points, and calculate average gradients based on the gradients of the edge pixel points; The average gradient calculation formula is: Where T represents the average gradient of edge pixels in the rust area; Y a It is expressed as the gradient of the ath edge pixel in the rust area; Counting the number of pixels inside the rusted area, and calculating the area W of the rusted area according to the number of pixels; The average distance between the first pixel and all other pixels, the average gradient of the edge pixels, and the area of ​​the rusted area are multiplied to obtain the surface fading index of the pixels in the rusted area; The calculation formula for the surface fading index of the pixel points in the rust area is: D = eR × T × W; Where D is the surface fading index of the pixel points in the rusted area; R is the average distance of the pixel points inside the rusted area; T is the average gradient of the edge pixel points in the rusted area; W is the area of ​​the rusted area; and e is a natural constant.

5. The image recognition method for contact corrosion according to claim 4, characterized in that: According to the surface fading index, the comprehensive characteristic index of rust is calculated for the rusted area. The specific steps are as follows: Obtain the edgemost pixel point of the rusted area, determine the coordinate position of the edgemost pixel point, and obtain the circumscribed rectangle of the rusted area according to the coordinate position of the edgemost pixel point; Determine the coordinates of the diagonal points of the circumscribed rectangle of the rusted area, connect the diagonal points, and use the intersection point as the third pixel point; Calculate the distance between the third pixel point and all edge pixel points of the rusted area, find the pixel point with the maximum distance as the radius, form a circle, and calculate the roundness of the rusted area; The roundness calculation formula of the rusted area is: Wherein, C represents the roundness of the circle of the rusted area; A represents the area of ​​the circle of the rusted area; and P represents the circumference of the circle of the rusted area. The comprehensive characteristic index of rust is calculated according to the roundness and the surface fading index.

6. The image recognition method for contact corrosion according to claim 5, characterized in that: The comprehensive characteristic index of rust is calculated according to the roundness and the surface fading index, and the specific operation steps are as follows: Convert the rusted area into HSL color space and calculate the standardized value of the surface fading index; The standardized surface fading index is combined with the roundness to preliminarily calculate the comprehensive characteristic index of rust: Using a piecewise function to divide the roundness and the standardized surface fading index into intervals respectively; Determine a correspondence between a roundness interval and a standardized surface fading index interval, and use the correspondence to construct an adjustment function between the roundness and the standardized surface fading index; Determine the gray level, direction and distance of the pixel points in the rust area; calculate the frequency of the gray value of the neighboring pixel points within the specified direction and distance for each pixel point in the rust area, and construct a gray level co-occurrence matrix; Dividing each element in the gray level co-occurrence matrix by the sum of all elements to generate a probability matrix; Extracting texture features from the rusted area using the probability matrix; The texture feature is combined with the initially calculated corrosion comprehensive feature index to obtain a final corrosion comprehensive feature index.

7. The image recognition method for contact corrosion according to claim 6, characterized in that: The texture feature is combined with the initially calculated corrosion comprehensive feature index to obtain the final corrosion comprehensive feature index. The specific operation steps are as follows: Calculate the contrast and uniformity of texture features; The contrast and uniformity of the extracted texture features are combined with the initially calculated comprehensive corrosion feature index to obtain the final comprehensive corrosion feature index.

8. The image recognition method for contact corrosion according to claim 7, characterized in that: The corrosion comprehensive characteristic index is used to determine whether there is corrosion inside the corrosion area, and the final recognition result of the contact image to be detected is obtained. The specific operation steps are as follows: Preset a comprehensive corrosion characteristic index threshold b, and determine whether the comprehensive corrosion characteristic index is greater than or equal to the preset comprehensive corrosion characteristic index threshold b; If yes, then the rusted area has rust, and it is determined that the contact image to be detected has contact rust; If not, the rusted area is not rusted, and it is determined that the contact image to be detected has no contact rust.

9. An image recognition system for contact corrosion, characterized in that: include: Acquisition module; detection module; final recognition module; The acquisition module is used to acquire the contact image to be detected, and pre-process the contact image to be detected to obtain a contact grayscale image; Acquire defective areas from the contact grayscale image to obtain a plurality of suspected areas; The detection module is used to cluster the brightness values ​​of the pixels inside the multiple suspected areas to obtain the rusted areas; calculate the surface fading index according to the brightness values ​​of the pixels inside the suspected areas, and calculate the comprehensive rust characteristic index of the rusted areas according to the surface fading index; The final recognition module is used to determine whether there is rust inside the rust area according to the comprehensive rust characteristic index, and obtain the final recognition result of the contact image to be detected.

Citation Information

Patent Citations

  • Strip steel red rust defect detection method based on artificial intelligence

    CN113554629A

  • Iron plate corrosion defect detection method

    CN115311304A

  • Steel wire rope defect detection method

    CN115330783A

  • Battery box production defect detection method based on image processing

    CN118096761A

  • Steel bridge coating inspection system using image processing and the processing method for the same

    US20110150326A1

Cited By

  • Fire-fighting equipment fault automatic detection method and system based on image processing

    CN120411080A

  • Static arc contact workpiece rusty spot defect detection and recognition processing method

    CN120471842A

  • New energy liquid cooling charging cable production safety early warning method and system

    CN120747868A

  • A new energy liquid cooling charging cable production safety early warning method and system

    CN120747868B