Part defect identification and detection method and system based on image model

By extracting surface defect features of piston rings using an image model-based method, generating geometric and texture defect sets, and performing collaborative judgment, the problem of missed detection and misjudgment in traditional detection systems under concurrent interference from multiple types of defects is solved, enabling rapid and accurate detection and classification of piston ring surfaces.

CN120953679AActive Publication Date: 2025-11-14GUANGDONG JINGRONG TECH HLDG CO LTD
View PDF 16 Cites 0 Cited by

Patent Information

Application Number
CN202511067318.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2025-11-14
Estimated Expiration
2045-07-31

AI Technical Summary

Technical Problem

Traditional visual inspection systems struggle to distinguish between concurrent interference from multiple types of defects in the production of precision piston rings for automotive engines, leading to missed detections and misjudgments. This is especially true when overlapping signals of micron-level mechanical scratches and oxidation spots caused by quenching processes are present in micro-areas, making accurate identification difficult.

Method used

An image model-based approach is adopted to extract the linear defect closed contour and planar defect continuous region on the piston ring surface, generating a geometric defect contour set and a texture defect region set. The defect interaction intensity is quantified by coupling feature distribution map, and a lightweight fusion model is used for collaborative judgment to generate a defect judgment decision signal.

Benefits of technology

It significantly improves the sensitivity and accuracy of defect detection, enabling rapid and accurate identification and classification of defects in high-speed continuous production environments, reducing the risk of missed detections and misjudgments, and improving the level of production quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953679A_ABST
    Figure CN120953679A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a part defect recognition and detection method and system based on an image model. The method comprises the following steps: acquiring a grating image of the surface of the piston ring through an industrial camera, and recording the grating image as a to-be-detected piston ring grating image; extracting a closed contour of a linear defect in the to-be-detected piston ring grating image, and generating a geometric defect contour set; extracting continuous areas of planar defects in the grating image of the piston ring to be detected, and generating a texture defect area set; and positioning an overlapping region of the geometric defect contour and the texture defect region based on the geometric defect contour set and the texture defect region set. According to the method, the boundary features of the composite defects can be clearly identified, misjudgment caused by the fact that a traditional algorithm depends on a single feature threshold value is avoided, and the technical problem that multiple types of defects concurrently interfere in a microcosmic area is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method and system for identifying and detecting defects in spare parts based on image models. Background Technology

[0002] On automated production lines for precision piston rings in automotive engines, vision inspection systems play a crucial role in quality control. As thin-walled metal rings with a thickness on the order of millimeters, piston rings must meet stringent dimensional and positional tolerances and be free of defects. Even minor scratches, dents, or abnormal quenching color can lead to engine seal failure. Currently, the mainstream approach uses high-resolution industrial cameras combined with traditional image processing algorithms (such as edge detection, threshold segmentation, and template matching) for online inspection. However, in real-world high-speed continuous production environments, it is still difficult to completely eliminate missed detections and misjudgments.

[0003] A hidden technical challenge lies in the concurrent interference of multiple types of defects in the microscopic region. For example, when there are micron-level mechanical scratches (linear defects) on the edge of a piston ring, localized oxide spots (planar defects) may appear in the adjacent area due to fluctuations in the quenching process. These two types of defects create overlapping signals in optical imaging. Traditional algorithms rely on preset single feature thresholds (such as gradient intensity or color deviation), making it difficult to distinguish the boundary features of such coupled defects. The sharp edges of the scratches can be obscured by the diffuse grayscale changes of the oxide spots, causing the system to misclassify the composite defect as a single large-area oxide spot, or directly filter out weak scratch noise, resulting in the failure to identify critical defects. Summary of the Invention

[0004] Therefore, the present invention needs to provide a method and system for identifying and detecting defects in spare parts based on image models, in order to solve at least one of the above-mentioned technical problems.

[0005] To achieve the above objectives, a method for identifying and detecting defects in spare parts based on image models includes the following steps:

[0006] Step S1: Acquire a grating image of the piston ring surface using an industrial camera, and record it as the grating image of the piston ring to be inspected;

[0007] Step S2: Extract the closed contours of linear defects in the grating image of the piston ring to be inspected, and generate a geometric defect contour set; extract the continuous regions of planar defects in the grating image of the piston ring to be inspected, and generate a texture defect region set.

[0008] Step S3: Locate the overlapping area of ​​the geometric defect contour and the texture defect region based on the geometric defect contour set and the texture defect region set; perform correlation calculation on the pixel gradient distribution and grayscale changes in the overlapping area to generate a coupling feature distribution map that characterizes the interaction strength of defects.

[0009] Step S4: Simultaneously input the geometric defect contour set, texture defect region set, and coupled feature distribution map into the preset lightweight fusion model to generate collaborative judgment results; generate defect judgment decision signals based on the collaborative judgment results;

[0010] Step S5: Based on the defect determination decision signal, control the automated sorting mechanism to perform a sorting operation on the piston rings.

[0011] Preferably, step S2 involves extracting the closed contour of the linear defect in the piston ring grating image to be inspected, including:

[0012] The high-frequency edge components of the piston ring grating image to be inspected are extracted using a preset first gradient operator to generate a high-frequency gradient response map;

[0013] The low-frequency texture components of the piston ring grating image to be inspected are extracted using a preset second gradient operator to generate a low-frequency gradient response map.

[0014] The high-frequency gradient response map and the low-frequency gradient response map are superimposed and fused pixel by pixel to generate a multi-scale gradient response map.

[0015] Identify the highlight regions in the multi-scale gradient response map, perform gradient correction on the highlight regions, and generate an anti-reflection correction map;

[0016] Identify low-contrast regions in multi-scale gradient response maps and perform gradient enhancement on these regions to generate weak edge enhancement maps.

[0017] Geometric defect contour sets are extracted based on anti-reflective correction maps and weak edge enhancement maps.

[0018] Preferably, identifying highlight regions in the multi-scale gradient response map and performing gradient correction on the highlight regions includes:

[0019] Calculate the average brightness of each pixel neighborhood in the multi-scale gradient response map. If the average brightness is greater than or equal to a preset highlight threshold, the corresponding pixel neighborhood is determined to be a highlight region. The calculation window size of the pixel neighborhood is the preset neighborhood window size.

[0020] Read the gradient value at the location corresponding to the highlight area in the high-frequency gradient response map;

[0021] The attenuation coefficient is calculated based on the average brightness value. The specific formula for calculating the attenuation coefficient is as follows:

[0022] Attenuation coefficient = 1 / (1 + k × mean luminance);

[0023] Where k is the preset material reflectivity;

[0024] Multiply the gradient value by the attenuation coefficient to generate the anti-reflection correction value, update the gradient value of the current pixel to the anti-reflection correction value, and generate the anti-reflection correction map.

[0025] Preferably, identifying low-contrast regions in the multi-scale gradient response map and performing gradient enhancement on these low-contrast regions includes:

[0026] Calculate the gradient standard deviation of each pixel neighborhood in the multi-scale gradient response map. If the gradient standard deviation is less than or equal to the preset contrast threshold, the corresponding pixel neighborhood is determined to be a low contrast region. The calculation window size of the pixel neighborhood is the preset neighborhood window size.

[0027] Read the gradient value at the corresponding position in the low-contrast region of the low-frequency gradient response graph;

[0028] A sigmoid gain function is used to enhance the gradient value. The sigmoid gain function is as follows:

[0029]

[0030] Where s is the preset sharpening intensity parameter;

[0031] Update the gradient value of the current pixel to the enhancement value, and generate a weak edge enhancement map.

[0032] Preferably, the extraction of the geometric defect contour set based on the anti-reflection correction map and the weak edge enhancement map includes:

[0033] Statistically analyze the gradient distribution histograms of the anti-reflective correction map and the weak edge enhancement map respectively;

[0034] The gradient threshold of the p-th percentile is determined based on the gradient distribution histogram, where p is a preset percentile parameter;

[0035] Iterate through each pixel of the anti-reflection correction map and the weak edge enhancement map.

[0036] If the gradient value of the current pixel is greater than or equal to the gradient threshold of the pth percentile, then the neighborhood of the pixel is subjected to a closing operation using the preset first structuring element.

[0037] If the gradient value of the current pixel is less than the gradient threshold of the pth percentile, then the neighborhood of the pixel is subjected to a closing operation using a preset second structuring element, where the preset first structuring element is less than the preset second structuring element.

[0038] The anti-reflective correction map and the weak edge enhancement map after the closing operation are combined by taking the maximum value of each pixel to generate a comprehensive gradient map.

[0039] Contour extraction is performed on the comprehensive gradient map to generate a closed, continuous set of contours, denoted as the geometric defect contour set.

[0040] Preferably, step S2 involves extracting a continuous region of planar defects in the piston ring grating image to be inspected, including:

[0041] The piston ring grating image to be inspected is divided into multiple analysis regions of preset scales, generating large-scale region sets, medium-scale region sets, and small-scale region sets; among them, large-scale regions are used to capture macroscopic color spots, medium-scale regions are used to capture transitional color spots, and small-scale regions are used to capture microscopic color spots.

[0042] Traverse the analysis region for each scale region:

[0043] Analyze the gray-level histogram of the current analysis area and calculate the gray-level mean and standard deviation.

[0044] The segmentation threshold is calculated based on the grayscale mean and standard deviation. The formula for calculating the segmentation threshold is as follows:

[0045] Segmentation threshold = mean gray level + k × standard deviation;

[0046] Where k is the preset sensitivity coefficient;

[0047] Pixels with gray values ​​greater than the segmentation threshold are marked as candidate defect pixels, and a candidate defect pixel set is generated.

[0048] If candidate defect pixels concentrated in large-scale regions spatially overlap with candidate defect pixels concentrated in medium-scale regions, then the candidate defect pixels in the overlapping regions will be merged into the same color spot region.

[0049] If candidate defect pixels concentrated in the medium-scale region spatially overlap with candidate defect pixels concentrated in the small-scale region, then the candidate defect pixels in the overlapping region will be merged into the same color spot region.

[0050] Perform a morphological closing operation on the merged color spot regions to generate a set of texture defect regions.

[0051] Preferably, step S3 includes:

[0052] Traverse the spatial coordinates of the geometric defect contour set and the texture defect region set, and identify the pixel region where the geometric defect contour and the texture defect region intersect as the overlapping region.

[0053] Calculate the standard deviation of the gradient values ​​of all pixels within the overlapping region, and denot it as the gradient standard deviation;

[0054] Calculate the coefficient of variation of the gray values ​​of all pixels in the overlapping region, denoted as the gray value coefficient of variation, where the coefficient of variation = standard deviation of gray values ​​of all pixels in the overlapping region / mean of gray values ​​of all pixels in the overlapping region;

[0055] Multiply the gradient standard deviation by the gray-level variation coefficient to generate the local interference coefficient characterizing the intensity of defect interaction;

[0056] Extract the smallest bounding rectangle of the geometric defect contour, denoted as the contour outline;

[0057] Calculate the minimum distance between the outline and the boundary of the texture defect region;

[0058] If the minimum distance is negative and its absolute value is greater than or equal to the preset minimum distance threshold, then the topological relationship between the geometric defect contour and the texture defect region is determined to be a complete enclosed relationship.

[0059] If the minimum distance is positive and less than the preset minimum distance threshold, the topological relationship between the geometric defect contour and the texture defect region is determined to be cross-penetration;

[0060] If the topological relationship between the geometric defect contour and the texture defect region is a complete enclosing relationship, then the current overlapping region is assigned a preset first weight value;

[0061] If the topological relationship between the geometric defect contour and the texture defect region is a cross-penetration relationship, then a preset second weight value is assigned to the current overlapping region, wherein the preset first weight value is greater than the preset second weight value;

[0062] Multiply the local interference coefficients by the corresponding topological weight values ​​to generate the coupling feature values ​​of the current overlapping region;

[0063] Traverse all overlapping regions, map the coupling feature values ​​to the image coordinate system, and generate a coupling feature distribution map that characterizes the intensity of defect interaction.

[0064] Preferably, step S4 includes:

[0065] The geometric defect contour set, texture defect region set, and coupling feature distribution map are input into a preset lightweight fusion model. The collaborative analysis of the preset lightweight fusion model includes extracting the mean of interaction intensity and calculating the contour continuity score.

[0066] If the average interaction intensity is lower than the preset interaction intensity threshold, then an independent defect signal and a defect type identifier are output, which can be either a linear defect identifier or a planar defect identifier.

[0067] If the average interaction intensity is higher than the preset interaction intensity threshold and the contour continuity score is higher than the preset continuity threshold, then the concurrent defect signal and the composite defect parameter set are output. The composite defect parameter set includes the linear defect length, the planar defect area and the coupling depth. The linear defect length is the sum of the perimeters of all contours in the geometric defect contour set, the planar defect area is the sum of the areas of all regions in the texture defect region set, and the coupling depth is the percentage of pixels in the peak region of the interaction intensity of the coupling feature distribution map.

[0068] If the average interaction intensity is higher than the preset interaction intensity threshold and the contour continuity score is lower than the preset continuity threshold, a high-risk defect signal will be output and an emergency stop command will be triggered.

[0069] Independent defect signals, concurrent defect signals, and high-risk defect signals are denoted as defect judgment decision signals.

[0070] Preferably, the sorting operation of the piston rings in step S5 includes:

[0071] When an independent defect signal is received, the sorting mechanism is controlled according to the defect type identifier. If the type identifier is a linear defect, the current piston ring is transferred to the laser repair station. If the type identifier is a planar defect, the current piston ring is transferred to the polishing station.

[0072] When a concurrent defect signal is received, the composite defect parameter set is read. If the coupling depth exceeds the preset repairable threshold, the current piston ring is transferred to the scrap channel.

[0073] If the coupling depth does not exceed the preset repairable threshold, the current piston ring will be transferred to the manual re-inspection channel.

[0074] Preferably, the present invention also provides a component defect identification and detection system based on an image model, used to perform the component defect identification and detection method based on an image model as described above, the component defect identification and detection system based on an image model includes:

[0075] The image acquisition module is used to acquire grating images of the piston ring surface using an industrial camera, which are denoted as the piston ring grating image to be inspected.

[0076] The defect extraction module is used to extract the closed contours of linear defects in the piston ring grating image to be inspected, generating a geometric defect contour set; and to extract the continuous regions of planar defects in the piston ring grating image to be inspected, generating a texture defect region set.

[0077] The interactive analysis module is used to locate the overlapping area between the geometric defect contour and the texture defect area based on the geometric defect contour set and the texture defect area set; it performs correlation calculation on the pixel gradient distribution and grayscale changes within the overlapping area to generate a coupling feature distribution map that characterizes the interaction strength of defects.

[0078] The fusion judgment module is used to synchronously input the geometric defect contour set, the texture defect region set and the coupled feature distribution map into the preset lightweight fusion model to generate a collaborative judgment result; and generate a defect judgment decision signal based on the collaborative judgment result.

[0079] The sorting control module is used to control the automated sorting mechanism to perform sorting operations on piston rings based on defect judgment decision signals.

[0080] The beneficial effects of this invention are mainly reflected in the following aspects:

[0081] On the one hand, through innovative image processing methods, the closed contours of linear defects and continuous areas of planar defects on the piston ring surface are accurately extracted, generating sets of geometric defect contours and texture defect regions. This effectively solves the problem of missed detection and misjudgment in traditional visual inspection systems when faced with concurrent interference from multiple types of defects, significantly improving the sensitivity and accuracy of defect detection.

[0082] On the other hand, this invention quantifies the interaction intensity of defects within overlapping regions by generating a coupled feature distribution map. This clearly identifies the boundary features of composite defects, avoids misjudgments caused by traditional algorithms relying on a single feature threshold, and effectively solves the technical challenge of concurrent interference from multiple types of defects in microscopic regions.

[0083] Furthermore, this invention introduces a lightweight fusion model to collaboratively analyze the geometric defect contour set, texture defect region set, and coupled feature distribution map, generating collaborative judgment results. This not only enables rapid processing of large amounts of image data but also generates accurate defect judgment decision signals in a short time, ensuring rapid and accurate identification and classification of piston ring surface defects in high-speed continuous production environments, significantly improving detection efficiency.

[0084] Finally, this invention uses defect judgment decision signals to control an automated sorting mechanism to perform classification operations on piston rings, achieving seamless integration of defect detection and the production process. When an independent defect is detected, the system can transfer the piston ring to the corresponding repair or processing station according to the defect type; when concurrent defects are detected, the system can determine their repairability based on the coupling depth and divert them to the scrap channel or the manual re-inspection channel. This not only improves production efficiency but also reduces manual intervention, lowers the risk of misjudgment due to human factors, significantly improves the level of production quality control, and reduces the potential risks caused by missed defect detection. Attached Figure Description

[0085] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description taken in conjunction with the accompanying drawings:

[0086] Figure 1 A flowchart illustrating the steps of an image model-based defect identification and detection method for spare parts is shown in one embodiment.

[0087] Figure 2 A detailed flowchart of step S4 of one embodiment is shown.

[0088] Figure 3 A coupling feature distribution diagram characterizing the interaction strength of defects is shown in one embodiment. Detailed Implementation

[0089] The technical method of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0090] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor methods and / or microcontroller methods.

[0091] It should be understood that although the terms "first," "second," etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are used merely to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0092] To achieve the above objectives, please refer to Figures 1 to 3 This invention provides a method for identifying and detecting defects in spare parts based on an image model, comprising the following steps:

[0093] Step S1: Acquire a grating image of the piston ring surface using an industrial camera, and record it as the grating image of the piston ring to be inspected;

[0094] Step S2: Extract the closed contours of linear defects in the grating image of the piston ring to be inspected, and generate a geometric defect contour set; extract the continuous regions of planar defects in the grating image of the piston ring to be inspected, and generate a texture defect region set.

[0095] Step S3: Locate the overlapping area of ​​the geometric defect contour and the texture defect region based on the geometric defect contour set and the texture defect region set; perform correlation calculation on the pixel gradient distribution and grayscale changes in the overlapping area to generate a coupling feature distribution map that characterizes the interaction strength of defects.

[0096] Step S4: Simultaneously input the geometric defect contour set, texture defect region set, and coupled feature distribution map into the preset lightweight fusion model to generate collaborative judgment results; generate defect judgment decision signals based on the collaborative judgment results;

[0097] Step S5: Based on the defect determination decision signal, control the automated sorting mechanism to perform a sorting operation on the piston rings.

[0098] Preferably, step S2 involves extracting the closed contour of the linear defect in the piston ring grating image to be inspected, including:

[0099] The high-frequency edge components of the piston ring grating image to be inspected are extracted using a preset first gradient operator to generate a high-frequency gradient response map;

[0100] In one implementation of this invention, the preset first gradient operator can be the Sobel operator. When processing the acquired piston ring grating image to be inspected, the Sobel operator is used to calculate the gradient magnitude of the image in both the horizontal and vertical directions. For example, at a certain pixel in the image, the gradient value in the horizontal direction is 5, and the gradient value in the vertical direction is 3. The high-frequency gradient response value at this point is calculated to be 5² + 3² = 5.83. After performing similar calculations on all pixels in the image, a high-frequency gradient response map is generated.

[0101] The low-frequency texture components of the piston ring grating image to be inspected are extracted using a preset second gradient operator to generate a low-frequency gradient response map.

[0102] In one implementation of this invention, the preset second gradient operator can be the Prewitt operator. Similar to the extraction of high-frequency edge components, the Prewitt operator is used to process the same piston ring grating image to be inspected. For example, at a certain pixel in the image, the Prewitt operator calculates a gradient value of 2 in the horizontal direction and a gradient value of 1 in the vertical direction, and the low-frequency gradient response value at this point is 2² + 1² = 2.24. After calculating for all pixels in the image, a low-frequency gradient response map is generated.

[0103] The high-frequency gradient response map and the low-frequency gradient response map are superimposed and fused pixel by pixel to generate a multi-scale gradient response map.

[0104] In one implementation of this invention, the high-frequency gradient response map and the low-frequency gradient response map are superimposed at the pixel level. Specifically, for each pixel in the image, the high-frequency gradient response value is added to the low-frequency gradient response value. For example, for a pixel in the image with a high-frequency gradient response value of 5.83 and a low-frequency gradient response value of 2.24, the superimposed gradient response value is 5.83 + 2.24 = 8.07. After performing a similar operation on all pixels in the image, a multi-scale gradient response map is generated.

[0105] Identify the highlight regions in the multi-scale gradient response map, perform gradient correction on the highlight regions, and generate an anti-reflection correction map;

[0106] For specific implementation examples of this step, please refer to the corresponding sub-step examples.

[0107] Identify low-contrast regions in multi-scale gradient response maps and perform gradient enhancement on these regions to generate weak edge enhancement maps.

[0108] For specific implementation examples of this step, please refer to the corresponding sub-step examples.

[0109] Geometric defect contour sets are extracted based on anti-reflective correction maps and weak edge enhancement maps.

[0110] For specific implementation examples of this step, please refer to the corresponding sub-step examples.

[0111] Preferably, identifying highlight regions in the multi-scale gradient response map and performing gradient correction on the highlight regions includes:

[0112] Calculate the average brightness of each pixel neighborhood in the multi-scale gradient response map. If the average brightness is greater than or equal to a preset highlight threshold, the corresponding pixel neighborhood is determined to be a highlight region. The calculation window size of the pixel neighborhood is the preset neighborhood window size.

[0113] In one implementation of this invention, a preset specular threshold of 200 (grayscale value range of 0-255) is assumed, and the preset neighborhood window size is 3×3 pixels. For each pixel in the multi-scale gradient response map, the average brightness value within its 3×3 neighborhood is calculated. For example, for the pixel at coordinates (100, 150) in the image, the pixel brightness values ​​within its 3×3 neighborhood are 210, 215, 220, 205, 225, 230, 210, 215, and 220, respectively, resulting in a calculated average brightness value of 216.67. Since this average brightness value is greater than the preset specular threshold of 200, the neighborhood of this pixel is determined to be a specular region.

[0114] Read the gradient value at the location corresponding to the highlight area in the high-frequency gradient response map;

[0115] In one implementation of this invention, the position corresponding to the pixel determined to be a highlight region is found in the high-frequency gradient response map. Assume that the gradient value of the pixel at coordinates (100, 150) in the high-frequency gradient response map is 8.5. This gradient value represents the gradient intensity of the pixel in the high-frequency edge component.

[0116] The attenuation coefficient is calculated based on the average brightness value. The specific formula for calculating the attenuation coefficient is as follows:

[0117] Attenuation coefficient = 1 / (1 + k × mean luminance);

[0118] Where k is the preset material reflectivity;

[0119] In one implementation of this invention, it is assumed that the preset material reflectivity k is 0.005. For the calculated average brightness of 216.67, the attenuation coefficient is calculated according to the above formula:

[0120] Multiply the gradient value by the attenuation coefficient to generate the anti-reflection correction value, update the gradient value of the current pixel to the anti-reflection correction value, and generate the anti-reflection correction map.

[0121] In one implementation of this invention, the read gradient value 8.5 is multiplied by the calculated attenuation coefficient 0.479 to obtain the anti-reflection correction value: Anti-reflection correction value = 8.5 × 0.479 = 4.07. This correction value is assigned to the pixel at coordinates (100, 150) in the multi-scale gradient response map, updating its gradient value to 4.07. A similar operation is performed on all highlight region pixels in the image to generate the anti-reflection correction map.

[0122] Preferably, identifying low-contrast regions in the multi-scale gradient response map and performing gradient enhancement on these low-contrast regions includes:

[0123] Calculate the gradient standard deviation of each pixel neighborhood in the multi-scale gradient response map. If the gradient standard deviation is less than or equal to the preset contrast threshold, the corresponding pixel neighborhood is determined to be a low contrast region. The calculation window size of the pixel neighborhood is the preset neighborhood window size.

[0124] In one implementation of this invention, a preset contrast threshold of 1.5 is assumed, and a preset neighborhood window size of 3×3 pixels is assumed. For each pixel in the multi-scale gradient response map, the gradient standard deviation within its 3×3 neighborhood is calculated. For example, for a pixel with coordinates (200, 250) in the image, the gradient values ​​within its 3×3 neighborhood are 1.2, 1.3, 1.4, 1.1, 1.5, 1.6, 1.2, 1.3, and 1.4, respectively, and the calculated gradient standard deviation is 0.15. Since this gradient standard deviation is less than the preset contrast threshold of 1.5, the neighborhood of this pixel is determined to be a low-contrast region.

[0125] Read the gradient value at the corresponding position in the low-contrast region of the low-frequency gradient response graph;

[0126] In one implementation of this invention, the location corresponding to a pixel identified as a low-contrast region is found in the low-frequency gradient response map. For example, in the low-frequency gradient response map, the pixel with coordinates (200, 250) has a gradient value of 1.2. This gradient value represents the gradient intensity of that pixel in the low-frequency texture component.

[0127] A sigmoid gain function is used to enhance the gradient value. The sigmoid gain function is as follows:

[0128]

[0129] Where s is the preset sharpening intensity parameter;

[0130] In one implementation of this invention, it is assumed that the preset maximum gradient value is 10 and the preset sharpening intensity parameter s is 5. For a read gradient value of 1.2, the enhancement value is calculated according to the above formula:

[0131] Update the gradient value of the current pixel to the enhancement value, and generate a weak edge enhancement map.

[0132] In one implementation of this invention, the calculated enhancement value of 6.45 is assigned to the pixel at coordinates (200, 250) in the multi-scale gradient response map, updating its gradient value to 6.45. A similar operation is performed on all low-contrast region pixels in the image to generate a weak edge enhancement map.

[0133] Preferably, the extraction of the geometric defect contour set based on the anti-reflection correction map and the weak edge enhancement map includes:

[0134] Statistically analyze the gradient distribution histograms of the anti-reflective correction map and the weak edge enhancement map respectively;

[0135] In one implementation of this invention, it is assumed that both the anti-reflective correction image and the weak edge enhancement image are 512×512 pixels in size. For the anti-reflective correction image, the distribution of its gradient values ​​is statistically analyzed to obtain a gradient distribution histogram. For example, the number of pixels with gradient values ​​in the range of 0-2 is 1000, the number of pixels in the range of 2-4 is 800, the number of pixels in the range of 4-6 is 600, and so on. Similarly, for the weak edge enhancement image, the distribution of its gradient values ​​is statistically analyzed to obtain a gradient distribution histogram. For example, the number of pixels with gradient values ​​in the range of 0-2 is 500, the number of pixels in the range of 2-4 is 700, the number of pixels in the range of 4-6 is 900, and so on.

[0136] The gradient threshold of the p-th percentile is determined based on the gradient distribution histogram, where p is a preset percentile parameter;

[0137] In one implementation of this invention, it is assumed that the preset percentile parameter p is 90%. For the anti-reflective correction image, the gradient value that makes the cumulative pixel count reach 90% of the total pixel count is found based on its gradient distribution histogram. Assuming the total pixel count of the anti-reflective correction image is 262144 (512×512), the cumulative pixel count corresponding to the 90th percentile is 235930 (262144×0.9). By looking up the gradient distribution histogram, the gradient threshold for the 90th percentile is determined to be 6.5. For the weak edge enhancement image, similarly based on its gradient distribution histogram, the gradient threshold for the 90th percentile is determined to be 7.0.

[0138] Iterate through each pixel of the anti-reflection correction map and the weak edge enhancement map.

[0139] In one implementation of this invention, each pixel of each image is checked one by one. Assume the pixel currently being processed is located at coordinates (100, 150) in the anti-reflection correction map, with a gradient value of 7.2; meanwhile, the pixel at the same location in the weak edge enhancement map has a gradient value of 6.8.

[0140] If the gradient value of the current pixel is greater than or equal to the gradient threshold of the pth percentile, then the neighborhood of the pixel is subjected to a closing operation using the preset first structuring element.

[0141] In one implementation of this invention, it is assumed that the preset first structuring element is a 3×3 rectangular structuring element. For the pixel at coordinates (100, 150) in the anti-reflection correction map, its gradient value of 7.2 is greater than the 90th percentile gradient threshold of 6.5, therefore, a closing operation is performed on the 3×3 neighborhood of this pixel. The closing operation includes a dilation followed by an erosion operation to fill holes and connect broken parts. It is assumed that after the closing operation, the gradient value in this neighborhood is adjusted to 7.5. For the pixel at the same position in the weak edge enhancement map, its gradient value of 6.8 is less than the 90th percentile gradient threshold of 7.0, therefore, no closing operation is performed on it.

[0142] If the gradient value of the current pixel is less than the gradient threshold of the pth percentile, then the neighborhood of the pixel is subjected to a closing operation using a preset second structuring element, where the preset first structuring element is less than the preset second structuring element.

[0143] In one implementation of this invention, it is assumed that the preset second structuring element is a 5×5 rectangular structuring element. For the pixel at coordinates (100, 150) in the weak edge enhancement map, its gradient value of 6.8 is less than the 90th percentile gradient threshold of 7.0. Therefore, a closing operation is performed on the 5×5 neighborhood of this pixel. Since the second structuring element is relatively large, the effect of the closing operation will be more obvious, and it can better fill larger broken parts. It is assumed that after the closing operation, the gradient value in this neighborhood is adjusted to 7.2.

[0144] The anti-reflective correction map and the weak edge enhancement map after the closing operation are combined by taking the maximum value of each pixel to generate a comprehensive gradient map.

[0145] In one implementation of this invention, for the anti-reflective correction map and the weak edge enhancement map after closing operations, the gradient values ​​are compared pixel by pixel, and the larger value is taken as the pixel value of the comprehensive gradient map. For example, for the pixel at coordinates (100, 150), the gradient value of the anti-reflective correction map is 7.5, and the gradient value of the weak edge enhancement map is 7.2. Therefore, the pixel value at this position in the comprehensive gradient map is 7.5. After performing similar operations on all pixels, the comprehensive gradient map is generated.

[0146] Contour extraction is performed on the comprehensive gradient map to generate a closed, continuous set of contours, denoted as the geometric defect contour set.

[0147] In one implementation of this invention, an image processing algorithm (such as the Canny edge detection algorithm) is used to extract contours from the composite gradient map. Assume that the detected contours in the composite gradient map include a large closed contour, indicating a large linear defect; and some smaller closed contours, indicating smaller linear defects. All detected closed contours are collected to form a geometric defect contour set. For example, the geometric defect contour set contains three closed contours, each representing a different linear defect region.

[0148] Preferably, step S2 involves extracting a continuous region of planar defects in the piston ring grating image to be inspected, including:

[0149] The piston ring grating image to be inspected is divided into multiple analysis regions of preset scales, generating large-scale region sets, medium-scale region sets, and small-scale region sets; among them, large-scale regions are used to capture macroscopic color spots, medium-scale regions are used to capture transitional color spots, and small-scale regions are used to capture microscopic color spots.

[0150] In one implementation of this invention, it is assumed that the size of the piston ring grating image to be inspected is 1024×1024 pixels. The image is divided into analysis regions of the following three scales:

[0151] Large-scale region set: The image is divided into 8×8 regions, each region being 128×128 pixels in size. These regions are used to capture macroscopic color spots.

[0152] Medium-scale region set: The image is divided into 16×16 regions, each 64×64 pixels in size. These regions are used to capture transitional color patches.

[0153] Small-scale region set: The image is divided into 32×32 regions, each region being 32×32 pixels in size. These regions are used to capture microscopic color spots.

[0154] Traverse the analysis region for each scale region:

[0155] Analyze the gray-level histogram of the current analysis area and calculate the gray-level mean and standard deviation.

[0156] In one implementation of this invention, for a region with a large-scale area concentration (e.g., a 128×128 pixel region in the upper left corner), its grayscale histogram is calculated. Assuming the grayscale value distribution of this region is as follows: grayscale values ​​0-31: 100 pixels; grayscale values ​​32-63: 200 pixels; grayscale values ​​64-95: 300 pixels; grayscale values ​​96-127: 400 pixels; grayscale values ​​128-159: 500 pixels; grayscale values ​​160-191: 600 pixels; grayscale values ​​192-223: 700 pixels; grayscale values ​​224-255: 800 pixels, the calculated grayscale mean is 128, and the standard deviation is 64.

[0157] The segmentation threshold is calculated based on the grayscale mean and standard deviation. The formula for calculating the segmentation threshold is as follows:

[0158] Segmentation threshold = mean gray level + k × standard deviation;

[0159] Where k is the preset sensitivity coefficient;

[0160] In one implementation of this invention, it is assumed that the preset sensitivity coefficient k is 2. For the calculated grayscale mean of 128 and standard deviation of 64, the segmentation threshold is calculated as: Segmentation threshold = 128 + 2 × 64 = 256.

[0161] Pixels with gray values ​​greater than the segmentation threshold are marked as candidate defect pixels, and a candidate defect pixel set is generated.

[0162] In one implementation of this invention, within the aforementioned 128×128 pixel region, assuming there are 100 pixels with a grayscale value greater than 256, these pixels are marked as candidate defect pixels. The coordinates of these pixels are recorded to form a set of candidate defect pixels.

[0163] If candidate defect pixels concentrated in large-scale regions spatially overlap with candidate defect pixels concentrated in medium-scale regions, then the candidate defect pixels in the overlapping regions will be merged into the same color spot region.

[0164] In one implementation of this invention, it is assumed that there is a set of candidate defect pixels in a large-scale region with center coordinates (64, 64), and another set of candidate defect pixels in a medium-scale region with center coordinates (64, 64). Since these two regions overlap spatially, they are merged into a single color-patterned region. The merged color-patterned region contains all overlapping candidate defect pixels.

[0165] If candidate defect pixels concentrated in the medium-scale region spatially overlap with candidate defect pixels concentrated in the small-scale region, then the candidate defect pixels in the overlapping region will be merged into the same color spot region.

[0166] In one implementation of this invention, it is assumed that there is a set of candidate defect pixels in a medium-scale region with center coordinates (64, 64), and a set of candidate defect pixels in a small-scale region with center coordinates (64, 64). Since these two regions overlap spatially, they are merged into a single color-patterned region. The merged color-patterned region contains all overlapping candidate defect pixels.

[0167] Perform a morphological closing operation on the merged color spot regions to generate a set of texture defect regions.

[0168] In one implementation of this invention, it is assumed that the merged color spot region is an irregular shape containing multiple broken parts. Morphological closing operations (dilation followed by erosion) are used to fill these broken parts, making the color spot region more complete. Assuming a 3×3 structuring element is used for the closing operation, the processed color spot region becomes more continuous and closed. All processed color spot regions are collected to form a texture defect region set.

[0169] Preferably, step S3 includes:

[0170] Traverse the spatial coordinates of the geometric defect contour set and the texture defect region set, and identify the pixel region where the geometric defect contour and the texture defect region intersect as the overlapping region.

[0171] In one implementation of this invention, it is assumed that the geometric defect contour set contains a contour with coordinates ranging from (100, 100) to (200, 200), and the texture defect region set contains a region with coordinates ranging from (150, 150) to (250, 250). By comparing the coordinate ranges of these two regions, their overlapping region is identified as (150, 150) to (200, 200).

[0172] Calculate the standard deviation of the gradient values ​​of all pixels within the overlapping region, and denot it as the gradient standard deviation;

[0173] In one implementation of this invention, the pixel gradient values ​​within the overlapping region are assumed to be 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, and 9.0, respectively. The standard deviation of these gradient values ​​is calculated, and the standard deviation is found to be 1.5.

[0174] Calculate the coefficient of variation of the gray values ​​of all pixels in the overlapping region, denoted as the gray value coefficient of variation, where the coefficient of variation = standard deviation of gray values ​​of all pixels in the overlapping region / mean of gray values ​​of all pixels in the overlapping region;

[0175] In one implementation of this invention, it is assumed that the pixel grayscale values ​​within the overlapping region are 120, 125, 130, 135, 140, 145, 150, 155, and 160, respectively. The mean of these grayscale values ​​is calculated to be 140, and the standard deviation is 15. Therefore, the grayscale variation coefficient is: Grayscale variation coefficient = 15 / 140 ≈ 0.107.

[0176] Multiply the gradient standard deviation by the gray-level variation coefficient to generate the local interference coefficient characterizing the intensity of defect interaction;

[0177] In one implementation of this invention, the calculated gradient standard deviation of 1.5 is multiplied by the calculated gray-scale variation coefficient of 0.107 to obtain the local interference coefficient: Local interference coefficient = 1.5 × 0.107 ≈ 0.1605.

[0178] Extract the smallest bounding rectangle of the geometric defect contour, denoted as the contour outline;

[0179] In one implementation of this invention, assuming the coordinate range of the geometric defect contour is (100, 100) to (200, 200), the minimum bounding rectangle of the contour is extracted, with its coordinate range being (100, 100) to (200, 200).

[0180] Calculate the minimum distance between the outline and the boundary of the texture defect region;

[0181] In one implementation of this invention, it is assumed that the coordinate range of the texture defect region is (150, 150) to (250, 250), and the coordinate range of the outline is (100, 100) to (200, 200). The minimum distance between the outline and the boundary of the texture defect region is calculated, and the minimum distance is -50 (a negative value indicates that the outline completely surrounds the texture defect region).

[0182] If the minimum distance is negative and its absolute value is greater than or equal to the preset minimum distance threshold, then the topological relationship between the geometric defect contour and the texture defect region is determined to be a complete enclosed relationship.

[0183] In one implementation of this invention, it is assumed that the preset minimum distance threshold is -20. Since the calculated minimum distance is -50, the absolute value is greater than the preset minimum distance threshold, therefore the topological relationship between the geometric defect contour and the texture defect region is determined to be a complete encirclement.

[0184] If the minimum distance is positive and less than the preset minimum distance threshold, the topological relationship between the geometric defect contour and the texture defect region is determined to be cross-penetration;

[0185] In one implementation of this invention, it is assumed that the coordinate range of another geometric defect contour is (300, 300) to (400, 400), and the coordinate range of the texture defect region is (350, 350) to (450, 450). The minimum distance between the contour outline and the boundary of the texture defect region is calculated, and the minimum distance is found to be 10 (a positive value indicates that the contour outline and the texture defect region partially overlap). Assuming that the preset minimum distance threshold is 20, since the minimum distance is 10, which is less than the preset minimum distance threshold, the topological relationship between the geometric defect contour and the texture defect region is determined to be intersecting.

[0186] If the topological relationship between the geometric defect contour and the texture defect region is a complete enclosing relationship, then the current overlapping region is assigned a preset first weight value;

[0187] In one implementation of this invention, a preset first weight value is assumed to be 1.5. Since the topological relationship between the geometric defect contour and the texture defect region is determined to be a complete encirclement, the current overlapping region is assigned a weight value of 1.5.

[0188] If the topological relationship between the geometric defect contour and the texture defect region is a cross-penetration relationship, then a preset second weight value is assigned to the current overlapping region, wherein the preset first weight value is greater than the preset second weight value;

[0189] In one implementation of this invention, a preset second weight value is assumed to be 0.8. Since the topological relationship between the geometric defect contour and the texture defect region is determined to be intersecting, a weight value of 0.8 is assigned to the current overlapping region.

[0190] Multiply the local interference coefficients by the corresponding topological weight values ​​to generate the coupling feature values ​​of the current overlapping region;

[0191] In one implementation of this invention, for overlapping regions with a complete enclosing relationship, the calculated local interference coefficient of 0.1605 is multiplied by the assigned weight value of 1.5 to obtain the coupling characteristic value: Coupling characteristic value = 0.1605 × 1.5 = 0.24075. For overlapping regions with a penetrating relationship, the local interference coefficient of 0.1605 is multiplied by the assigned weight value of 0.8 to obtain the coupling characteristic value: Coupling characteristic value = 0.1605 × 0.8 = 0.1284.

[0192] Traverse all overlapping regions, map the coupling feature values ​​to the image coordinate system, and generate a coupling feature distribution map that characterizes the intensity of defect interaction.

[0193] In one implementation of this invention, it is assumed that there are two overlapping regions in the image. One overlapping region has a completely enclosing relationship with a coupling feature value of 0.24075, and the other overlapping region has a crossing relationship with a coupling feature value of 0.1284. These coupling feature values ​​are mapped to the image coordinate system to generate a coupling feature distribution map. For example, the coupling feature value of 0.24075 for the completely enclosing overlapping region is mapped to coordinates (150, 150) to (200, 200), and the coupling feature value of 0.1284 for the crossing overlapping region is mapped to coordinates (350, 350) to (400, 400). In this way, the generated coupling feature distribution map can intuitively reflect the intensity of defect interaction between different overlapping regions.

[0194] Preferably, step S4 includes:

[0195] Step S41: Input the geometric defect contour set, texture defect region set and coupling feature distribution map into the preset lightweight fusion model. The co-analysis of the preset lightweight fusion model includes extracting the mean of interaction intensity and calculating the contour continuity score.

[0196] In one implementation of this invention, the preset lightweight fusion model adopts a convolutional neural network (CNN) architecture, specifically constructed as follows: Input layer: Receives a set of geometric defect contours, a set of texture defect regions, and a coupling feature distribution map as input. Each input data point is 256×256 pixels in size. Feature extraction layer: Contains two convolutional layers, each followed by a max-pooling layer. The first convolutional layer has 16 3×3 kernels, and the second convolutional layer has 32 3×3 kernels. The max-pooling layer has a 2×2 pooling window. Fusion layer: Performs channel-level fusion of the output feature maps from the two convolutional layers to obtain a comprehensive feature map. Fully connected layer: Flattens the comprehensive feature map and inputs it into a fully connected layer with 128 neurons and ReLU activation function. Output layer: Contains two output nodes, used to output the mean interaction intensity and the contour continuity score, respectively. The mean interaction intensity represents the average intensity of defect interactions in the coupling feature distribution map, and the contour continuity score represents the degree of continuity of the geometric defect contours. Training process: The model was trained using a labeled dataset (containing images of known defect types) with a mean squared error loss function and the Adam optimization algorithm, at a learning rate of 0.001. After training, the model can quickly analyze the input image data and output the mean interaction intensity and contour continuity score.

[0197] Step S42: If the average interaction intensity is lower than the preset interaction intensity threshold, output an independent defect signal and a defect type identifier, which is either a linear defect identifier or a planar defect identifier.

[0198] In one implementation of this invention, a preset interaction strength threshold is assumed to be 0.1. The average interaction strength calculated by the lightweight fusion model is 0.08, which is lower than the preset threshold. In this case, the model outputs independent defect signals and determines the defect type based on the characteristics of the geometric defect contour set and the texture defect region set. Assuming the characteristics of the geometric defect contour set are more significant, the model outputs a linear defect identifier.

[0199] Step S43: If the average interaction intensity is higher than the preset interaction intensity threshold and the contour continuity score is higher than the preset continuity threshold, then output the concurrent defect signal and the composite defect parameter set. The composite defect parameter set includes the linear defect length, the planar defect area and the coupling depth. The linear defect length is the sum of the perimeters of all contours in the geometric defect contour set. The planar defect area is the sum of the areas of all regions in the texture defect region set. The coupling depth is the percentage of pixels in the peak region of the interaction intensity of the coupling feature distribution map.

[0200] In one implementation of this invention, it is assumed that the preset interaction intensity threshold is 0.1 and the preset continuity threshold is 0.8. The average interaction intensity calculated by the lightweight fusion model is 0.12, which is higher than the preset interaction intensity threshold; the contour continuity score is 0.85, which is higher than the preset continuity threshold. At this time, the model outputs concurrent defect signals and calculates the composite defect parameter set:

[0201] Linear defect length: The sum of the perimeters of all contours in the geometric defect contour set is 500 pixels.

[0202] Area of ​​surface defects: The cumulative sum of the surfaces of all regions in the texture defect area is 2000 pixels².

[0203] Coupling depth: The percentage of pixels in the peak region of interaction intensity in the coupling feature distribution map is 0.3.

[0204] The model outputs a set of composite defect parameters as follows: {linear defect length: 500 pixels, area of ​​planar defect: 2000 pixels², coupling depth: 0.3}.

[0205] Step S44: If the average interaction intensity is higher than the preset interaction intensity threshold and the contour continuity score is lower than the preset continuity threshold, then output a high-risk defect signal and trigger an emergency stop command.

[0206] In one implementation of this invention, it is assumed that the preset interaction strength threshold is 0.1 and the preset continuity threshold is 0.8. The average interaction strength calculated by the lightweight fusion model is 0.12, which is higher than the preset interaction strength threshold; however, the contour continuity score is 0.7, which is lower than the preset continuity threshold. At this time, the model outputs a high-risk defect signal and triggers an emergency stop command to prevent potential serious defects from causing equipment damage or safety issues.

[0207] Step S45: Record the independent defect signal / concurrent defect signal / high-risk defect signal as the defect judgment decision signal.

[0208] In one implementation of this invention, the corresponding signals are recorded as defect determination decision signals based on the output results of steps S42, S43, and S44. For example, if the model outputs an independent defect signal and a linear defect identifier, the defect determination decision signal is {independent defect signal, linear defect identifier}; if the model outputs a concurrent defect signal and a composite defect parameter set, the defect determination decision signal is {concurrent defect signal, composite defect parameter set}; if the model outputs a high-risk defect signal, the defect determination decision signal is {high-risk defect signal}.

[0209] Preferably, the sorting operation of the piston rings in step S5 includes:

[0210] When an independent defect signal is received, the sorting mechanism is controlled according to the defect type identifier. If the type identifier is a linear defect, the current piston ring is transferred to the laser repair station. If the type identifier is a planar defect, the current piston ring is transferred to the polishing station.

[0211] In one implementation of this invention, assume the detection system receives an independent defect signal, and the defect type is identified as a linear defect. In this case, the control system sends a command to the sorting mechanism based on the defect type identifier, transferring the current piston ring to the laser repair station. For example, the control system uses an industrial robot to move the piston ring from the detection station to the laser repair station, preparing it for subsequent repair processing.

[0212] In one implementation of this invention, assume the detection system receives an independent defect signal, and the defect type is identified as a planar defect. In this case, the control system sends a command to the sorting mechanism based on the defect type identifier, transferring the current piston ring to the polishing station. For example, the control system moves the piston ring from the detection station to the polishing station via a conveyor belt, preparing it for subsequent polishing processing.

[0213] When a concurrent defect signal is received, the composite defect parameter set is read. If the coupling depth exceeds the preset repairable threshold, the current piston ring is transferred to the scrap channel.

[0214] In one implementation of this invention, assume the detection system receives a concurrent defect signal and simultaneously reads a composite defect parameter set of {linear defect length: 500 pixels, area of ​​planar defect: 2000 pixels², coupling depth: 0.3}. Assume the preset repairable threshold is 0.25. Since the coupling depth of 0.3 exceeds the preset repairable threshold of 0.25, the control system determines that the defect in the piston ring is unrepairable and therefore transfers the current piston ring to the scrap channel. For example, the control system moves the piston ring from the detection station to the scrap channel via a sorting mechanism, preparing it for subsequent scrapping processing.

[0215] If the coupling depth does not exceed the preset repairable threshold, the current piston ring will be transferred to the manual re-inspection channel.

[0216] In one implementation of this invention, assume the detection system receives a concurrent defect signal and simultaneously reads a composite defect parameter set of {linear defect length: 300 pixels, area of ​​planar defect: 1000 pixels², coupling depth: 0.2}. Assume the preset repairability threshold is 0.25. Since the coupling depth of 0.2 does not exceed the preset repairability threshold of 0.25, the control system determines that the defect in the piston ring can be further confirmed by manual re-inspection to determine whether it is repairable. Therefore, the current piston ring is transferred to the manual re-inspection channel. For example, the control system moves the piston ring from the detection station to the manual re-inspection channel through a sorting mechanism, preparing it for further manual inspection and evaluation.

[0217] Preferably, the present invention also provides a component defect identification and detection system based on an image model, used to perform the component defect identification and detection method based on an image model as described above, the component defect identification and detection system based on an image model includes:

[0218] The image acquisition module is used to acquire grating images of the piston ring surface using an industrial camera, which are denoted as the piston ring grating image to be inspected.

[0219] The defect extraction module is used to extract the closed contours of linear defects in the piston ring grating image to be inspected, generating a geometric defect contour set; and to extract the continuous regions of planar defects in the piston ring grating image to be inspected, generating a texture defect region set.

[0220] The interactive analysis module is used to locate the overlapping area between the geometric defect contour and the texture defect area based on the geometric defect contour set and the texture defect area set; it performs correlation calculation on the pixel gradient distribution and grayscale changes within the overlapping area to generate a coupling feature distribution map that characterizes the interaction strength of defects.

[0221] The fusion judgment module is used to synchronously input the geometric defect contour set, the texture defect region set and the coupled feature distribution map into the preset lightweight fusion model to generate a collaborative judgment result; and generate a defect judgment decision signal based on the collaborative judgment result.

[0222] The sorting control module is used to control the automated sorting mechanism to perform sorting operations on piston rings based on defect judgment decision signals.

[0223] Therefore, the embodiments should be considered as exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of the equivalents of the application are intended to be included within the invention.

[0224] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features of the invention herein.

Claims

1. A method for identifying and detecting defects in spare parts based on an image model, characterized in that, Includes the following steps: Step S1: Acquire a grating image of the piston ring surface using an industrial camera, and record it as the grating image of the piston ring to be inspected; Step S2: Extract the closed contours of linear defects in the grating image of the piston ring to be inspected, and generate a geometric defect contour set; extract the continuous regions of planar defects in the grating image of the piston ring to be inspected, and generate a texture defect region set. Step S3: Locate the overlapping area of ​​the geometric defect contour and the texture defect region based on the geometric defect contour set and the texture defect region set; perform correlation calculation on the pixel gradient distribution and grayscale changes in the overlapping area to generate a coupling feature distribution map that characterizes the interaction strength of defects. Step S4: Simultaneously input the geometric defect contour set, texture defect region set, and coupled feature distribution map into the preset lightweight fusion model to generate collaborative judgment results; Generate defect determination decision signals based on collaborative determination results; Step S5: Based on the defect determination decision signal, control the automated sorting mechanism to perform a sorting operation on the piston rings.

2. The image model-based defect identification and detection method for spare parts according to claim 1, characterized in that, Step S2 involves extracting the closed contour of the linear defect in the grating image of the piston ring to be inspected, including: The high-frequency edge components of the piston ring grating image to be inspected are extracted using a preset first gradient operator to generate a high-frequency gradient response map; The low-frequency texture components of the piston ring grating image to be inspected are extracted using a preset second gradient operator to generate a low-frequency gradient response map. The high-frequency gradient response map and the low-frequency gradient response map are superimposed and fused pixel by pixel to generate a multi-scale gradient response map. Identify the highlight regions in the multi-scale gradient response map, perform gradient correction on the highlight regions, and generate an anti-reflection correction map; Identify low-contrast regions in multi-scale gradient response maps and perform gradient enhancement on these regions to generate weak edge enhancement maps. Geometric defect contour sets are extracted based on anti-reflective correction maps and weak edge enhancement maps.

3. The image model-based defect identification and detection method for spare parts according to claim 2, characterized in that, Identifying highlight regions in multi-scale gradient response maps and performing gradient correction on these regions includes: Calculate the average brightness of each pixel neighborhood in the multi-scale gradient response map. If the average brightness is greater than or equal to the preset highlight threshold, the corresponding pixel neighborhood is determined to be a highlight region. The calculation window size of the pixel neighborhood is the preset neighborhood window size. Read the gradient value at the location corresponding to the highlight area in the high-frequency gradient response map; The attenuation coefficient is calculated based on the average brightness value. The specific formula for calculating the attenuation coefficient is as follows: Attenuation coefficient = 1 / (1 + k × mean luminance); Where k is the preset material reflectivity; Multiply the gradient value by the attenuation coefficient to generate the anti-reflection correction value, update the gradient value of the current pixel to the anti-reflection correction value, and generate the anti-reflection correction map.

4. The image model-based defect identification and detection method for spare parts according to claim 2, characterized in that, Identifying low-contrast regions in multi-scale gradient response maps and performing gradient enhancement on these regions includes: Calculate the gradient standard deviation of each pixel neighborhood in the multi-scale gradient response map. If the gradient standard deviation is less than or equal to the preset contrast threshold, the corresponding pixel neighborhood is determined to be a low contrast region. The calculation window size of the pixel neighborhood is the preset neighborhood window size. Read the gradient value at the corresponding position in the low-contrast region of the low-frequency gradient response graph; A sigmoid gain function is used to enhance the gradient value. The sigmoid gain function is as follows: Where s is the preset sharpening intensity parameter; Update the gradient value of the current pixel to the enhancement value, and generate a weak edge enhancement map.

5. The image model-based defect identification and detection method for spare parts according to claim 2, characterized in that, The geometric defect contour set extracted based on the anti-reflective correction map and the weak edge enhancement map includes: Statistically analyze the gradient distribution histograms of the anti-reflective correction map and the weak edge enhancement map respectively; The gradient threshold of the p-th percentile is determined based on the gradient distribution histogram, where p is a preset percentile parameter; Traverse each pixel of the anti-reflection correction map and the weak edge enhancement map. If the gradient value of the current pixel is greater than or equal to the p-th percentile gradient threshold, then perform a closing operation on the neighborhood of the pixel using the preset first structuring element. If the gradient value of the current pixel is less than the gradient threshold of the pth percentile, then the neighborhood of the pixel is subjected to a closing operation using a preset second structuring element, where the preset first structuring element is less than the preset second structuring element. The anti-reflective correction map and the weak edge enhancement map after the closing operation are combined by taking the maximum value of each pixel to generate a comprehensive gradient map. Contour extraction is performed on the comprehensive gradient map to generate a closed, continuous set of contours, denoted as the geometric defect contour set.

6. The method for identifying and detecting defects in spare parts based on an image model according to claim 1, characterized in that, Step S2 extracts the continuous region of planar defects in the grating image of the piston ring to be inspected, including: The piston ring grating image to be inspected is divided into multiple analysis regions of preset scales, generating large-scale region sets, medium-scale region sets, and small-scale region sets; among them, large-scale regions are used to capture macroscopic color spots, medium-scale regions are used to capture transitional color spots, and small-scale regions are used to capture microscopic color spots. Traverse the analysis region for each scale region: Analyze the gray-level histogram of the current analysis area and calculate the gray-level mean and standard deviation. The segmentation threshold is calculated based on the grayscale mean and standard deviation. The formula for calculating the segmentation threshold is as follows: Segmentation threshold = mean gray level + k × standard deviation; Where k is the preset sensitivity coefficient; Pixels with gray values ​​greater than the segmentation threshold are marked as candidate defect pixels, and a candidate defect pixel set is generated. If candidate defect pixels concentrated in large-scale regions spatially overlap with candidate defect pixels concentrated in medium-scale regions, then the candidate defect pixels in the overlapping regions will be merged into the same color spot region. If candidate defect pixels concentrated in the medium-scale region spatially overlap with candidate defect pixels concentrated in the small-scale region, then the candidate defect pixels in the overlapping region will be merged into the same color spot region. Perform a morphological closing operation on the merged color spot regions to generate a set of texture defect regions.

7. The method for identifying and detecting defects in spare parts based on an image model according to claim 1, characterized in that, Step S3 includes: Traverse the spatial coordinates of the geometric defect contour set and the texture defect region set, and identify the pixel region where the geometric defect contour and the texture defect region intersect as the overlapping region. Calculate the standard deviation of the gradient values ​​of all pixels within the overlapping region, and denot it as the gradient standard deviation; Calculate the coefficient of variation of the gray values ​​of all pixels in the overlapping region, denoted as the gray value coefficient of variation, where the coefficient of variation = standard deviation of gray values ​​of all pixels in the overlapping region / mean of gray values ​​of all pixels in the overlapping region; Multiply the gradient standard deviation by the gray-level variation coefficient to generate the local interference coefficient characterizing the intensity of defect interaction; Extract the smallest bounding rectangle of the geometric defect contour, denoted as the contour outline; Calculate the minimum distance between the outline and the boundary of the texture defect region; If the minimum distance is negative and its absolute value is greater than or equal to the preset minimum distance threshold, then the topological relationship between the geometric defect contour and the texture defect region is determined to be a complete enclosed relationship. If the minimum distance is positive and less than the preset minimum distance threshold, the topological relationship between the geometric defect contour and the texture defect region is determined to be cross-penetration; If the topological relationship between the geometric defect contour and the texture defect region is a complete enclosing relationship, then the current overlapping region is assigned a preset first weight value; If the topological relationship between the geometric defect contour and the texture defect region is a cross-penetration relationship, then a preset second weight value is assigned to the current overlapping region, wherein the preset first weight value is greater than the preset second weight value; Multiply the local interference coefficients by the corresponding topological weight values ​​to generate the coupling feature values ​​of the current overlapping region; Traverse all overlapping regions, map the coupling feature values ​​to the image coordinate system, and generate a coupling feature distribution map that characterizes the intensity of defect interaction.

8. The method for identifying and detecting defects in spare parts based on an image model according to claim 1, characterized in that, Step S4 includes: The geometric defect contour set, texture defect region set, and coupling feature distribution map are input into a preset lightweight fusion model. The collaborative analysis of the preset lightweight fusion model includes extracting the mean of interaction intensity and calculating the contour continuity score. If the average interaction intensity is lower than the preset interaction intensity threshold, then an independent defect signal and a defect type identifier are output, which can be either a linear defect identifier or a planar defect identifier. If the average interaction intensity is higher than the preset interaction intensity threshold and the contour continuity score is higher than the preset continuity threshold, then the concurrent defect signal and the composite defect parameter set are output. The composite defect parameter set includes the linear defect length, the planar defect area and the coupling depth. The linear defect length is the sum of the perimeters of all contours in the geometric defect contour set, the planar defect area is the sum of the areas of all regions in the texture defect region set, and the coupling depth is the percentage of pixels in the peak region of the interaction intensity of the coupling feature distribution map. If the average interaction intensity is higher than the preset interaction intensity threshold and the contour continuity score is lower than the preset continuity threshold, a high-risk defect signal will be output and an emergency stop command will be triggered. Independent defect signals, concurrent defect signals, and high-risk defect signals are denoted as defect judgment decision signals.

9. The method for identifying and detecting defects in spare parts based on an image model according to claim 1, characterized in that, Step S5, which involves sorting the piston rings, includes: When an independent defect signal is received, the sorting mechanism is controlled according to the defect type identifier. If the type identifier is a linear defect, the current piston ring is transferred to the laser repair station. If the type identifier is a planar defect, the current piston ring is transferred to the polishing station. When a concurrent defect signal is received, the composite defect parameter set is read. If the coupling depth exceeds the preset repairable threshold, the current piston ring is transferred to the scrap channel. If the coupling depth does not exceed the preset repairable threshold, the current piston ring will be transferred to the manual re-inspection channel.

10. A component defect identification and detection system based on image models, characterized in that, For performing the image model-based component defect identification and detection method as described in claim 1, the image model-based component defect identification and detection system comprises: The image acquisition module is used to acquire grating images of the piston ring surface using an industrial camera, which are denoted as the piston ring grating image to be inspected. The defect extraction module is used to extract the closed contours of linear defects in the piston ring grating image to be inspected, and generate a geometric defect contour set; and to extract the continuous regions of planar defects in the piston ring grating image to be inspected, and generate a texture defect region set. The interactive analysis module is used to locate the overlapping area between the geometric defect contour and the texture defect region based on the geometric defect contour set and the texture defect region set; it performs correlation calculation on the pixel gradient distribution and grayscale changes within the overlapping area to generate a coupling feature distribution map that characterizes the interaction strength of defects. The fusion judgment module is used to synchronously input the geometric defect contour set, the texture defect region set and the coupled feature distribution map into the preset lightweight fusion model to generate a collaborative judgment result; and generate a defect judgment decision signal based on the collaborative judgment result. The sorting control module is used to control the automated sorting mechanism to perform sorting operations on piston rings based on defect judgment decision signals.

Citation Information

Patent Citations

  • Mobile phone defect position identification method and equipment

    CN111325717A

  • Product defect detection method, device and equipment and readable storage medium

    CN114937037A

  • Automatic control method and system for battery film production based on visual inspection

    CN119229372A

  • Sapphire slice quality evaluation method based on machine vision

    CN119379687A

  • Method and device for filtering scratch defects of display screen and storage medium

    CN119648572A