A piston ring defect detection method and system based on image segmentation

By using polar coordinate expansion and grayscale mean curves to locate the gap in the piston ring, combined with angle normalization and image segmentation networks, the systematic misjudgment in piston ring defect detection is solved, achieving highly accurate defect detection. This method is applicable to the detection of different types of piston rings.

CN122453793APending Publication Date: 2026-07-24ZHANGSHU ZHENGRUI AUTO PARTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610624362.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-08
Publication Date
2026-07-24

Smart Images

  • Figure CN122453793A_ABST
    Figure CN122453793A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image segmentation, and particularly relates to a piston ring defect detection method and system based on image segmentation. The method comprises: performing polar coordinate expansion on a top view image of a piston ring to obtain a rectangular expansion graph with a circumferential angle as a horizontal axis and a radial direction as a vertical axis; calculating a gray mean value column by column along the horizontal axis direction, positioning a local minimum value interval corresponding to an opening gap in the gray mean value curve in combination with design parameters corresponding to the piston ring model, recording a center column of the interval as an angle zero point, and recording a horizontal coordinate range as an opening reference interval; performing horizontal axis rolling translation on the rectangular expansion graph with the angle zero point as a reference to obtain an angle normalized expansion graph; and inputting the angle normalized expansion graph into a target image segmentation network to output a pixel-level defect segmentation mask. The present application converts the piston ring opening gap from a detection interference source into an angle coordinate reference, and simultaneously realizes false positive exclusion and true positive confidence improvement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image segmentation technology, and in particular to a piston ring defect detection method and system based on image segmentation. Background Technology

[0002] Piston rings are the core sealing components of reciprocating internal combustion engines, and their surface quality directly affects the engine's airtightness, lubrication performance, and service life. During the manufacturing process, piston rings may develop various surface defects such as scratches, corrosion pits, and through cracks. Accurate detection of these defects is a crucial step in ensuring product quality.

[0003] Machine vision-based automated inspection methods typically unfold the top-view image of a piston ring captured by an industrial camera into polar coordinates, mapping the surface of the annular workpiece into a rectangular unfolded image. Image processing algorithms are then used to segment and identify defects in the unfolded image. However, piston rings have a pre-defined opening gap, which appears as a dark vertical band running radially through the entire image in the polar coordinate unfolded image. Its grayscale characteristics are highly similar to those of a through-crack, and existing image segmentation methods cannot effectively distinguish between the two, leading to systematic misjudgments. Summary of the Invention

[0004] Therefore, it is necessary for the present invention to provide a piston ring defect detection method and system based on image segmentation to solve at least one of the above-mentioned technical problems.

[0005] To achieve the above objectives, a piston ring defect detection method based on image segmentation includes the following steps: Step S1: Perform polar coordinate expansion on the top view image of the piston ring to obtain a rectangular expansion diagram with the circumferential angle as the horizontal axis and the radius direction as the vertical axis; Step S2: Calculate the grayscale mean value column by column along the horizontal axis of the rectangular unfolded diagram to obtain the grayscale mean value curve; locate the local minimum value interval corresponding to the opening gap in the grayscale mean value curve according to the design parameters corresponding to the piston ring model; record the center column of the local minimum value interval as the angle zero point, and the horizontal coordinate range as the opening reference interval; Step S3: Using the zero point of angle as a reference, roll and translate the rectangular unfolded diagram along the horizontal axis, aligning the zero point of angle to the same horizontal position of the rectangular unfolded diagram, to obtain the angle-normalized unfolded diagram; Step S4: Input the angle-normalized unfolded image into the preset image segmentation network and output a pixel-level defect segmentation mask; Step S5: Mark the segmented regions in the defect segmentation mask that fall into the open reference interval as structural features and exclude them. Perform geometric verification on the connected regions outside the open reference interval in combination with the design parameters corresponding to the piston ring model, generate the defect confidence level, and output the final defect detection result.

[0006] The present invention also provides a piston ring defect detection system based on image segmentation, for performing the piston ring defect detection method based on image segmentation as described above, wherein the piston ring defect detection system based on image segmentation includes: The toroidal unfolding module is used to unfold the top view image of the piston ring in polar coordinates to obtain a rectangular unfolded image with the circumferential angle as the horizontal axis and the radius direction as the vertical axis. The gap reference positioning module is used to calculate the grayscale mean value column by column along the horizontal axis of the rectangular unfolded diagram to obtain the grayscale mean value curve; according to the design parameters corresponding to the piston ring model, it locates the local minimum value interval corresponding to the opening gap in the grayscale mean value curve; the center column of the local minimum value interval is recorded as the angle zero point, and the horizontal coordinate range is recorded as the opening reference interval; The angle normalization module is used to roll and translate the rectangular unfolded diagram along the horizontal axis with the angle zero point as the reference, aligning the angle zero point to the same horizontal position of the rectangular unfolded diagram to obtain the angle normalized unfolded diagram. The defect segmentation module is used to input the angle-normalized unfolded image into a preset image segmentation network and output a pixel-level defect segmentation mask. The geometric verification output module is used to mark the segmented regions that fall into the open reference interval in the defect segmentation mask as structural features and exclude them. It also performs geometric verification on the connected regions outside the open reference interval in combination with the design parameters corresponding to the piston ring model, generates the defect confidence level, and outputs the final defect detection result.

[0007] This method fundamentally solves the systemic misjudgment problem faced by existing image segmentation methods in piston ring defect detection by transforming the piston ring gap from a source of interference in the detection system into a geometric reference that runs through the entire process. By combining the gray-scale mean curve with the end gap tolerance range, the gap is automatically located without relying on any additional hardware, and its lateral coordinates are transformed into an angular zero point. This drives the circumferential normalization of the unfolded image, so that the gap, which was originally randomly distributed with the workpiece placement angle, is uniformly aligned to the same position in the unfolded images of all workpieces. This operation simultaneously produces three chain-like improvement effects.

[0008] Angle normalization ensures that the unfolded images of different workpieces have a unified circumferential angle reference at the pixel coordinate level. The lateral position of the defect in the unfolded image no longer drifts randomly due to different workpiece placement angles. The positional variation faced by the segmentation network during training is significantly reduced, enabling it to converge to a more stable segmentation boundary with fewer samples, which is particularly important in the small sample conditions commonly found in industrial scenarios. Second, the cyclic shift data augmentation based on the angle-normalized coordinate system constrains the effective range of each shift to outside the opening reference interval. This ensures that each augmented sample physically corresponds to the real situation of the same defect appearing at different circumferential angles on the piston ring, rather than a purely mathematical transformation. The physical credibility of the augmented samples guarantees that the network will not learn incorrect defect-opening spatial relationships from the augmented data. Third, the geometric verification performed on connected regions outside the opening reference interval in the post-processing stage uses the end gap tolerance range as both a filtering basis for eliminating false positives and a positive basis for increasing the confidence of true positives, forming a two-way utilization. Connected regions with widths within the tolerance range and uniform shapes uniquely correspond to through cracks after eliminating the possibility of opening gaps, and their confidence is actively increased; connected regions with widths exceeding the tolerance range retain the original confidence of the network, which is determined by the network itself.

[0009] Furthermore, the number of edge exclusion rows is derived from the geometric distortion coefficient of the compensated polar coordinate sampling grid, enabling the width measurement to automatically adapt to piston ring models with different inner and outer diameter ratios without manual parameter adjustment. The width variation coefficient judgment threshold is derived from the measured distribution statistics of labeled cracks in the training sample set, and automatically converges to a physical lower bound reflecting the true crack morphology characteristics as samples accumulate. All criteria in the entire method are derived from piston ring design parameters or measured statistics. When changing production, only the outer diameter, inner diameter, and end clearance tolerance in the model file need to be updated, without redesigning the algorithm process, and it has low-cost cross-model migration capability. Attached Figure Description

[0010] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a schematic diagram of the steps in a piston ring defect detection method based on image segmentation. Figure 2 This is a schematic diagram illustrating the effective range constraint of a cyclic shift in one embodiment; Figure 3 This is a schematic diagram of a bidirectional confidence criterion for geometric verification of connected components according to one embodiment; Figure 4 This is a schematic diagram of a piston ring defect detection system based on image segmentation. Detailed Implementation

[0011] 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.

[0012] 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.

[0013] 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.

[0014] To achieve the above objectives, please refer to Figures 1 to 4 This invention provides a piston ring defect detection method based on image segmentation, the method comprising the following steps: Step S1: Perform polar coordinate expansion on the top view image of the piston ring to obtain a rectangular expansion diagram with the circumferential angle as the horizontal axis and the radius direction as the vertical axis; Step S2: Calculate the grayscale mean value column by column along the horizontal axis of the rectangular unfolded diagram to obtain the grayscale mean value curve; locate the local minimum value interval corresponding to the opening gap in the grayscale mean value curve according to the design parameters corresponding to the piston ring model; record the center column of the local minimum value interval as the angle zero point, and the horizontal coordinate range as the opening reference interval; Step S3: Using the zero point of angle as a reference, roll and translate the rectangular unfolded diagram along the horizontal axis, aligning the zero point of angle to the same horizontal position of the rectangular unfolded diagram, to obtain the angle-normalized unfolded diagram; Step S4: Input the angle-normalized unfolded image into the preset image segmentation network and output a pixel-level defect segmentation mask; Step S5: Mark the segmented regions in the defect segmentation mask that fall into the open reference interval as structural features and exclude them. Perform geometric verification on the connected regions outside the open reference interval in combination with the design parameters corresponding to the piston ring model, generate the defect confidence level, and output the final defect detection result.

[0015] Furthermore, step S1 includes the following steps: Using the geometric center of the piston ring top view image as the origin, a polar coordinate sampling grid is established by dividing the circumferential angle direction into equal parts from 0° to 360° and the radius direction into equal parts from the inner diameter to the outer diameter; In one embodiment, the geometric center of the piston ring top view image can be obtained by performing a Hough circle transform or least-squares circle fitting on the outline of the piston ring in the image, with the center of this circle as the origin of polar coordinates. Centered on the origin, the circumferential direction from 0° to 360° is uniformly divided into M parts, and the radial direction from the inner diameter to the outer diameter is uniformly divided into N parts, generating M×N sampling point positions in polar coordinate space to form an initial polar coordinate sampling grid, where M determines the lateral resolution of the unfolded image and N determines the longitudinal resolution of the unfolded image.

[0016] For example, for a piston ring with an outer diameter of 60mm and an inner diameter of 54mm, if M=2048 and N=256 are set, the unfolded image size is 2048×256 pixels, and the horizontal arc length corresponding to each pixel is approximately 0.092mm.

[0017] The circumferential stretching coefficient of the sampling point is obtained by calculating the ratio of the radius value at each sampling point in the polar coordinate sampling grid to the radius value of the innermost sampling point. In one embodiment, the distance between each sampling point in the initial polar coordinate sampling grid and the center of the circle is the radius value of that sampling point. Dividing this radius value by the radius value of the innermost sampling point (i.e., the pixel distance corresponding to the inner diameter of the piston ring) yields the circumferential stretching coefficient. This coefficient reflects the magnification factor of the arc length of the circumference of the sampling point relative to the innermost circumference—the larger the radius of the sampling point, the longer the arc length of the circumference of its circumference, and the greater the circumferential stretching coefficient.

[0018] For example, if the inner diameter corresponds to a pixel distance of 270 pixels and the radius of a certain sampling point is 324 pixels, then the circumferential stretching coefficient of the sampling point is 324÷270=1.2, which means that the arc length of the circumference is 1.2 times that of the innermost circle.

[0019] The bilinear interpolation sampling range of each sampling point is expanded proportionally along the circumferential direction by the circumferential stretching coefficient. The interpolation window of each sampling point covers the same actual arc length in the circumferential direction, thus obtaining the compensated polar coordinate sampling grid. In one embodiment, the bilinear interpolation sampling window uses the same fixed size for all sampling points by default. This causes the actual arc length covered by the interpolation window of the outer ring sampling points in the circumferential direction to be greater than that of the inner ring, resulting in an uneven phenomenon where the surface area represented by the outer ring pixels is larger and the surface area represented by the inner ring pixels is smaller. The compensation method is to divide the size of the interpolation window of each sampling point in the circumferential direction by the circumferential stretching coefficient of that sampling point, so that the interpolation window of the outer ring sampling points is narrowed proportionally in the circumferential direction. Finally, the actual arc length covered by the interpolation window of each ring sampling point in the circumferential direction tends to be consistent, resulting in a compensated polar coordinate sampling grid.

[0020] It should be noted that this compensation only applies to the circumferential dimension of the interpolation window; the radial dimension is not included in the compensation because the sampling interval of each circle in the radial direction is already uniform.

[0021] Bilinear interpolation sampling is performed on the top view image of the piston ring based on the compensated polar coordinate sampling grid. The sampling results are arranged by angle as columns and radius as rows to obtain a rectangular unfolded image.

[0022] In one embodiment, based on a compensated polar coordinate sampling grid, bilinear interpolation is performed on the original piston ring top view image for each sampling point to obtain the grayscale value of that sampling point. Bilinear interpolation uses the grayscale values ​​of the four nearest neighbor pixels around the sampling point, weighted by distance, to calculate the interpolation result, avoiding the jagged effect caused by directly taking the nearest neighbor pixels. The interpolation results of M×N sampling points are arranged in order of columns along the angular direction and rows along the radial direction to obtain a rectangular unfolded image of size M×N, where the i-th column corresponds to the surface information at the piston ring circumference angle i×360° / M, and the j-th row corresponds to the surface information at a distance of (inner diameter + j×(outer diameter - inner diameter) / N) from the center.

[0023] It should be noted that the horizontal axis of the unfolded diagram corresponds to the continuous unfolding of the piston ring circumference from 0° to 360° from left to right. The lateral position of the opening gap in the unfolded diagram depends on the angle of the opening when the workpiece is placed. Before subsequent angle normalization processing, the column coordinates of the opening gap of different workpieces are randomly distributed.

[0024] Furthermore, step S2 includes the following steps: Step S21: Obtain the outer diameter, inner diameter and end clearance tolerance range corresponding to the piston ring model as design parameters, and calculate the horizontal axis pixel-size conversion factor by the ratio of the outer diameter circumference to the total number of pixels on the horizontal axis of the rectangular unfolded diagram. In one embodiment, design parameters are read from the piston ring model file, including the outer diameter, inner diameter, and end clearance tolerance range. The horizontal axis pixel-to-size conversion factor is obtained by dividing the outer diameter circumference by the total number of pixels on the horizontal axis of the unfolded diagram. Its physical meaning is the actual arc length corresponding to each column of pixels in the circumferential direction in the unfolded diagram.

[0025] For example, the outer diameter circumference of a piston ring with an outer diameter of 60mm is approximately 188.5mm. If the total number of pixels on the horizontal axis of the unfolded diagram is 2048, then the conversion factor is 188.5 ÷ 2048 ≈ 0.092mm / pixel. Any subsequent horizontal pixel distance can be converted into the actual arc length by multiplying by this factor.

[0026] It should be noted that the conversion factor is calculated based on the outer diameter circumference rather than the inner diameter circumference. This is because the sampling density of the horizontal axis of the unfolded diagram is determined by the uniformity of the arc length at the outer diameter. Using the outer diameter as the reference ensures the most accurate dimensional conversion of the outer ring surface area. The piston ring working surface is mainly located near the outer diameter, and this choice has practical testing significance.

[0027] Step S22: Calculate the grayscale mean of all pixels in the corresponding column along the horizontal axis of the rectangular unfolded image to obtain a grayscale mean curve with the column coordinates as the horizontal axis and the grayscale mean as the vertical axis. In one embodiment, for each column of the unfolded image, the arithmetic mean of the grayscale values ​​of all pixels from the first row to the last row in that column is calculated to obtain the column mean. The column means of all columns are arranged in column coordinate order to form a grayscale mean curve. The horizontal axis of this curve represents the column coordinate (corresponding to a circumferential angle), and the vertical axis represents the average grayscale value along the radial direction at that angular position. The column mean of the normal surface of the piston ring is relatively stable at different angular positions, while at the opening gap, due to the exposed metal cut surface and the low reflectivity of the gap background, the column mean is significantly lower than that of the normal surface, forming a local concave shape on the curve.

[0028] It should be noted that the grayscale mean curve is somewhat sensitive to uneven lighting. If there is a significant brightness gradient along the circumference of the light source, the curve will show a slow overall drift trend. However, as long as the drift amplitude is much smaller than the concave depth at the opening gap, it will not affect the subsequent extraction of the concave section.

[0029] Step S23: Extract all continuous concave segments below the global mean of the grayscale mean curve, and multiply the pixel width of each concave segment by the horizontal axis pixel-size conversion factor to obtain the actual width of the continuous concave segment.

[0030] In one embodiment, the arithmetic mean of all column means of the grayscale mean curve is first calculated as the global mean. Then, the column coordinates of all column means lower than the global mean are marked on the curve. Adjacent column coordinates lower than the global mean are merged into continuous segments, and each continuous segment is a concave segment. The pixel width of each concave segment is the ending column coordinate minus the starting column coordinate plus one. The actual width of the segment is obtained by multiplying the pixel width by the horizontal axis pixel-size conversion factor.

[0031] For example, if a recessed section extends from column 412 to column 426, with a pixel width of 15 pixels and a conversion factor of 0.092mm / pixel, then the actual width is 15×0.092=1.38mm.

[0032] Furthermore, step S2 also includes the following steps: Step S24: Select concave sections whose actual width falls within the end gap tolerance range as candidate intervals; In one embodiment, the actual width of each concave section is compared with the lower and upper limits of the end clearance tolerance of the piston ring of that model. Concave sections whose actual width falls within the range of the lower to upper tolerance limits are retained as candidate sections, and the remaining sections are discarded.

[0033] For example, if the end gap tolerance range is 0.25mm to 0.45mm, then concave sections with an actual width less than 0.25mm or greater than 0.45mm are not considered as candidate sections.

[0034] It should be noted that the end clearance tolerance range is a model-specific parameter read from the design drawings. Different models of piston rings have different end clearance tolerance ranges. When changing production, this parameter needs to be updated synchronously, otherwise the candidate range screening will fail.

[0035] Step S25: When there is more than one candidate interval, perform edge slope symmetry verification on each candidate interval to confirm the local minimum interval; when there is only one candidate interval, confirm the candidate interval as the local minimum interval. In one embodiment, when there is only one candidate interval, it is directly identified as a local minimum interval. When there is more than one candidate interval, edge slope symmetry verification is performed on each candidate interval. The opening gap is formed by mechanical cutting, and the grayscale drop rate on both sides of its edges is physically symmetrical. However, the slopes on both sides of the depression caused by other reasons (such as defects or texture overlay) are usually asymmetrical. This difference can be used to identify the true opening gap among multiple candidate intervals.

[0036] It should be noted that under normal production conditions, it is rare for there to be more than one candidate interval. This is more common when there is a wide corrosion band on the piston ring surface or when the unfolded pattern is affected by strong and uneven lighting.

[0037] Step S26: Record the center column of the local minimum value interval as the angle zero point, and record the coordinates of the starting column to the ending column of the local minimum value interval as the open reference interval.

[0038] In one embodiment, after the local minimum interval is identified, the mean of its starting and ending column coordinates is rounded down to obtain the center column coordinate of the interval, which is recorded as the angle zero point. The complete range from the starting column coordinate to the ending column coordinate is recorded as the open reference interval.

[0039] For example, if the local minimum interval is from column 412 to column 426, then the angle zero point is column 419, and the opening reference interval is from column 412 to column 426.

[0040] Of particular importance, the edge slope symmetry verification includes: Extract the column mean sequence within the range of the predefined extension column number extending to the left and right of the left boundary of each candidate interval, and calculate the first difference mean of the left column mean sequence as the left slope and the first difference mean of the right column mean sequence as the right slope. In one embodiment, for each candidate interval, several consecutive columns are extended to the left of its left boundary column coordinates and several consecutive columns are extended to the right of its right boundary column coordinates. The gray-level mean curve values ​​within these two column coordinate ranges are extracted to obtain a left column mean sequence and a right column mean sequence. The difference between adjacent elements in the left column mean sequence is calculated to obtain a first-order difference sequence, and the arithmetic mean of this difference sequence is taken as the left slope. The same operation is performed on the right column mean sequence to obtain the right slope. A positive left slope means that the gray-level mean increases from left to right, that is, the gray level gradually decreases from the normal surface towards the center of the gap; a negative right slope means that the gray-level mean decreases from left to right, that is, the gray level gradually increases from the center of the gap towards the normal surface. The combination of the two reflects the physical characteristic of symmetrical gray-level drop on both sides of the opening gap.

[0041] For example, if the mean sequence of the left column is [182, 178, 171, 163], then the first difference is [-4, -7, -8], and the mean is approximately -6.3. However, the slope on the left should be positive here. Therefore, in actual calculation, the difference of the mean sequence of the left column from left to right is taken, that is, the rate of change from far away from the gap to near the gap. A positive result indicates that the gray level decreases when approaching the gap.

[0042] When the left slope of a candidate interval is positive and the right slope is negative, and the difference between the absolute values ​​of the left slope and the right slope does not exceed a preset proportion of the larger absolute value, the candidate interval is determined to pass the symmetric edge feature verification. In one embodiment, two judgments are performed on the left slope and right slope of each candidate interval: the first judgment is whether the sign of the left slope is positive and the sign of the right slope is negative. If the signs do not meet the requirements, the verification is directly deemed to have failed; the second judgment is whether the difference between the absolute values ​​of the left slope and the right slope does not exceed a preset ratio of the larger of the two absolute values. This ratio reflects the tolerance level of symmetry.

[0043] For example, if the slope on the left is 6.3 and the slope on the right is -5.8, the difference between their absolute values ​​is 0.5, the larger absolute value is 6.3, and the ratio is approximately 7.9%. If the preset ratio is 30%, the verification will pass. If the slope on the left is 6.3 and the slope on the right is -2.1, the difference between their absolute values ​​is 4.2, and the ratio is approximately 66.7%, the verification will fail.

[0044] When only one candidate interval passes the verification, the candidate interval is confirmed as a local minimum interval; when multiple candidate intervals pass or fail the verification, the interval with the lowest gray value is taken as the local minimum interval.

[0045] In one embodiment, after verifying the symmetry of all candidate intervals, the local minimum interval is confirmed based on the verification results. When only one candidate interval passes the verification, that interval is the local minimum interval corresponding to the opening gap. When multiple candidate intervals pass the verification, it indicates that there are multiple concave regions on the piston ring surface with widths and symmetry similar to the opening gap. In this case, the lowest grayscale value among the candidate intervals is used as the criterion, because the interior of the actual opening gap is air or a dark background, and its grayscale value is usually lower than that of the concave sections caused by surface defects.

[0046] When all candidate intervals fail the validation, the interval with the lowest grayscale mean is also taken as the local minimum interval to ensure that the method can still output a definite result without interrupting the detection process under abnormal conditions.

[0047] Most importantly, the method for determining the number of extended columns is as follows: The average of the upper and lower limits of the end gap tolerance range is extracted from the design parameters corresponding to the piston ring model as the nominal width of the end gap. The nominal width of the end gap is divided by the horizontal axis pixel-size conversion factor to obtain the nominal pixel width of the end gap. Extract the actual pixel width of the current candidate interval, calculate the ratio of the actual pixel width of the current candidate interval to the nominal pixel width of the end gap, and obtain the width deviation coefficient of the candidate interval. The baseline extension column number is obtained by rounding down 0.8 times the nominal pixel width of the end gap. The baseline extension column number is then multiplied by the width deviation coefficient and rounded down to obtain the extension column number. When the number of extended columns is less than 3, it is corrected to 3; when the number of extended columns is greater than the width of the candidate interval pixels, it is corrected to the width of the candidate interval pixels.

[0048] Step S3: Using the zero point of angle as a reference, roll and translate the rectangular unfolded diagram along the horizontal axis, aligning the zero point of angle to the same horizontal position of the rectangular unfolded diagram, to obtain the angle-normalized unfolded diagram; In one embodiment, the translation amount of the rolling translation is determined by the difference between the coordinates of the zero-angle column and the coordinates of the fixed reference column. The fixed reference column remains unchanged in all workpieces of the same model and can be the 0th column of the horizontal axis of the unfolded diagram or any pre-specified column coordinate. The translation operation moves the zero-angle column in the unfolded diagram to the position of the fixed reference column. The columns to the left of the zero-angle are cyclically added from the right side of the unfolded diagram, and the columns to the right of the zero-angle are moved to the left as a whole.

[0049] For example, if the total number of pixels on the horizontal axis of the unfolded image is 2048, the zero point of the angle is column 419, and the fixed reference column is column 0, then the translation amount is 419. Column 419 of the original image is moved to column 0, columns 420 to 2047 of the original image are moved to columns 1 to 1628 in sequence, and columns 0 to 418 of the original image are cyclically added to columns 1629 to 2047.

[0050] It should be noted that the specific values ​​of the fixed reference column do not affect the test results. As long as all workpieces of the same model use the same fixed reference column, its only function is to ensure that the angle normalization unfolded diagrams of different workpieces have a unified coordinate reference in the horizontal axis direction, so that the opening reference interval is always located in the same horizontal position in the unfolded diagrams of all workpieces.

[0051] Furthermore, step S4 includes the following steps: Step S41: Pixel-level annotation is performed on the angle normalized unfolded images of qualified and defective piston rings of the same model to obtain the annotation mask, which forms the training sample set; In one embodiment, the training samples come from two sources: one is known defective products manually selected from the production line, and the other is qualified products confirmed through full inspection. Both types of samples must first undergo complete processing in steps S1 to S3 to obtain their respective angle-normalized unfolded images before annotation. The annotation work is completed by inspection personnel with experience in piston ring defect judgment. The defective areas in each angle-normalized unfolded image are delineated pixel by pixel, generating a binary annotation mask with the same size as the unfolded image. Defective pixels are marked as 1, and normal pixels are marked as 0.

[0052] Step S42: Perform random cyclic shifting on each angle-normalized unfolded image and corresponding labeled mask in the training sample set along the horizontal axis. The shift amount is randomly selected within the range of the total number of pixels on the horizontal axis of the rectangular unfolded image minus the width of the opening reference interval from the end column coordinate of the opening reference interval. In one embodiment, cyclic shifting involves translating the angle-normalized unfolded image as a whole along the horizontal axis, with columns exceeding the right boundary being cyclically added from the left boundary. The lower bound of the shift amount is taken as the coordinates of the terminal column of the opening reference interval, and the upper bound is taken as the total number of pixels on the horizontal axis of the unfolded image minus the pixel width of the opening reference interval. These two boundaries together ensure that the opening reference interval never overlaps with the defect area in the annotation mask after shifting.

[0053] For example, if the total number of pixels on the horizontal axis of the unfolded image is 2048 and the opening reference interval is from column 419 to column 433 (pixel width is 15), then the shift amount will be randomly selected between 433 and 2033; if the shift amount is 800, then column 1 of the original image will be moved to column 801, column 2048 of the original image will be moved to column 800, and the label mask will perform the exact same shift operation.

[0054] It should be noted that the angle-normalized unfolded map and the label mask must be synchronously shifted using the exact same shift amount. If the shift amounts are inconsistent, the defect area will be misaligned with the label mask, resulting in an incorrect training signal.

[0055] Step S43: Merge the shifted angle normalized unfolded map and the synchronously shifted labeled mask as new training samples into the training sample set to obtain the expanded training sample set; In one embodiment, each original training sample can undergo multiple cyclic shifts with different shift amounts, each shift generating a new training sample. All shifted samples are then merged with the original training samples to obtain an expanded training sample set.

[0056] For example, if the original training sample set contains 200 images, and each image is randomly shifted 5 times, the expanded training sample set contains 1200 images.

[0057] It should be noted that the shifted samples physically correspond to the same defect appearing at different circumferential angles on the piston ring. This augmentation method is different from conventional data augmentation methods such as random flipping and brightness jitter. Its augmentation results are geometrically self-consistent, and each augmented sample is a real possible image of the piston ring surface.

[0058] Step S44: Select an image segmentation network based on the encoding / decoding structure, with an input size consistent with the size of the rectangular unfolded image, and an output channel number consistent with the number of defect categories as the network to be trained; In one embodiment, the network to be trained employs an encoder-decoder structure. The encoder is responsible for extracting features step by step and reducing spatial resolution, while the decoder is responsible for restoring spatial resolution step by step and outputting pixel-level prediction results with the same size as the input. The network has one input channel (grayscale image), and the input size is consistent with the width and height of the rectangular unfolded image. The number of output channels is consistent with the number of defect categories, and each output channel corresponds to a pixel-level probability map of one defect type.

[0059] For example, if the defect categories include four types: scratches, corrosion pits, through cracks, and normal surfaces, then the number of output channels is 4. The network outputs four probability values ​​for each pixel, and takes the category with the highest probability as the segmentation result for that pixel.

[0060] Step S45: Train the network to be trained with an expanded training sample set until convergence, and store the converged network weight parameters to obtain the target image segmentation network. In one embodiment, the network to be trained is iteratively trained using an expanded training sample set. In each iteration, a batch of samples is randomly selected from the expanded training sample set, the loss value between the network output and the labeled mask is calculated, and the network weights are updated by backpropagation. Convergence is determined when the segmentation accuracy on the validation set no longer improves. After convergence, all weight parameters of the network are stored in a file to obtain the target image segmentation network.

[0061] Step S46: Input the normalized unfolded image of the current piston ring angle into the target image segmentation network, and output a pixel-level defect segmentation mask.

[0062] In one embodiment, during the inference phase, the angle-normalized unfolded image of the current piston ring is directly input into the target image segmentation network. The network outputs the probability of the defect category to which each pixel belongs in the unfolded image, and takes the category with the highest probability as the segmentation result of the pixel, thus obtaining a pixel-level defect segmentation mask with the same size as the angle-normalized unfolded image.

[0063] It should be noted that the category label of each pixel in the defect segmentation mask corresponds completely to the category system defined during annotation, and the subsequent geometric verification of the connected components in the mask is performed based on this category label.

[0064] like Figure 2 As shown, the horizontal bar represents the entire column coordinate range of the rectangular unfolded diagram, from 0 to 2048. The dark area at the left end of the bar is the opening reference interval, corresponding to the piston ring opening gap aligned to a fixed position at the left end of the unfolded diagram after angle normalization. The dark area at the right end of the bar is the cyclic shift protection zone, whose width is equal to the pixel width of the opening reference interval, corresponding to the column coordinate range that the opening reference interval may wrap around to after cyclic shifting. The light area between the two dark areas is the effective shift range, and the shift amount is randomly selected within this range. The lower bound is the ending column coordinate of the opening reference interval, and the upper bound is the total number of pixels on the horizontal axis minus the pixel width of the opening reference interval.

[0065] Figure 2 The image above shows that after random cyclic displacement, defect A was moved from its original position to a new position, and both positions fell within the effective displacement range, ensuring that the defect area after displacement did not overlap with the opening reference interval or the cyclic displacement protection zone.

[0066] Furthermore, step S5 includes the following steps: Step S51: Mark all connected components in the defect segmentation mask that fall within the horizontal coordinate range of the opening reference interval as structural features and exclude them to obtain the candidate defect mask; In one embodiment, each connected component in the defect segmentation mask is a set of pixels with the same pixel value that are spatially connected. For each connected component, the column coordinates of all its pixels are checked to see if they fall within the range of the start column to the end column of the opening reference interval. Connected components that fall completely within this range are marked as structural features and removed from the mask to obtain a candidate defect mask.

[0067] It should be noted that some connected components may cross the boundary of the opening reference interval, that is, some pixels are inside the interval and some are outside the interval. For such connected components, it is recommended to preserve them as a whole and process them in subsequent geometric verification, rather than forcibly segmenting them, so as to avoid incorrectly splitting the real cracks that cross the opening boundary.

[0068] Step S52: Divide the difference between the inner and outer diameters by the total number of pixels on the vertical axis of the rectangular unfolded diagram to obtain the vertical axis pixel-size conversion factor; In one embodiment, the physical meaning of the vertical axis pixel-size conversion factor is the actual distance corresponding to each row of pixels in the radial direction of the piston ring in the unfolded diagram. Since the vertical axis of the unfolded diagram is uniformly unfolded from the inner diameter to the outer diameter, the difference between the inner and outer diameters is the total radial length covered in the vertical axis direction. Dividing this by the total number of pixels in the vertical axis yields the radial distance corresponding to each row of pixels.

[0069] For example, if the outer diameter is 60mm, the inner diameter is 54mm, and the total number of pixels on the vertical axis is 256, then the vertical axis pixel-size conversion factor is 6÷256≈0.023mm / pixel.

[0070] Step S53: Obtain the geometric distortion coefficient based on the ratio of the circumferential stretching coefficient of the outermost sampling point to the circumferential stretching coefficient of the innermost sampling point in the compensated polar coordinate sampling grid; subtract 1 from the geometric distortion coefficient and multiply it by 0.5 times the total number of pixels on the vertical axis of the rectangular unfolded image to obtain the number of edge exclusion rows.

[0071] In one embodiment, the circumferential stretching coefficient of the outermost sampling points in the compensated polar coordinate sampling grid is equal to the ratio of the outer diameter to the inner diameter, and the circumferential stretching coefficient of the innermost sampling points is 1. The ratio of the two is the geometric distortion coefficient, which reflects the degree of difference in sampling density at the outer diameter relative to the inner diameter. Subtracting 1 from the geometric distortion coefficient yields the excess stretching ratio of the outer circle relative to the inner circle. Multiplying this by 0.5 times the total number of pixels on the vertical axis yields the number of edge exclusion rows.

[0072] For example, if the outer diameter is 60mm and the inner diameter is 54mm, the geometric distortion coefficient is 60÷54≈1.111. Subtracting 1 gives 0.111. Multiplying by 256×0.5=128, we get approximately 14 rows of edge exclusion. That is, in the area of ​​14 rows near the edges of both the inner and outer diameters, the difference in sampling density exceeds the normal level, and the width measurement value of this area is not representative.

[0073] Furthermore, step S5 also includes the following steps: Step S54: Measure the horizontal pixel width of each connected component in the candidate defect mask row by row along the vertical axis to obtain the row-by-row width sequence of the connected component; In one embodiment, for each connected component in the candidate defect mask, the data is scanned from the first row to the last row along the vertical axis. The number of pixels belonging to the connected component in each row is counted, which is the horizontal pixel width of the row. The horizontal pixel widths of all rows are arranged in order of row coordinates to obtain a row-by-row width sequence.

[0074] It should be noted that if the pixels of a connected component in a row are not continuous (i.e. there are discontinuities), the total number of pixels belonging to that connected component in that row is still used as the width, and the discontinuity case is not handled separately, because the subsequent calculation of the width variation coefficient can reflect this non-uniformity.

[0075] Step S55: Remove the measured values ​​within the exclusion row range of each edge near the inner diameter edge and the outer diameter edge in the line-by-line width sequence to obtain the remaining width sequence; calculate the mean of the remaining width sequence as the mean width of the region, and multiply the mean width of the region by the horizontal axis pixel-size conversion factor to convert it into the actual width of the connected component; In one embodiment, several elements from the leading edge exclusion row and several elements from the trailing edge exclusion row are removed from the line-by-line width sequence, leaving the middle portion as the remaining width sequence. The arithmetic mean of the remaining width sequence is calculated to obtain the mean width of the region, which is then multiplied by the horizontal axis pixel-size conversion factor to convert it into the actual width of the connected component in millimeters.

[0076] For example, if the line-wise width sequence has 256 elements and the number of edge exclusion rows is 14, then after removing the first 14 and the last 14 elements, the remaining width sequence contains 228 elements.

[0077] Step S56: Calculate the number of valid rows in the remaining width sequence, multiply the number of valid rows by the vertical axis pixel-size conversion factor to obtain the actual length of the connected component; if the actual length of the connected component exceeds the piston ring wall thickness, remove the connected component from the candidate defect mask.

[0078] In one embodiment, the number of valid rows in the remaining width sequence is equal to the number of elements in the sequence. Multiplying this by the vertical axis pixel-size conversion factor yields the actual radial extension length of the connected region. The piston ring wall thickness is obtained by subtracting the inner diameter from the outer diameter and dividing by 2. Any connected region with a radial actual length exceeding the wall thickness is geometrically unlikely to be a through crack and is removed from the candidate defect mask.

[0079] For example, if the outer diameter is 60mm and the inner diameter is 54mm, then the wall thickness is 3mm. If the actual length of the connected region exceeds 3mm, it will be removed.

[0080] Furthermore, step S5 also includes the following steps: Step S57: Calculate the ratio of the standard deviation to the mean of the remaining width sequence to obtain the width variation coefficient; count the width variation coefficients of all labeled crack-class connected components in the training sample set, and take the minimum value as the width variation coefficient determination threshold. In one embodiment, the width variation coefficient is the ratio of the standard deviation to the mean of the remaining width sequence, reflecting the uniformity of the width of the connected region along the radial direction. Opening gaps are formed by parallel cut surfaces, and their widths are highly uniform along the radial direction, with a variation coefficient approaching zero. Cracks are formed by a fracture process, with the crack tip being narrower than the middle, and the variation coefficient has a positive lower bound determined by the material and geometry. The width variation coefficient determination threshold is obtained statistically from the labeled crack-class connected regions in the training sample set. The minimum value of the width variation coefficient of all crack samples is taken, representing the lower bound of the variation coefficient corresponding to the most uniform crack morphology.

[0081] It should be noted that this threshold may be updated as the training sample set expands. When the width variation coefficient of a newly added crack sample is lower than the current threshold, the threshold should be updated to the new minimum value.

[0082] Step S58: When the actual width of the connected component falls within the end gap tolerance range and the width variation coefficient is not lower than the width variation coefficient judgment threshold, the defect confidence level of the connected component is confirmed; otherwise, the original output confidence of the target image segmentation network is retained as the defect confidence level. In one embodiment, for each connected component verified by radial length, its actual width is simultaneously checked to see if it falls within the end-gap tolerance range, and its width coefficient of variation is not lower than a judgment threshold. When both conditions are met, the connected component is assigned a high-confidence defect level. This is based on the fact that a connected component whose actual width falls within the end-gap tolerance range and has ruled out the possibility of an open gap is physically uniquely associated with a through-crack; and a width coefficient of variation not lower than the threshold further confirms its non-uniform fracture morphology. If either condition is not met, the original output confidence level of the target image segmentation network is retained as the defect confidence level of the connected component, and its reliability is determined by the network's own judgment.

[0083] Step S59: Summarize all connected components according to their defect confidence level and output the final defect detection results.

[0084] In one embodiment, all remaining connected components in the candidate defect mask are sorted according to their defect confidence level. Connected components with high confidence levels are distinguished by a prominent mark in the output result. The original confidence connected components are sorted and output according to their confidence values. The final defect detection result includes the pixel-level position, defect category, actual width, actual length and defect confidence level of each connected component, which can be used for subsequent quality inspection judgment or production line alarm.

[0085] like Figure 3 As shown, the horizontal axis represents the actual width of the connected region, and the vertical axis represents the width variation coefficient. Two vertical dashed lines mark the lower and upper limits of the end-gap tolerance, respectively, and a horizontal dashed line marks the threshold for determining the width variation coefficient. These three dashed lines... Figure 3 It is divided into three categories of judgment areas.

[0086] The light green areas within the tolerance range and below the threshold correspond to open gaps, whose width falls within the tolerance range and whose coefficient of variation is close to zero; these have been excluded as structural features. The light orange areas within the tolerance range and above the threshold correspond to through cracks, whose width falls within the tolerance range and whose coefficient of variation is not lower than the judgment threshold; these are assigned a high-confidence defect level. The light gray areas outside the tolerance range correspond to other defects, preserving the original output confidence of the target image segmentation network. Therefore, the gap tolerance range is used bidirectionally, serving as both a basis for false positive exclusion and a basis for improving the confidence of true positives.

[0087] refer to Figure 4 The present invention also provides a piston ring defect detection system 100 based on image segmentation, for performing the piston ring defect detection method based on image segmentation as described above, wherein the piston ring defect detection system 100 based on image segmentation includes: The toroidal unfolding module 101 is used to perform polar coordinate unfolding on the top view image of the piston ring to obtain a rectangular unfolded image with the circumferential angle as the horizontal axis and the radius direction as the vertical axis. The gap reference positioning module 102 is used to calculate the grayscale mean value column by column along the horizontal axis of the rectangular unfolded diagram to obtain the grayscale mean value curve; according to the design parameters corresponding to the piston ring model, it locates the local minimum value interval corresponding to the opening gap in the grayscale mean value curve; the center column of the local minimum value interval is recorded as the angle zero point, and the horizontal coordinate range is recorded as the opening reference interval; Angle normalization module 103 is used to roll and translate the rectangular unfolded diagram along the horizontal axis with the angle zero point as the reference, and align the angle zero point to the same horizontal position of the rectangular unfolded diagram to obtain the angle normalized unfolded diagram. The defect segmentation module 104 is used to input the angle-normalized unfolded image into a preset image segmentation network and output a pixel-level defect segmentation mask. The geometric verification output module 105 is used to mark the segmented regions that fall into the open reference interval in the defect segmentation mask as structural features and exclude them, and to perform geometric verification on the connected regions outside the open reference interval in combination with the design parameters corresponding to the piston ring model, generate the defect confidence level, and output the final defect detection result.

[0088] 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.

[0089] 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 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 piston ring defect detection method based on image segmentation, characterized in that, Includes the following steps: Step S1: Perform polar coordinate expansion on the top view image of the piston ring to obtain a rectangular expansion diagram with the circumferential angle as the horizontal axis and the radius direction as the vertical axis; Step S2: Calculate the grayscale mean value column by column along the horizontal axis of the rectangular unfolded diagram to obtain the grayscale mean value curve; locate the local minimum value interval corresponding to the opening gap in the grayscale mean value curve according to the design parameters corresponding to the piston ring model; record the center column of the local minimum value interval as the angle zero point, and the horizontal coordinate range as the opening reference interval; Step S3: Using the zero point of angle as a reference, roll and translate the rectangular unfolded diagram along the horizontal axis, aligning the zero point of angle to the same horizontal position of the rectangular unfolded diagram, to obtain the angle-normalized unfolded diagram; Step S4: Input the angle-normalized unfolded image into the preset image segmentation network and output a pixel-level defect segmentation mask; Step S5: Mark the segmented regions in the defect segmentation mask that fall into the open reference interval as structural features and exclude them. Perform geometric verification on the connected regions outside the open reference interval in combination with the design parameters corresponding to the piston ring model, generate the defect confidence level, and output the final defect detection result.

2. The piston ring defect detection method based on image segmentation according to claim 1, characterized in that, Step S1 includes the following steps: Using the geometric center of the piston ring top view image as the origin, a polar coordinate sampling grid is established by dividing the circumferential angle direction into equal parts from 0° to 360° and the radius direction into equal parts from the inner diameter to the outer diameter. The circumferential stretching coefficient of the sampling point is obtained by calculating the ratio of the radius value at each sampling point in the polar coordinate sampling grid to the radius value of the innermost sampling point. The bilinear interpolation sampling range of each sampling point is expanded proportionally along the circumferential direction by the circumferential stretching coefficient. The interpolation window of each sampling point covers the same actual arc length in the circumferential direction, thus obtaining the compensated polar coordinate sampling grid. Bilinear interpolation sampling is performed on the top view image of the piston ring based on the compensated polar coordinate sampling grid. The sampling results are arranged by angle as columns and radius as rows to obtain a rectangular unfolded image.

3. The piston ring defect detection method based on image segmentation according to claim 2, characterized in that, Step S2 includes the following steps: Step S21: Obtain the outer diameter, inner diameter and end clearance tolerance range corresponding to the piston ring model as design parameters, and calculate the horizontal axis pixel-size conversion factor by the ratio of the outer diameter circumference to the total number of pixels on the horizontal axis of the rectangular unfolded diagram. Step S22: Calculate the grayscale mean of all pixels in the corresponding column along the horizontal axis of the rectangular unfolded image to obtain a grayscale mean curve with the column coordinates as the horizontal axis and the grayscale mean as the vertical axis. Step S23: Extract all continuous concave segments below the global mean of the grayscale mean curve, and multiply the pixel width of each concave segment by the horizontal axis pixel-size conversion factor to obtain the actual width of the continuous concave segment.

4. The piston ring defect detection method based on image segmentation according to claim 3, characterized in that, Step S2 also includes the following steps: Step S24: Select concave sections whose actual width falls within the end gap tolerance range as candidate intervals; Step S25: When there is more than one candidate interval, perform edge slope symmetry verification on each candidate interval to confirm the local minimum interval; when there is only one candidate interval, confirm the candidate interval as the local minimum interval. Step S26: Record the center column of the local minimum value interval as the angle zero point, and record the coordinates of the starting column to the ending column of the local minimum value interval as the open reference interval.

5. The piston ring defect detection method based on image segmentation according to claim 4, characterized in that, The edge slope symmetry verification includes: Extract the column mean sequence within the range of the predefined extension column number extending to the left and right of the left boundary of each candidate interval, and calculate the first difference mean of the left column mean sequence as the left slope and the first difference mean of the right column mean sequence as the right slope. When the left slope of a candidate interval is positive and the right slope is negative, and the difference between the absolute values ​​of the left slope and the right slope does not exceed a preset proportion of the larger absolute value, the candidate interval is determined to pass the symmetric edge feature verification. When only one candidate interval passes the verification, the candidate interval is confirmed as a local minimum interval; when multiple candidate intervals pass or fail the verification, the interval with the lowest gray value is taken as the local minimum interval.

6. The piston ring defect detection method based on image segmentation according to claim 5, characterized in that, Step S4 includes the following steps: Step S41: Pixel-level annotation is performed on the angle normalized unfolded images of qualified and defective piston rings of the same model to obtain the annotation mask, which forms the training sample set; Step S42: Perform random cyclic shifting on each angle-normalized unfolded image and corresponding labeled mask in the training sample set along the horizontal axis. The shift amount is randomly selected within the range of the total number of pixels on the horizontal axis of the rectangular unfolded image minus the width of the opening reference interval from the end column coordinate of the opening reference interval. Step S43: Merge the shifted angle normalized unfolded map and the synchronously shifted labeled mask as new training samples into the training sample set to obtain the expanded training sample set; Step S44: Select an image segmentation network based on the encoding / decoding structure, with an input size consistent with the size of the rectangular unfolded image, and an output channel number consistent with the number of defect categories as the network to be trained; Step S45: Train the network to be trained with an expanded training sample set until convergence, and store the converged network weight parameters to obtain the target image segmentation network. Step S46: Input the normalized unfolded image of the current piston ring angle into the target image segmentation network, and output a pixel-level defect segmentation mask.

7. The piston ring defect detection method based on image segmentation according to claim 6, characterized in that, Step S5 includes the following steps: Step S51: Mark all connected components in the defect segmentation mask that fall within the horizontal coordinate range of the opening reference interval as structural features and exclude them to obtain the candidate defect mask; Step S52: Divide the difference between the inner and outer diameters by the total number of pixels on the vertical axis of the rectangular unfolded diagram to obtain the vertical axis pixel-size conversion factor; Step S53: Obtain the geometric distortion coefficient based on the ratio of the circumferential stretching coefficient of the outermost sampling point to the circumferential stretching coefficient of the innermost sampling point in the compensated polar coordinate sampling grid; subtract 1 from the geometric distortion coefficient and multiply it by 0.5 times the total number of pixels on the vertical axis of the rectangular unfolded image to obtain the number of edge exclusion rows.

8. The piston ring defect detection method based on image segmentation according to claim 7, characterized in that, Step S5 also includes the following steps: Step S54: Measure the horizontal pixel width of each connected component in the candidate defect mask row by row along the vertical axis to obtain the row-by-row width sequence of the connected component; Step S55: Remove the measured values ​​within the exclusion row range of each edge near the inner diameter edge and the outer diameter edge in the line-by-line width sequence to obtain the remaining width sequence; calculate the mean of the remaining width sequence as the mean width of the region, and multiply the mean width of the region by the horizontal axis pixel-size conversion factor to convert it into the actual width of the connected component; Step S56: Calculate the number of valid rows in the remaining width sequence, multiply the number of valid rows by the vertical axis pixel-size conversion factor to obtain the actual length of the connected component; if the actual length of the connected component exceeds the piston ring wall thickness, remove the connected component from the candidate defect mask.

9. The piston ring defect detection method based on image segmentation according to claim 8, characterized in that, Step S5 also includes the following steps: Step S57: Calculate the ratio of the standard deviation to the mean of the remaining width sequence to obtain the width variation coefficient; count the width variation coefficients of all labeled crack-class connected components in the training sample set, and take the minimum value as the width variation coefficient determination threshold. Step S58: When the actual width of the connected component falls within the end gap tolerance range and the width variation coefficient is not lower than the width variation coefficient judgment threshold, the defect confidence level of the connected component is confirmed; otherwise, the original output confidence of the target image segmentation network is retained as the defect confidence level. Step S59: Summarize all connected components according to their defect confidence level and output the final defect detection results.

10. A piston ring defect detection system based on image segmentation, characterized in that, For performing the image segmentation-based piston ring defect detection method as described in claim 1, the image segmentation-based piston ring defect detection system comprises: The toroidal unfolding module is used to unfold the top view image of the piston ring in polar coordinates to obtain a rectangular unfolded image with the circumferential angle as the horizontal axis and the radius direction as the vertical axis. The gap reference positioning module is used to calculate the grayscale mean value column by column along the horizontal axis of the rectangular unfolded diagram to obtain the grayscale mean value curve; according to the design parameters corresponding to the piston ring model, it locates the local minimum value interval corresponding to the opening gap in the grayscale mean value curve; the center column of the local minimum value interval is recorded as the angle zero point, and the horizontal coordinate range is recorded as the opening reference interval; The angle normalization module is used to roll and translate the rectangular unfolded diagram along the horizontal axis with the angle zero point as the reference, aligning the angle zero point to the same horizontal position of the rectangular unfolded diagram to obtain the angle normalized unfolded diagram. The defect segmentation module is used to input the angle-normalized unfolded image into a preset image segmentation network and output a pixel-level defect segmentation mask. The geometric verification output module is used to mark the segmented regions that fall into the open reference interval in the defect segmentation mask as structural features and exclude them. It also performs geometric verification on the connected regions outside the open reference interval in combination with the design parameters corresponding to the piston ring model, generates the defect confidence level, and outputs the final defect detection result.