An image model-based spare part defect recognition detection method and system

By extracting linear and planar defect features from the piston ring surface using an image model-based method and combining them with a lightweight fusion model, the problem of missed detection and misjudgment in traditional visual inspection systems under concurrent interference from multiple types of defects is solved. This enables rapid and accurate identification and classification of piston ring surfaces, improving production efficiency and quality control.

CN120953679BActive Publication Date: 2026-02-17GUANGDONG JINGRONG TECH HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511067318.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2026-02-17
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 fluctuations in the quenching process occur in micro-areas, making accurate identification difficult.

Method used

An image model-based approach is adopted to extract the linear defect closed contours and planar defect continuous regions 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 maps, and a collaborative judgment result is generated by combining a lightweight fusion model to control the automated sorting mechanism to perform classification operations.

Benefits of technology

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

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953679B_ABST
    Figure CN120953679B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and more particularly to a kind of spare parts defect identification detection method and system based on image model.The method comprises the following steps: the grating image of piston ring surface is collected by industrial camera, and it is recorded as the grating image of piston ring to be detected;The closed contour of linear defect in the grating image of piston ring to be detected is extracted, and a set of geometric defect contours is generated;The continuous area of planar defect in the grating image of piston ring to be detected is extracted, and a set of texture defect regions is generated;The overlapping area of geometric defect contour and texture defect region is positioned based on the set of geometric defect contours and the set of texture defect regions.The present application can clearly identify the boundary characteristics of composite defects, avoid misjudgment caused by traditional algorithms due to dependence on single feature threshold, and effectively solve the technical problem of multiple types of defects in micro area concurrent interference.
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: input the geometric defect contour set, the texture defect region set and the coupling feature distribution map into a preset lightweight fusion model synchronously to generate a collaborative determination result; and generate a defect determination decision signal according to the collaborative determination result;

[0010] Step S5: control an automatic sorting mechanism to perform a classification operation on the piston ring according to the defect determination decision signal.

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

[0012] A preset first gradient operator is used to extract a high-frequency edge component of the piston ring raster image to be inspected, and a high-frequency gradient response map is generated;

[0013] A preset second gradient operator is used to extract a low-frequency texture component of the piston ring raster image to be inspected, and a low-frequency gradient response map is generated;

[0014] The high-frequency gradient response map and the low-frequency gradient response map are superimposed and fused according to pixels to generate a multi-scale gradient response map;

[0015] A highlight area in the multi-scale gradient response map is identified, and gradient correction is performed on the highlight area to generate an anti-glare correction map;

[0016] A low-contrast area in the multi-scale gradient response map is identified, and gradient enhancement is performed on the low-contrast area to generate a weak edge enhancement map;

[0017] The geometric defect contour set is extracted based on the anti-glare correction map and the weak edge enhancement map.

[0018] Preferably, the step of identifying the highlight area in the multi-scale gradient response map and performing gradient correction on the highlight area comprises:

[0019] The brightness mean value of each pixel neighborhood in the multi-scale gradient response map is calculated, and if the brightness mean value is greater than or equal to a preset highlight threshold, the corresponding pixel neighborhood is determined as a highlight area, wherein the calculation window size of the pixel neighborhood is a preset neighborhood window size;

[0020] The gradient value of the corresponding position of the highlight area in the high-frequency gradient response map is read;

[0021] The attenuation coefficient is calculated according to the brightness mean value, wherein the specific calculation formula of the attenuation coefficient is as follows:

[0022] Attenuation coefficient = 1 / (1+k x brightness mean value);

[0023] Wherein, k is a preset material glare coefficient;

[0024] The gradient value is multiplied by the attenuation coefficient to generate an anti-glare correction value, and the gradient value of the current pixel is updated to the anti-glare correction value to generate an anti-glare correction map.

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

[0026] calculating a gradient standard deviation of a pixel neighborhood in the multi-scale gradient response map, and determining that the pixel neighborhood is a low-contrast region if the gradient standard deviation is less than or equal to a preset contrast threshold, wherein a calculation window size of the pixel neighborhood is a preset neighborhood window size;

[0027] reading a gradient value of a position corresponding to the low-contrast region in the low-frequency gradient response map;

[0028] enhancing the gradient value using a sigmoid gain function, wherein the sigmoid gain function is as follows:

[0029]

[0030] wherein s is a preset sharpening intensity parameter;

[0031] updating the gradient value of the current pixel to the enhanced value to generate a weak edge enhanced map.

[0032] Preferably, the extracting the geometric defect contour set based on the anti-glare correction map and the weak edge enhanced map comprises:

[0033] respectively counting gradient distribution histograms of the anti-glare correction map and the weak edge enhanced map;

[0034] determining a p-th percentile gradient threshold according to the gradient distribution histograms, wherein p is a preset percentile parameter;

[0035] traversing each pixel of the anti-glare correction map and the weak edge enhanced map,

[0036] if the gradient value of the current pixel is greater than or equal to the p-th percentile gradient threshold, performing a closing operation on a neighborhood of the pixel using a preset first structuring element;

[0037] if the gradient value of the current pixel is less than the p-th percentile gradient threshold, performing a closing operation on the neighborhood of the pixel using a preset second structuring element, wherein the preset first structuring element is smaller than the preset second structuring element;

[0038] taking a maximum value of the anti-glare correction map and the weak edge enhanced map after the closing operation processing according to pixels to generate a comprehensive gradient map;

[0039] performing contour extraction on the comprehensive gradient map to generate a closed continuous contour set, denoted as the geometric defect contour set.

[0040] Preferably, the extracting the continuous region of the planar defect in the piston ring raster image to be detected in step S2 comprises:

[0041] The piston ring raster image to be detected is divided into a plurality of preset scale analysis regions to generate a large-scale region set, a medium-scale region set and a small-scale region set; the large-scale region is used to capture macro color spots, the medium-scale region is used to capture transition color spots, and the small-scale region is used to capture micro color spots;

[0042] The analysis regions in each scale region set are traversed:

[0043] The gray level histogram of the current analysis region is counted to calculate the mean value and the standard deviation of the gray level;

[0044] The segmentation threshold is calculated based on the mean value and the standard deviation of the gray level, and the calculation formula of the segmentation threshold is as follows:

[0045] Segmentation threshold = mean value of gray level + k x standard deviation;

[0046] Wherein, k is a preset sensitivity coefficient;

[0047] The pixels with a gray value greater than the segmentation threshold are marked as candidate defect pixels to generate a candidate defect pixel set;

[0048] If the candidate defect pixels in the large-scale region set and the candidate defect pixels in the medium-scale region set are spatially overlapped, the candidate defect pixels in the overlapping region are merged into the same color spot region;

[0049] If the candidate defect pixels in the medium-scale region set and the candidate defect pixels in the small-scale region set are spatially overlapped, the candidate defect pixels in the overlapping region are merged into the same color spot region;

[0050] The morphological closing operation is performed on the merged color spot region to generate a texture defect region set.

[0051] Preferably, step S3 comprises:

[0052] The spatial coordinates of the geometric defect contour set and the texture defect region set are traversed to identify the pixel region intersected by the geometric defect contour and the texture defect region as an overlapping region;

[0053] The standard deviation of the gradient values of all pixels in the overlapping region is calculated, denoted as gradient standard deviation;

[0054] The coefficient of variation of the gray values of all pixels in the overlapping region is calculated, denoted as gray variation coefficient, wherein the coefficient of variation = standard deviation of the gray values of all pixels in the overlapping region / mean value of the gray values of all pixels in the overlapping region;

[0055] The gradient standard deviation and the gray variation coefficient are multiplied to generate a local interference coefficient representing the defect interaction intensity;

[0056] The minimum circumscribed rectangle of the geometric defect contour is extracted, denoted as contour frame;

[0057] calculating a minimum distance of the contour frame from the texture defect region boundary;

[0058] if the minimum distance is negative and the absolute value is greater than or equal to a preset minimum distance threshold, determining that the topological relationship between the geometric defect contour and the texture defect region is complete encirclement;

[0059] if the minimum distance is positive and less than the preset minimum distance threshold, determining that the topological relationship between the geometric defect contour and the texture defect region is cross penetration;

[0060] if the topological relationship between the geometric defect contour and the texture defect region is complete encirclement, assigning a preset first weight value to the current overlapping region;

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

[0062] multiplying the local interference coefficient by the corresponding topological weight value to generate a coupling feature value of the current overlapping region;

[0063] traversing all overlapping regions to map the coupling feature value to the image coordinate system to generate a coupling feature distribution map representing the defect interaction intensity.

[0064] Preferably, step S4 comprises:

[0065] inputting the geometric defect contour set, the texture defect region set and the coupling feature distribution map into a preset lightweight fusion model, wherein the collaborative analysis of the preset lightweight fusion model includes extracting an interaction intensity mean value and calculating a contour continuity score;

[0066] if the interaction intensity mean value is lower than a preset interaction intensity threshold, outputting an independent defect signal and a defect type identifier, the defect type identifier being any one of a linear defect identifier and a planar defect identifier;

[0067] if the interaction intensity mean value is higher than the preset interaction intensity threshold and the contour continuity score is higher than a preset continuity threshold, outputting a concurrent defect signal and a composite defect parameter set, wherein the composite defect parameter set includes a linear defect length, a planar defect area and a coupling depth, the linear defect length being the sum of the perimeters of all contours in the geometric defect contour set, the planar defect area being the sum of the areas of all regions in the texture defect region set, and the coupling depth being the pixel ratio of the interaction intensity peak region of the coupling feature distribution map;

[0068] if the interaction intensity mean value is higher than the preset interaction intensity threshold and the contour continuity score is lower than the preset continuity threshold, outputting a high-risk defect signal and triggering an emergency stop instruction;

[0069] The independent defect signal / concurrent defect signal / high-risk defect signal is recorded as a defect determination decision signal.

[0070] Preferably, the classification operation performed on the piston ring in step S5 includes:

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

[0072] When the 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 a scrap channel;

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

[0074] Preferably, the application also provides an image model-based spare part defect identification and detection system for performing the image model-based spare part defect identification and detection method as described above, which includes:

[0075] An image acquisition module for acquiring a grating image of the surface of the piston ring through an industrial camera, recorded as a to-be-inspected piston ring grating image;

[0076] A defect extraction module for extracting the closed contour of the linear defect in the to-be-inspected piston ring grating image to generate a geometric defect contour set, and extracting the continuous area of the planar defect in the to-be-inspected piston ring grating image to generate a texture defect area set;

[0077] An interaction analysis module for positioning the overlapping area of the geometric defect contour and the texture defect area based on the geometric defect contour set and the texture defect area set, and performing correlation calculation on the pixel gradient distribution and the gray scale change in the overlapping area to generate a coupling feature distribution graph representing the defect interaction intensity;

[0078] A fusion determination module for synchronously inputting the geometric defect contour set, the texture defect area set and the coupling feature distribution graph into a preset lightweight fusion model to generate a collaborative determination result, and generating a defect determination decision signal according to the collaborative determination result;

[0079] A sorting control module for controlling the automatic sorting mechanism to perform a classification operation on the piston ring according to the defect determination decision signal.

[0080] The beneficial effects of the application mainly include the following aspects:

[0081] In one aspect, by means of an innovative image processing method, the linear defect closed contour and the planar defect continuous region on the surface of the piston ring are accurately extracted to generate a geometric defect contour set and a texture defect region set. This can effectively solve the problems of missed detection and misjudgment of the traditional visual detection system when facing multiple types of defects and concurrent interference, and significantly improve the sensitivity and accuracy of defect detection.

[0082] On the other hand, the present application quantitatively analyzes the defect interaction intensity in the overlapping area by generating a coupling feature distribution map. This can clearly identify the boundary features of complex defects and avoid misjudgment caused by relying on a single feature threshold in traditional algorithms, effectively solving the technical problem of concurrent interference of multiple types of defects in the microscopic area.

[0083] In addition, the present application introduces a lightweight fusion model to cooperatively analyze the geometric defect contour set, the texture defect region set and the coupling feature distribution map, and generate a cooperative judgment result. This not only can quickly process a large amount of image data, but also can generate accurate defect judgment decision signals in a short time, ensuring the realization of rapid and accurate identification and classification of defects on the surface of the piston ring in a high-speed continuous production environment, and significantly improving the detection efficiency.

[0084] Finally, the present application controls the automatic sorting mechanism to perform classification operation on the piston ring through the defect judgment decision signal, realizing the seamless connection of defect detection and production process. When detecting independent defects, the system can transfer the piston ring to the corresponding repair or processing station according to the defect type; when detecting concurrent defects, the system can judge the repairability according to the coupling depth and divert it to the scrap channel or the manual re-inspection channel. This not only improves the production efficiency, but also reduces the manual intervention and reduces the risk of misjudgment caused by human factors, significantly improves the production quality control level and reduces the potential risk caused by missed detection of defects. BRIEF DESCRIPTION OF DRAWINGS

[0085] Other features, objects and advantages of the present application will become more apparent from the following detailed description made with reference to the accompanying drawings:

[0086] Fig. 1 FIG. 1 shows a step flow diagram of an image model-based spare part defect identification and detection method according to an embodiment.

[0087] Fig. 2 FIG. 4 shows a detailed step flow diagram of step S4 according to an embodiment.

[0088] Fig. 3 FIG. 5 shows a coupling feature distribution map representing the defect interaction intensity according to an embodiment. DETAILED DESCRIPTION

[0089] The technical method of the present application will be described clearly and completely below in conjunction with the drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0090] In addition, the drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. Identical reference numerals in the drawings represent identical or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities, which do not necessarily have to correspond to physically or logically independent entities. The functional entities can be implemented in the form of software, or 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" and the like can be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of the example embodiments, a first element can be called a second element, and similarly a second element can be called a first element. 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-mentioned purpose, please refer to Figs. 1 to 3 The present application provides a kind of based on image model's spare part defect identification detection method, comprising the following steps:

[0093] Step S1: the grating image of piston ring surface is collected by industrial camera, and it is recorded as the grating image of piston ring to be detected;

[0094] Step S2: the closed contour of linear defect in the grating image of piston ring to be detected is extracted, and a set of geometric defect contours is generated;The continuous area of planar defect in the grating image of piston ring to be detected is extracted, and a set of texture defect area is generated;

[0095] Step S3: the overlapping area of geometric defect contour and texture defect area is located based on the set of geometric defect contour and the set of texture defect area;The correlation of pixel gradient distribution and gray change in the overlapping area is calculated, and the coupling feature distribution graph representing defect interaction intensity is generated;

[0096] Step S4: the set of geometric defect contour, the set of texture defect area and the coupling feature distribution graph are synchronously input into the preset lightweight fusion model, and the cooperative determination result is generated;Defect determination decision signal is generated according to the cooperative determination result;

[0097] Step S5: controlling the automatic sorting mechanism to perform a sorting operation on the piston ring according to the defect judgment decision signal.

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

[0099] The high-frequency edge component of the piston ring raster image to be inspected is extracted by using a preset first gradient operator to generate a high-frequency gradient response map;

[0100] In an implementation manner of the embodiment of the present application, the preset first gradient operator can be a Sobel operator. When processing the collected piston ring raster image to be inspected, the Sobel operator is used to calculate the gradient amplitude of the image in the horizontal direction and the vertical direction respectively. For example, at a certain pixel point of the image, the gradient value in the horizontal direction is 5, and the gradient value in the vertical direction is 3, and the high-frequency gradient response value of the point is calculated as 52+32=5.83. After similar calculation is performed on all pixel points in the image, the high-frequency gradient response map is generated.

[0101] The low-frequency texture component of the piston ring raster image to be inspected is extracted by using a preset second gradient operator to generate a low-frequency gradient response map;

[0102] In an implementation manner of the embodiment of the present application, the preset second gradient operator can be a Prewitt operator. Similar to the extraction of the high-frequency edge component, the Prewitt operator is used to process the same piston ring raster image to be inspected. For example, at a certain pixel point of the image, the gradient value in the horizontal direction is calculated as 2 by the Prewitt operator, and the gradient value in the vertical direction is 1, and the low-frequency gradient response value of the point is 22+12=2.24. After calculation is performed on all pixel points in the image, the 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 an implementation manner of the embodiment of the present application, the high-frequency gradient response map and the low-frequency gradient response map are superimposed pixel by pixel. The specific operation is as follows: for each pixel point in the image, the high-frequency gradient response value and the low-frequency gradient response value are added. For example, for a pixel point in the image, the high-frequency gradient response value is 5.83, the low-frequency gradient response value is 2.24, and the gradient response value after superimposition is 5.83+2.24=8.07. After similar operations are performed on all pixel points in the image, the multi-scale gradient response map is generated.

[0105] A highlight area in the multi-scale gradient response map is identified, and gradient correction is performed on the highlight area to generate an anti-glare correction map;

[0106] For specific embodiments of this step, refer to the embodiments of the corresponding sub-steps.

[0107] Identify the low-contrast region in the multi-scale gradient response map, and perform gradient enhancement on the low-contrast region to generate a weak edge enhancement map.

[0108] For specific embodiments of this step, refer to the embodiments of the corresponding sub-steps.

[0109] Extract the geometric defect contour set based on the anti-glare correction map and the weak edge enhancement map.

[0110] For specific embodiments of this step, refer to the embodiments of the corresponding sub-steps.

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

[0112] Calculate the brightness mean value of each pixel neighborhood in the multi-scale gradient response map, and if the brightness mean value is greater than or equal to a preset highlight threshold, determine that the corresponding pixel neighborhood is a highlight region, wherein the calculation window size of the pixel neighborhood is a preset neighborhood window size;

[0113] In one implementation manner of the embodiment of the present application, it is assumed that the preset highlight threshold is 200 (the gray value range is 0-255), and the preset neighborhood window size is 3x3 pixels. For each pixel in the multi-scale gradient response map, the brightness mean value in its 3x3 neighborhood is calculated. For example, for the pixel with coordinates (100, 150) in the image, the pixel brightness values in its 3x3 neighborhood are 210, 215, 220, 205, 225, 230, 210, 215, and 220, and the calculated brightness mean value is 216.67. Since the brightness mean value is greater than the preset highlight threshold 200, it is determined that the pixel neighborhood is a highlight region.

[0114] Read the gradient value of the position corresponding to the highlight region in the high-frequency gradient response map;

[0115] In one implementation manner of the embodiment of the present application, in the high-frequency gradient response map, the position corresponding to the pixel determined as the highlight region is found. It is assumed that the gradient value of the pixel with coordinates (100, 150) in the high-frequency gradient response map is 8.5. The gradient value represents the gradient intensity of the pixel in the high-frequency edge component.

[0116] Calculate the attenuation coefficient according to the brightness mean value, wherein the specific calculation formula of the attenuation coefficient is as follows:

[0117] Attenuation coefficient = 1 / (1+k x brightness mean value);

[0118] Wherein, k is a preset material glare coefficient;

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

[0120] The gradient value is multiplied by the attenuation coefficient to generate an anti-glare correction value, and the gradient value of the current pixel is updated to the anti-glare correction value to generate an anti-glare correction map.

[0121] In one implementation form of the embodiment of the application, the read gradient value 8.5 is multiplied by the calculated attenuation coefficient 0.479 to obtain an anti-glare correction value: anti-glare correction value = 8.5 * 0.479 = 4.07. The correction value is assigned to the pixel with coordinates (100, 150) in the multi-scale gradient response map, and the gradient value of the pixel is updated to 4.07. After similar operations are performed on all high-light area pixels in the image, an anti-glare correction map is generated.

[0122] Preferably, identifying a low-contrast area in the multi-scale gradient response map and performing gradient enhancement on the low-contrast area comprises:

[0123] The gradient standard deviation of each pixel neighborhood in the multi-scale gradient response map is calculated, and if the gradient standard deviation is less than or equal to a preset contrast threshold, the corresponding pixel neighborhood is determined to be a low-contrast area, wherein the calculation window size of the pixel neighborhood is a preset neighborhood window size;

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

[0125] The gradient value of the corresponding position of the low-contrast area in the low-frequency gradient response map is read;

[0126] In one implementation form of the embodiment of the application, the position corresponding to the pixel determined to be a low-contrast area is found in the low-frequency gradient response map. It is assumed that the gradient value of the pixel with coordinates (200, 250) in the low-frequency gradient response map is 1.2. The gradient value represents the gradient intensity of the pixel in the low-frequency texture component.

[0127] The gradient value is enhanced by using an S-shaped gain function, wherein the S-shaped gain function is as follows:

[0128]

[0129] wherein s is a preset sharpening intensity parameter;

[0130] In an implementation form of the embodiment of the present application, it is assumed that the preset maximum gradient value is 10 and the preset sharpening intensity parameter s is 5. For the read gradient value 1.2, the enhancement value is calculated according to the above formula:

[0131] The gradient value of the current pixel is updated to the enhancement value, and a weak edge enhancement map is generated.

[0132] In an implementation form of the embodiment of the present application, the calculated enhancement value 6.45 is assigned to the pixel with coordinates (200, 250) in the multi-scale gradient response map, and the gradient value thereof is updated to 6.45. After similar operations are performed on all low-contrast region pixels in the image, a weak edge enhancement map is generated.

[0133] Preferably, the extracting the geometric defect contour set based on the anti-glare correction map and the weak edge enhancement map comprises:

[0134] The gradient distribution histograms of the anti-glare correction map and the weak edge enhancement map are respectively counted;

[0135] In an implementation form of the embodiment of the present application, it is assumed that the sizes of the anti-glare correction map and the weak edge enhancement map are both 512x512 pixels. For the anti-glare correction map, the distribution of the gradient values thereof is counted 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 with gradient values in the range of 2-4 is 800, the number of pixels with gradient values in the range of 4-6 is 600, and so on. For the weak edge enhancement map, the distribution of the gradient values thereof is also counted 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 with gradient values in the range of 2-4 is 700, the number of pixels with gradient values in the range of 4-6 is 900, and so on.

[0136] The p-th percentile gradient threshold is determined according to the gradient distribution histogram, wherein p is a preset percentile parameter;

[0137] In an implementation form of the embodiment of the application, it is assumed that the preset percentile parameter p is 90%. For the anti-glare correction map, the gradient value is found which makes the cumulative pixel number reach 90% of the total pixel number according to the gradient distribution histogram thereof. Assuming that the total pixel number of the anti-glare correction map is 262144 (512x512), the cumulative pixel number corresponding to the 90th percentile is 235930 (262144x0.9). By looking up the gradient distribution histogram, it is determined that the 90th percentile gradient threshold is 6.5. For the weak edge enhancement map, the 90th percentile gradient threshold is also determined to be 7.0 according to the gradient distribution histogram thereof.

[0138] traversing each pixel of the anti-glare correction map and the weak edge enhancement map,

[0139] In an implementation form of the embodiment of the application, each pixel of each image is checked one by one. It is assumed that the pixel currently being processed is located at the coordinate (100, 150) of the anti-glare correction map, and its gradient value is 7.2; at the same time, the gradient value of the pixel at the same position in the weak edge enhancement map is 6.8.

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

[0141] In an implementation form of the embodiment of the application, it is assumed that the preset first structural element is a 3x3 rectangular structural element. For the pixel at the coordinate (100, 150) in the anti-glare correction map, its gradient value 7.2 is greater than the 90th percentile gradient threshold 6.5, so a close operation is performed on the 3x3 neighborhood of the pixel. The close operation includes an operation of first expansion and then corrosion to fill small holes and connect broken parts. It is assumed that after the close operation, the gradient value in the neighborhood is adjusted to 7.5. For the pixel at the same position in the weak edge enhancement map, its gradient value 6.8 is less than the 90th percentile gradient threshold 7.0, so no close operation is performed thereon.

[0142] If the gradient value of the current pixel is less than the pth percentile gradient threshold, then the neighborhood of the pixel is subjected to a close operation using a preset second structural element, wherein the preset first structural element is smaller than the preset second structural element;

[0143] In an implementation form of the embodiment of the application, it is assumed that the preset second structural element is a 5x5 rectangular structural element. For the pixel at the coordinate (100, 150) in the weak edge enhancement map, its gradient value 6.8 is less than the 90th percentile gradient threshold 7.0, so a close operation is performed on the 5x5 neighborhood of the pixel. Since the second structural element is larger, the effect of the close operation will be more obvious, and larger broken parts can be better filled. It is assumed that after the close operation, the gradient value in the neighborhood is adjusted to 7.2.

[0144] The maximum value of the anti-glare correction image and the weak edge enhancement image after the closing operation is taken as a pixel to generate a comprehensive gradient image;

[0145] In an implementation manner of the embodiment of the present application, the gradient values of the anti-glare correction image and the weak edge enhancement image after the closing operation are compared one by one according to the pixel positions, and the larger value is taken as the pixel value of the comprehensive gradient image. For example, the gradient value of the anti-glare correction image is 7.5 and the gradient value of the weak edge enhancement image is 7.2 for the pixel of the coordinate (100, 150), and thus the pixel value of the position in the comprehensive gradient image is 7.5. After similar operations are performed on all pixels, the comprehensive gradient image is generated.

[0146] The contour extraction is performed on the comprehensive gradient image to generate a closed continuous contour set, denoted as a geometric defect contour set.

[0147] In an implementation manner of the embodiment of the present application, the contour extraction is performed on the comprehensive gradient image by using an image processing algorithm (such as the Canny edge detection algorithm). It is assumed that the detected contours in the comprehensive gradient image include a larger closed contour, indicating that a larger linear defect exists, and some smaller closed contours, indicating that smaller linear defects exist. All the detected closed contours are collected to form the geometric defect contour set. For example, the geometric defect contour set contains 3 closed contours, which represent 3 different linear defect regions.

[0148] Preferably, the step S2 of extracting the continuous region of the planar defect in the piston ring raster image to be detected comprises:

[0149] The piston ring raster image to be detected is divided into a plurality of preset scale analysis regions to generate a large-scale region set, a medium-scale region set and a small-scale region set; wherein the large-scale region is used to capture macro color spots, the medium-scale region is used to capture transition color spots, and the small-scale region is used to capture micro color spots.

[0150] In an implementation manner of the embodiment of the present application, it is assumed that the size of the piston ring raster image to be detected is 1024x1024 pixels. The image is divided into the following three scale analysis regions:

[0151] The large-scale region set: the image is divided into 8x8 regions, and the size of each region is 128x128 pixels. These regions are used to capture macro color spots.

[0152] The medium-scale region set: the image is divided into 16x16 regions, and the size of each region is 64x64 pixels. These regions are used to capture transition color spots.

[0153] The small-scale region set: the image is divided into 32x32 regions, and the size of each region is 32x32 pixels. These regions are used to capture micro color spots.

[0154] Traverse each analysis region in the large-scale region set:

[0155] Calculate the mean and standard deviation of the gray scale histogram of the current analysis region;

[0156] In an implementation form of the embodiment of the present application, for a region in the large-scale region set (for example, a 128x128 pixel region at the upper left corner), the gray scale histogram thereof is counted. Assuming that the gray scale value distribution of the region is as follows: gray scale values 0-31: 100 pixels; gray scale values 32-63: 200 pixels; gray scale values 64-95: 300 pixels; gray scale values 96-127: 400 pixels; gray scale values 128-159: 500 pixels; gray scale values 160-191: 600 pixels; gray scale values 192-223: 700 pixels; and gray scale values 224-255: 800 pixels. The calculated mean of the gray scale is 128, and the standard deviation is 64.

[0157] Calculate the segmentation threshold based on the mean and standard deviation of the gray scale, wherein the calculation formula of the segmentation threshold is as follows:

[0158] Segmentation threshold = mean of gray scale + k x standard deviation of gray scale;

[0159] Wherein, k is a preset sensitivity coefficient;

[0160] In an implementation form of the embodiment of the present application, it is assumed that the preset sensitivity coefficient k is 2. For the calculated mean of the gray scale 128 and the standard deviation 64, the segmentation threshold is calculated as follows: segmentation threshold = 128 + 2 x 64 = 256.

[0161] Mark the pixels with a gray scale value greater than the segmentation threshold as candidate defect pixels to generate a candidate defect pixel set;

[0162] In an implementation form of the embodiment of the present application, in the above-mentioned 128x128 pixel region, it is assumed that there are 100 pixels with a gray scale value greater than 256, which are marked as candidate defect pixels. The coordinates of these pixels are recorded to form a candidate defect pixel set.

[0163] If the candidate defect pixels in the large-scale region set and the candidate defect pixels in the medium-scale region set spatially overlap, the candidate defect pixels in the overlapping region are merged into the same stain region;

[0164] In an implementation form of the embodiment of the present application, it is assumed that there is a candidate defect pixel set in the large-scale region set, with a center coordinate of (64, 64), and there is a candidate defect pixel set in the medium-scale region set, with a center coordinate of (64, 64). Since the two regions spatially overlap, they are merged into one stain region. The merged stain region contains all the overlapping candidate defect pixels.

[0165] If the candidate defect pixels in the meso-scale region set spatially overlap with the candidate defect pixels in the micro-scale region set, the candidate defect pixels in the overlapping region are merged into the same blob region;

[0166] In an implementation form of the embodiment, it is assumed that there is one candidate defect pixel set in the meso-scale region set, whose center coordinate is (64, 64), and there is one candidate defect pixel set in the micro-scale region set, whose center coordinate is (64, 64). Since the two regions spatially overlap, they are merged into one blob region. The merged blob region contains all the overlapping candidate defect pixels.

[0167] The morphological closing operation is performed on the merged blob region to generate a texture defect region set.

[0168] In an implementation form of the embodiment, it is assumed that the merged blob region is an irregular shape and contains multiple broken parts. The morphological closing operation (first dilation and then corrosion) is used to fill the broken parts to make the blob region more complete. It is assumed that the 3x3 structure element is used for the closing operation, and the processed blob region becomes more continuous and closed. All the processed blob regions are collected to form the texture defect region set.

[0169] Preferably, the step S3 comprises:

[0170] The spatial coordinates of the geometric defect contour set and the texture defect region set are traversed to identify the pixel region where the geometric defect contour and the texture defect region intersect as an overlapping region;

[0171] In an implementation form of the embodiment, it is assumed that there is one contour in the geometric defect contour set, whose coordinate range is (100, 100) to (200, 200), and there is one region in the texture defect region set, whose coordinate range is (150, 150) to (250, 250). By comparing the coordinate ranges of the two regions, it is identified that the overlapping region of them is (150, 150) to (200, 200).

[0172] The standard deviation of the gradient values of all the pixels in the overlapping region is calculated, denoted as gradient standard deviation;

[0173] In an implementation form of the embodiment, it is assumed that the gradient values of the pixels in the overlapping region are 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 to obtain the gradient standard deviation as 1.5.

[0174] a coefficient of variation of the gray values of all the pixels in the overlapping region, denoted as a gray variation coefficient, wherein the coefficient of variation = a standard deviation of the gray values of all the pixels in the overlapping region / an average of the gray values of all the pixels in the overlapping region;

[0175] In an implementation manner of the embodiment of the present application, it is assumed that the gray values of the pixels in the overlapping region are respectively 120, 125, 130, 135, 140, 145, 150, 155, and 160. The average of these gray values is 140, and the standard deviation is 15. Therefore, the gray variation coefficient is: gray variation coefficient = 15 / 140 ≈ 0.107.

[0176] multiplying the gradient standard deviation and the gray variation coefficient to generate a local interference coefficient representing the interaction intensity of the defect;

[0177] In an implementation manner of the embodiment of the present application, the calculated gradient standard deviation 1.5 is multiplied by the calculated gray variation coefficient 0.107 to obtain the local interference coefficient: local interference coefficient = 1.5 × 0.107 ≈ 0.1605.

[0178] extracting a minimum circumscribed rectangle of the geometric defect contour, denoted as a contour frame;

[0179] In an implementation manner of the embodiment of the present application, it is assumed that the coordinate range of the geometric defect contour is (100, 100) to (200, 200), and the minimum circumscribed rectangle of the contour is extracted, and the coordinate range of the minimum circumscribed rectangle is (100, 100) to (200, 200).

[0180] calculating a minimum distance between the contour frame and the boundary of the texture defect region;

[0181] In an implementation manner of the embodiment of the present application, it is assumed that the coordinate range of the texture defect region is (150, 150) to (250, 250), and the coordinate range of the contour frame is (100, 100) to (200, 200). The minimum distance between the contour frame and the boundary of the texture defect region is calculated, and the minimum distance is -50 (a negative value indicates that the contour frame completely surrounds the texture defect region).

[0182] if the minimum distance is negative and the absolute value is greater than or equal to a preset minimum distance threshold, determining that the topological relationship between the geometric defect contour and the texture defect region is complete surrounding;

[0183] In an implementation manner of the embodiment of the present application, 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, and it is determined that the topological relationship between the geometric defect contour and the texture defect region is complete surrounding.

[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 as cross-penetration;

[0185] In an implementation manner of the embodiment of the present application, 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 outer frame and the texture defect region boundary is calculated, and the minimum distance is 10 (a positive value indicates that the contour outer frame and the texture defect region partially overlap). It is assumed that the preset minimum distance threshold is 20. Since the minimum distance is 10, which is less than the preset minimum distance threshold, it is determined that the topological relationship between the geometric defect contour and the texture defect region is cross-penetration.

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

[0187] In an implementation manner of the embodiment of the present application, it is assumed that the preset first weight value is 1.5. Since it is determined that the topological relationship between the geometric defect contour and the texture defect region is complete surrounding, the weight value of the current overlapping region is 1.5.

[0188] If the topological relationship between the geometric defect contour and the texture defect region is cross-penetration relationship, 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 an implementation manner of the embodiment of the present application, it is assumed that the preset second weight value is 0.8. Since it is determined that the topological relationship between the geometric defect contour and the texture defect region is cross-penetration, the weight value of the current overlapping region is 0.8.

[0190] The local interference coefficient is multiplied by the corresponding topological weight value to generate the coupling characteristic value of the current overlapping region;

[0191] In an implementation manner of the embodiment of the present application, for the overlapping region of complete surrounding relationship, the calculated local interference coefficient 0.1605 is multiplied by the assigned weight value 1.5 to obtain the coupling characteristic value: coupling characteristic value = 0.1605 x 1.5 = 0.24075. For the overlapping region of cross-penetration relationship, the local interference coefficient 0.1605 is multiplied by the assigned weight value 0.8 to obtain the coupling characteristic value: coupling characteristic value = 0.1605 x 0.8 = 0.1284.

[0192] All overlapping regions are traversed, and the coupling characteristic value is mapped to the image coordinate system to generate a coupling characteristic distribution map representing the defect interaction intensity.

[0193] In an implementation form of the embodiment of the present application, assuming that there are two overlapping regions in the image, the coupling feature value of one completely surrounding relationship overlapping region is 0.24075, and the coupling feature value of the other intersecting penetrating relationship overlapping region is 0.1284. These coupling feature values are mapped into the image coordinate system to generate a coupling feature distribution map. For example, the coupling feature value 0.24075 of the completely surrounding relationship overlapping region is mapped to the coordinates (150, 150) to (200, 200), and the coupling feature value 0.1284 of the intersecting penetrating relationship overlapping region is mapped to the coordinates (350, 350) to (400, 400). In this way, the generated coupling feature distribution map can intuitively reflect the defect interaction intensity of different overlapping regions.

[0194] Preferably, the step S4 comprises:

[0195] The step S41 comprises: inputting the set of geometric defect contours, the set of texture defect regions and the coupling feature distribution map into a preset lightweight fusion model, wherein the collaborative analysis of the preset lightweight fusion model comprises extracting an interaction intensity mean value and calculating a contour continuity score.

[0196] In an implementation form of the embodiment of the present application, the preset lightweight fusion model adopts a convolutional neural network (CNN) based architecture, which is constructed as follows: an input layer: receiving the set of geometric defect contours, the set of texture defect regions and the coupling feature distribution map as input, and the size of each input data is 256x256 pixels. A feature extraction layer: containing two convolutional layers, each followed by a max-pooling layer. The first convolutional layer has 16 3x3 convolutional kernels, and the second convolutional layer has 32 3x3 convolutional kernels. The pooling window of the max-pooling layer is 2x2. A fusion layer: performing channel-level fusion on the output feature maps of the two convolutional layers to obtain a comprehensive feature map. A fully connected layer: flattening the comprehensive feature map and inputting it into a fully connected layer, which has 128 neurons and a ReLU activation function. An output layer: containing two output nodes for outputting an interaction intensity mean value and a contour continuity score, respectively. The interaction intensity mean value represents the average intensity of defect interaction in the coupling feature distribution map, and the contour continuity score represents the continuity degree of the geometric defect contour. A training process: using a labeled data set (containing images of known defect types) to train the model, using a mean square error loss function, and using an Adam optimization algorithm with a learning rate of 0.001. After training is completed, the model can quickly analyze the input image data and output the interaction intensity mean value and the contour continuity score.

[0197] The step S42 comprises: if the interaction intensity mean value is lower than a preset interaction intensity threshold, outputting an independent defect signal and a defect type identifier, the defect type identifier being any one of a linear defect identifier and a planar defect identifier.

[0198] In an implementation manner of the embodiment of the present application, it is assumed that the preset interaction intensity threshold is 0.1. The interaction intensity mean value calculated by the lightweight fusion model is 0.08, which is lower than the preset threshold. At this time, the model outputs an independent defect signal, and judges the defect type according to the features of the geometric defect contour set and the texture defect region set. It is assumed that the features of the geometric defect contour set are more significant, and the model outputs a linear defect label.

[0199] Step S43: If the interaction intensity mean value is higher than the preset interaction intensity threshold, and the contour continuity score is higher than the preset continuity threshold, output a concurrent defect signal and a composite defect parameter set, wherein the composite defect parameter set includes a linear defect length, an area of a surface defect, and a coupling depth, the linear defect length is the sum of the perimeters of all contours in the geometric defect contour set, the area of the surface defect is the sum of the areas of all regions in the texture defect region set, and the coupling depth is the pixel ratio of the interaction intensity peak region of the coupling feature distribution map;

[0200] In an implementation manner of the embodiment of the present application, it is assumed that the preset interaction intensity threshold is 0.1, and the preset continuity threshold is 0.8. The interaction intensity mean value calculated by the lightweight fusion model is 0.12, which is higher than the preset interaction intensity threshold; and the contour continuity score is 0.85, which is higher than the preset continuity threshold. At this time, the model outputs a concurrent defect signal, and calculates a composite defect parameter set:

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

[0202] Area of surface defect: the area sum of all regions in the texture defect region set is 2000 pixels2.

[0203] Coupling depth: the pixel ratio of the interaction intensity peak region of the coupling feature distribution map is 0.3.

[0204] The composite defect parameter set output by the model is {linear defect length: 500 pixels, area of surface defect: 2000 pixels2, coupling depth: 0.3}.

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

[0206] In an implementation manner of the embodiment of the present application, it is assumed that the preset interaction intensity threshold is 0.1, and the preset continuity threshold is 0.8. The interaction intensity mean value calculated by the lightweight fusion model is 0.12, which is higher than the preset interaction intensity threshold; but 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 instruction, so as to prevent potential serious defects from causing equipment damage or safety problems.

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

[0208] In an implementation form of the embodiment of the application, according to the output results of steps S42, S43 and S44, the corresponding signals are recorded as a defect judgment decision signal. For example, if the model outputs an independent defect signal and a linear defect type, the defect judgment decision signal is {independent defect signal, linear defect type}; if the model outputs a concurrent defect signal and a composite defect parameter set, the defect judgment decision signal is {concurrent defect signal, composite defect parameter set}; if the model outputs a high-risk defect signal, the defect judgment decision signal is {high-risk defect signal}.

[0209] Preferably, the classification operation on the piston ring in step S5 includes:

[0210] When receiving the independent defect signal, the sorting mechanism is controlled according to the defect type identification. If the type identification is a linear defect, the current piston ring is transferred to the laser repair station; if the type identification is a surface defect, the current piston ring is transferred to the polishing station.

[0211] In an implementation form of the embodiment of the application, it is assumed that the detection system receives an independent defect signal, and the defect type identification is a linear defect. At this time, the control system sends an instruction to the sorting mechanism according to the defect type identification, and transfers the current piston ring to the laser repair station. For example, the control system moves the piston ring from the detection station to the laser repair station through an industrial robot, preparing for subsequent repair processing.

[0212] In an implementation form of the embodiment of the application, it is assumed that the detection system receives an independent defect signal, and the defect type identification is a surface defect. At this time, the control system sends an instruction to the sorting mechanism according to the defect type identification, and transfers 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 through a conveying belt, preparing for subsequent polishing processing.

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

[0214] In one implementation manner of the embodiment of the present application, it is assumed that the detection system receives a concurrent defect signal, and the read composite defect parameter set is {linear defect length: 500 pixels, planar defect area: 2000 pixels2, coupling depth: 0.3}. It is assumed that the preset repairable threshold is 0.25. Since the coupling depth 0.3 exceeds the preset repairable threshold 0.25, the control system determines that the defect of the piston ring cannot be repaired, 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 through the sorting mechanism, and prepares for subsequent scrap processing.

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

[0216] In one implementation manner of the embodiment of the present application, it is assumed that the detection system receives a concurrent defect signal, and the read composite defect parameter set is {linear defect length: 300 pixels, planar defect area: 1000 pixels2, coupling depth: 0.2}. It is assumed that the preset repairable threshold is 0.25. Since the coupling depth 0.2 does not exceed the preset repairable threshold 0.25, the control system determines that the defect of the piston ring can be further confirmed whether it can be repaired through artificial re-inspection, and therefore transfers the current piston ring to the artificial re-inspection channel. For example, the control system moves the piston ring from the detection station to the artificial re-inspection channel through the sorting mechanism, and prepares for further inspection and evaluation by artificial.

[0217] Preferably, the present application also provides an image model-based spare part defect identification detection system for executing the image model-based spare part defect identification detection method as described above, which comprises:

[0218] An image acquisition module for acquiring a grating image of the surface of the piston ring by an industrial camera, denoted as a to-be-inspected piston ring grating image;

[0219] A defect extraction module for extracting the closed contour of the linear defect in the to-be-inspected piston ring grating image to generate a geometric defect contour set, and extracting the continuous area of the planar defect in the to-be-inspected piston ring grating image to generate a texture defect area set;

[0220] An interaction analysis module for positioning the overlapping area of the geometric defect contour and the texture defect area based on the geometric defect contour set and the texture defect area set, and performing correlation calculation on the pixel gradient distribution and the gray scale change in the overlapping area to generate a coupling feature distribution graph representing the defect interaction intensity;

[0221] The fusion determination module is configured to input the geometric defect profile set, the texture defect region set and the coupling feature distribution map into a preset lightweight fusion model synchronously to generate a cooperative determination result, and generate a defect determination decision signal according to the cooperative determination result.

[0222] The sorting control module is configured to control an automatic sorting mechanism to perform a classification operation on the piston ring according to the defect determination decision signal.

[0223] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, the scope of the application being defined by the appended claims and not by the description above, and it is intended to encompass all variations falling within the meaning and the scope of the equivalent technical elements of the application file.

[0224] The above description is merely one specific implementation of the application, which enables those skilled in the art to understand or implement the application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the application. Therefore, the application will not be limited to these embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An image model-based spare part defect recognition detection method, characterized in that, The method comprises the following steps: Step S1: Collecting a grating image of a piston ring surface by an industrial camera, denoted as a to-be-inspected piston ring grating image; Step S2: Extracting a closed contour of a linear defect in the to-be-inspected piston ring grating image to generate a geometric defect contour set; extracting a continuous area of a surface defect in the to-be-inspected piston ring grating image to generate a texture defect area set; Step S3: Positioning an overlapping area of the geometric defect contour and the texture defect area based on the geometric defect contour set and the texture defect area set; Calculating the correlation of the pixel gradient distribution and the gray level change in the overlapping area to generate a coupling feature distribution graph representing the defect interaction intensity, and step S3 comprises: Traversing the spatial coordinates of the geometric defect contour set and the texture defect area set to identify a pixel area where the geometric defect contour and the texture defect area intersect as the overlapping area; Calculating the standard deviation of the gradient values of all pixels in the overlapping area, denoted as the gradient standard deviation; Calculating the coefficient of variation of the gray level values of all pixels in the overlapping area, denoted as the gray level variation coefficient, wherein the coefficient of variation = the standard deviation of the gray level values of all pixels in the overlapping area / the mean of the gray level values of all pixels in the overlapping area; Multiplying the gradient standard deviation and the gray level variation coefficient to generate a local interference coefficient representing the defect interaction intensity; Extracting the minimum circumscribed rectangle of the geometric defect contour, denoted as a contour outer frame; Calculating the minimum distance between the contour outer frame and the boundary of the texture defect area; If the minimum distance is negative and the absolute value is greater than or equal to a preset minimum distance threshold, the topological relationship between the geometric defect contour and the texture defect area is determined as complete encirclement; 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 area is determined as cross-penetration; If the topological relationship between the geometric defect contour and the texture defect area is complete encirclement, a preset first weight value is assigned to the current overlapping area; If the topological relationship between the geometric defect contour and the texture defect area is cross-penetration, a preset second weight value is assigned to the current overlapping area, wherein the preset first weight value is greater than the preset second weight value; Multiplying the local interference coefficient by the corresponding topological weight value to generate a coupling feature value of the current overlapping area; Traversing all overlapping areas to map the coupling feature values to the image coordinate system to generate a coupling feature distribution graph representing the defect interaction intensity; Step S4: Synchronously inputting the geometric defect contour set, the texture defect area set, and the coupling feature distribution graph into a preset lightweight fusion model to generate a collaborative determination result; generating a defect determination decision signal according to the collaborative determination result, and step S4 comprises: Inputting the geometric defect contour set, the texture defect area set, and the coupling feature distribution graph into the preset lightweight fusion model, wherein the collaborative analysis of the preset lightweight fusion model comprises extracting an interaction intensity mean and calculating a contour continuity score; If the interaction intensity mean is lower than a preset interaction intensity threshold, outputting an independent defect signal and a defect type identifier, and the defect type identifier is any one of a linear defect identifier and a surface 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, a concurrent defect signal and a composite defect parameter set are output, wherein the composite defect parameter set includes a linear defect length, an area of a surface defect, and a coupling depth, the linear defect length is an accumulation of the perimeters of all contours in the geometric defect contour set, the area of the surface defect is an accumulation of the areas of all regions in the texture defect region set, and the coupling depth is a pixel ratio of an interaction intensity peak region 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 is output and an emergency stop instruction is triggered. The independent defect signal / concurrent defect signal / high-risk defect signal is recorded as a defect judgment decision signal. Step S5: The defect judgment decision signal is used to control the automatic sorting mechanism to perform a classification operation on the piston ring.

2. The image model-based fastener defect recognition detection method according to claim 1, characterized by, The closed contour of the linear defect in the piston ring raster image to be inspected in step S2 includes: A preset first gradient operator is used to extract a high-frequency edge component of the piston ring raster image to be inspected, and a high-frequency gradient response map is generated; A preset second gradient operator is used to extract a low-frequency texture component of the piston ring raster image to be inspected, and a low-frequency gradient response map is generated; The high-frequency gradient response map and the low-frequency gradient response map are superimposed and fused according to pixels to generate a multi-scale gradient response map; A highlight region in the multi-scale gradient response map is identified, and gradient correction is performed on the highlight region to generate an anti-glare correction map; A low-contrast region in the multi-scale gradient response map is identified, and gradient enhancement is performed on the low-contrast region to generate a weak edge enhancement map; The geometric defect contour set is extracted based on the anti-glare correction map and the weak edge enhancement map.

3. The image model-based fastener defect recognition detection method according to claim 2, characterized by, The highlight region in the multi-scale gradient response map is identified, and gradient correction is performed on the highlight region, including: The brightness mean value of each pixel neighborhood in the multi-scale gradient response map is calculated, and if the brightness mean value is greater than or equal to a preset highlight threshold, the corresponding pixel neighborhood is determined to be a highlight region, wherein the calculation window size of the pixel neighborhood is a preset neighborhood window size; The gradient value of the highlight region in the high-frequency gradient response map is read; An attenuation coefficient is calculated according to the brightness mean value, wherein the specific calculation formula of the attenuation coefficient is as follows: Attenuation coefficient = 1 / (1+k* brightness mean value); Wherein, k is a preset material glare coefficient; The gradient value is multiplied by the attenuation coefficient to generate an anti-glare correction value, and the gradient value of the current pixel is updated to the anti-glare correction value to generate an anti-glare correction map.

4. The image model-based fastener defect recognition method according to claim 2, wherein The low-contrast region in the multi-scale gradient response map is identified, and gradient enhancement is performed on the low-contrast region, including: The gradient standard deviation of each pixel neighborhood in the multi-scale gradient response map is calculated, and if the gradient standard deviation is less than or equal to a preset contrast threshold, the corresponding pixel neighborhood is determined to be a low-contrast region, wherein the calculation window size of the pixel neighborhood is a preset neighborhood window size; The gradient value of the low-contrast region in the low-frequency gradient response map is read; The gradient value is enhanced using an S-shaped gain function, wherein the S-shaped gain function is as follows: ; Wherein, s is a preset sharpening intensity parameter; The gradient value of the current pixel is updated to the enhanced value to generate a weak edge enhancement map.

5. The image model-based fastener defect recognition method according to claim 2, wherein The geometric defect contour set is extracted based on the anti-glare correction map and the weak edge enhancement map, and includes the following steps: The gradient distribution histograms of the anti-glare correction map and the weak edge enhancement map are counted respectively; The pth percentile gradient threshold is determined according to the gradient distribution histograms, wherein p is a preset percentile parameter; Each pixel of the anti-glare correction map and the weak edge enhancement map is traversed, if the gradient value of the current pixel is greater than or equal to the pth percentile gradient threshold, then the closed operation is performed on the neighborhood of the pixel using a preset first structure element; If the gradient value of the current pixel is less than the pth percentile gradient threshold, then the closed operation is performed on the neighborhood of the pixel using a preset second structure element, wherein the preset first structure element is smaller than the preset second structure element; The anti-glare correction map and the weak edge enhancement map after the closed operation are taken as the maximum value of the pixel to generate a comprehensive gradient map; The closed continuous contour set is generated by performing contour extraction on the comprehensive gradient map, which is recorded as the geometric defect contour set.

6. The image model-based fastener defect recognition method according to claim 1, wherein, The continuous area of the planar defect in the piston ring raster image to be detected in step S2 includes the following steps: The piston ring raster image to be detected is divided into a plurality of analysis regions of a preset size to generate a large-scale region set, a medium-scale region set and a small-scale region set; wherein the large-scale region is used to capture macroscopic color spots, the medium-scale region is used to capture transition color spots, and the small-scale region is used to capture microscopic color spots; Each analysis region in each scale region set is traversed: The gray level histogram of the current analysis region is counted, and the mean and standard deviation of the gray level are calculated; The segmentation threshold is calculated based on the mean and standard deviation of the gray level, and the calculation formula of the segmentation threshold is as follows: Segmentation threshold = mean + k × standard deviation; Wherein, k is a preset sensitivity coefficient; The pixels with a gray value greater than the segmentation threshold are marked as candidate defect pixels to generate a candidate defect pixel set; If the candidate defect pixels in the large-scale region set and the candidate defect pixels in the medium-scale region set overlap in space, then the candidate defect pixels in the overlapping region are merged into the same color spot region; If the candidate defect pixels in the medium-scale region set and the candidate defect pixels in the small-scale region set overlap in space, then the candidate defect pixels in the overlapping region are merged into the same color spot region; The morphological closed operation is performed on the merged color spot region to generate a texture defect region set.

7. The image model-based fastener defect recognition method according to claim 1, wherein, The classification operation on the piston ring in step S5 includes: When the independent defect signal is received, the sorting mechanism is controlled according to the defect type identification, if the type identification is linear defect, the current piston ring is transferred to the laser repair station, if the type identification is planar defect, the current piston ring is transferred to the polishing station; When the 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 is transferred to the artificial re-inspection channel.

8. An image model-based spare part defect recognition detection system, characterized by, The image model-based spare part defect identification detection method is executed, and the image model-based spare part defect identification detection system includes: An image acquisition module is configured to acquire a raster image of a piston ring surface through an industrial camera, which is recorded as a piston ring raster image to be detected. The defect extraction module is configured to extract closed contours of linear defects in the piston ring grating image to be inspected to generate a set of geometric defect contours; and extract continuous regions of planar defects in the piston ring grating image to be inspected to generate a set of texture defect regions; The interaction analysis module is configured to locate an overlapping region of the geometric defect contours and the texture defect regions based on the set of geometric defect contours and the set of texture defect regions; and perform correlation calculation on pixel gradient distribution and grayscale change in the overlapping region to generate a coupling feature distribution map representing defect interaction intensity; The fusion determination module is configured to input the set of geometric defect contours, the set of texture defect regions, and the coupling feature distribution map into a preset lightweight fusion model synchronously to generate a collaborative determination result; and generate a defect determination decision signal according to the collaborative determination result; The sorting control module is configured to control an automatic sorting mechanism to perform a classification operation on the piston ring according to the defect determination decision signal.

Citation Information

Patent Citations

  • Intelligent recognition method based on fusion of defect pulse signal and image

    US20240418680A1

  • Vision inspection system using distance learning of product defect image

    WO2022065621A1