Metal strip surface defect automatic identification and cutting method based on edge detection
By adopting an automatic recognition and cropping method based on edge detection in metal strip surface defect detection, combined with parameter list, edge detection, clustering, boundary condition judgment and defect level judgment modules, the problems of large input image size, sparse effective information and adaptability of different scenarios are solved, efficient and accurate defect detection and cropping are achieved, and standardized defect level output is provided.
Patent Information
- Application Number
- CN202411929663.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In the detection of surface defects of metal strips, the input image size is large and the effective information is sparse, which can easily lead to missed inspection or missed inspection. The defect types and background noise in different industrial scenarios vary greatly, and a single fixed parameter is difficult to adapt to all detection requirements.
The automatic identification and cutting method of surface defects of metal strips based on edge detection is adopted. By setting parameter list, edge detection module, clustering module, boundary condition judgment module and defect level judgment module, the defect ROI is quickly positioned, irrelevant information is filtered, the crop ROI coordinates are dynamically calculated, and the defect level judgment is carried out.
It realizes rapid positioning of defect areas, reduces calculation requirements, improves real-time and accuracy of detection, adapts to the detection needs of different industrial scenarios, reduces the possibility of false detection and missed detection, and provides standardized defect level output.
Smart Images

Figure CN119863440A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an automatic recognition and cutting method for metal strip surface defects based on edge detection, and belongs to the field of computer vision. Background Art
[0002] Metal strips have been widely used in important fields such as aerospace, automobile manufacturing, electronics industry, and construction. Their surface quality will significantly affect the comprehensive performance of products. Therefore, surface defect detection in its production process is a key link that cannot be ignored, and the simultaneous collection of surface defect visual data is convenient for later analysis of the causes of defects, so as to improve the production process and improve production quality. However, in the defect detection task, the input image contains a lot of irrelevant information (such as background noise or normal areas), which can easily interfere with the final detection results, resulting in false detection or missed detection. Directly processing the entire image is not only computationally intensive, but also sparse in effective information, making it difficult to accurately identify defect areas. Therefore, it is of great research significance and practical application value to develop a metal strip surface defect detection and cropping software that can quickly locate the defect region of interest (ROI), filter irrelevant information, and concentrate resources on key areas for detection.
[0003] However, in the diverse industrial defect detection task scenarios, the defect type, shape, size, distribution density and background noise in different scenarios vary significantly. If a single fixed parameter is used, it is difficult for the system to adapt to all detection requirements, resulting in false detection or missed detection in the detection results. Therefore, in order to solve the problems of false detection, missed detection and unreasonable cutting caused by "insufficient adaptability of fixed parameters". By flexibly configuring the key parameters of edge detection, clustering, boundary conditions and defect level judgment modules, the system can be provided with stronger adjustability and adaptability. Users can optimize parameters according to actual application scenarios and defect data, improve the generalization ability of the algorithm, the maintainability and practicality of the system, so that the detection tasks can maintain high accuracy and high robustness in different environments.
[0004] Defect detection methods based on deep learning rely heavily on high-performance hardware, while the Canny edge detection method does not require a complex training process and has low requirements for computing resources. It is suitable for running on low-performance devices and is suitable for real-time industrial detection scenarios. The edge detection module can quickly identify defect edges in the image and generate defect contours. In addition, the edge detection results can often provide clear defect area contours, providing basic data support for subsequent clustering, boundary cutting and other steps. However, edge detection is easily affected by noise interference, resulting in false detection or missed detection. By reasonably adjusting the input image parameter information and parameterizing the parameter threshold of edge detection, noise interference can be effectively controlled, further improving the robustness and accuracy of detection, and providing reliable basic data for subsequent steps.
[0005] In the edge detection stage, complex defects are often divided into multiple areas, resulting in the fragmentation of a single defect, affecting the integrity of the detection results. By using a clustering algorithm to aggregate scattered defects, it can ensure that fragmented breakpoint defects are identified as a whole, generating a complete and continuous defect area. Improve the rationality of defect ROI and avoid cutting irrelevant background or missing defect information. Optimizing the integrity of the detection results through a clustering algorithm can provide high-quality input for subsequent cutting boundary calculations and defect level judgments. This method solves the pain points of fragmented detection and can provide high-quality data support for subsequent defect ROI cutting and analysis.
[0006] In the process of defect ROI cutting, unreasonable boundary setting will lead to interference of irrelevant information or loss of defect information. By setting boundary conditions reasonably, the cutting boundary can be iteratively optimized to ensure the accuracy of defect ROI. The core of boundary condition judgment is to iteratively optimize the ROI area to be cut to ensure the rationality and accuracy of the cutting boundary. In industrial inspection, the setting of the cutting boundary directly affects the defect recognition result: a boundary that is too large may introduce noise background, and a boundary that is too small may truncate the key defect area. By parameterizing the control of the cutting shape, blank area and minimum cutting area, the problem of unreasonable cutting can be solved, thereby generating high-quality defect ROI.
[0007] In industrial defect detection, it is necessary not only to detect the location of the defect, but also to evaluate the severity of the defect. Simple defect detection is difficult to meet actual needs. Defect level assessment is an important part of quality control. Simply detecting the defect area cannot quantify the defect level, which affects practical application. By building a defect level judgment module, the defects in the cut ROI area are calculated, and the level is classified according to the set threshold. The defect ROI level can be quantified and output, solving the problem of unclear defect assessment and providing standardized results for actual quality inspection and decision-making. Summary of the invention
[0008] Aiming at the problem that the input image size of defect detection task is large, the effective information is sparse, and it is easy to interfere with the detection result and cause false detection or missed detection. The present invention provides a method for automatic recognition and cutting of metal strip surface defects based on edge detection. By setting a parameter list, an edge detection module, a clustering module, a boundary condition judgment module, and a defect level judgment module, a defect recognition and cutting model is constructed, defect ROI is quickly located, irrelevant information is effectively filtered, resources are concentrated on key areas for detection, the cutting ROI coordinates are dynamically calculated, and the coordinates are mapped back to the original image to perform ROI cutting on the original image, so as to realize automatic recognition and cutting of metal strip surface defects.
[0009] The technical solution of the present invention is: a method for automatically identifying and cutting metal strip surface defects based on edge detection, characterized in that it includes the following steps:
[0010] S1. Set parameter list: specify in advance the parameter information that the method needs to use during operation.
[0011] S2. Construct edge detection module: Use Gaussian blur and contrast enhancement method to enhance the features of input image, and use Canny operator to detect the edge of the enhanced features. The upper and lower thresholds of Canny operator are automatically calculated according to the pixel value of the image. The lower threshold T can be automatically calculated by calculating the pixel value mean μ and pixel value standard deviation σ of the input image data. low and high threshold T high , and its calculation formula can be expressed as:
[0012] T low =max(0,μ-σ)
[0013] T high =min(255,μ+σ).
[0014] S3, constructing a clustering module: using a distance clustering method and clustering all defects detected in a single frame image based on the defect centroid position, the clustering threshold is set according to the value in the parameter list set in step S1.
[0015] S4, constructing a boundary condition judgment module: the defects in the same cluster after clustering by the clustering module in step S3 are regarded as the same defect, and the minimum bounding box is calculated, and the vertex / bottom pixel coordinates and center point coordinates of the box are regarded as the vertex / bottom pixel coordinates and center point coordinates of the defect. Based on the calculated vertex / bottom pixel coordinates and the threshold value in the parameter list set in step S1, the coordinates of the proposed cutting boundary are iteratively calculated.
[0016] S5. Construct a defect level judgment module: treat all defects within the proposed cutting boundary coordinates as single defects and perform level judgment, accumulate the pixel areas of all defects within the proposed cutting boundary coordinates and judge them with the defect level threshold in the parameter list set in step S1, and output the defect level and coordinates based on the judgment result.
[0017] Furthermore, the metal strip in step S1 includes but is not limited to stainless steel, titanium alloy, aluminum alloy and other materials.
[0018] Furthermore, the step S2 will automatically calculate the vertex / bottom pixel coordinates of the defect feature after segmentation, and calculate the current defect centroid coordinates based on the obtained defect edge coordinates.
[0019] Furthermore, if the defect detected in step S2 has an unclosed edge, the unclosed area will be automatically completed and the defect coordinate information and centroid position will be recalculated.
[0020] Furthermore, the iterative calculation of the coordinates of the proposed cropping boundary described in step S4 includes: when the cropping area blank threshold is specified in the parameter list in step S1, a blank pixel threshold is added around the cropping area; when the cropping area is specified as a square in the parameter list in step S1, the pixel distance of the long side of the cropping area is automatically calculated, and this is used as the side length of the square, and the short side is compensated to the distance; when the minimum cropping pixel threshold is specified in the parameter list in step S1, each side length of the cropping area is automatically calculated to see whether it meets the minimum cropping pixel threshold. If not, the unsatisfied side is automatically compensated to the threshold.
[0021] In general, compared with the existing technical solutions, the present invention adopts a new idea and method, which can achieve the following beneficial effects:
[0022] 1. Aiming at the difficult problems in defect detection tasks, such as large input image size, sparse effective information, and easy interference with detection results leading to false detection or missed detection, the present invention proposes a method for automatic recognition and cutting of metal strip surface defects based on edge detection. By performing defect ROI recognition and cutting on the input image data, the input image resolution is reduced, which can further reduce the computing requirements, improve the real-time detection, and alleviate the problem of missed detection or false detection that is prone to occur in traditional methods.
[0023] 2. The present invention divides the defect recognition and cutting process into five stages: setting parameter list, edge detection module, clustering module, boundary condition judgment module, and defect level judgment module. By processing the input image and extracting key ROI features, defects in the image can be identified and cut more efficiently.
[0024] 3. The edge detection module proposed in the present invention can enhance low-quality images and automatically extract feature edges, and automatically calculate the threshold required for the Canny operator based on the image pixel information, saving parameter adjustment time. The present invention alleviates the fragmentation problem of single defects caused by limited detection accuracy through a clustering module. By adopting a clustering module to aggregate scattered defects, it ensures that fragmented breakpoint defects can be identified as a whole, generating a complete and continuous defect area. Improve the rationality of defect ROI and avoid cutting irrelevant background or missing defect information. The present invention iteratively optimizes the cutting boundary by parameterized control of the cutting shape, blank area and minimum cutting area, ensures the accuracy of the defect ROI, solves the pain point of unreasonable cutting, and can generate a higher quality defect ROI. The present invention dynamically calculates the pixel area of all defects in the proposed cutting ROI through a defect level judgment module, and classifies the level according to the set threshold, which can achieve quantitative defect level output, solve the problem of unclear defect assessment, and provide standardized results for actual quality detection and decision-making. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings constituting a part of this application are used to enhance further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations of the present invention. In the drawings:
[0026] Figure 1 A flow chart of a method for automatically identifying and cutting metal strip surface defects based on edge detection proposed by the present invention;
[0027] Figure 2 It is the structure diagram of edge detection module;
[0028] Figure 3 It is the structure diagram of clustering module;
[0029] Figure 4 This is the structural diagram of the boundary condition judgment module;
[0030] Figure 5 This is the structure diagram of the defect level judgment module;
[0031] Figure 6 Schematic diagram of processing the surface defects of titanium metal strip in Example 1 (the white frame line demonstrates the cutting position);
[0032] Figure 7 Schematic diagram of processing surface defects of titanium metal strip in Example 2 (white frame line demonstrates cutting position); DETAILED DESCRIPTION
[0033] The invention is further described below in conjunction with the accompanying drawings and embodiments, but the content of the invention is not limited to the scope of the embodiments.
[0034] like Figure 1 As shown, a method for automatic recognition and cutting of metal strip surface defects based on edge detection is characterized in that: based on the set parameter list, edge detection module, clustering module, boundary condition judgment module, and defect level judgment module, the cutting ROI coordinates are calculated, and the coordinates are mapped back to the original image to perform ROI cutting on the original image, so as to further realize automatic recognition and cutting of metal strip surface defects.
[0035] The parameter setting list includes: setting the corresponding parameters required during the operation of the method in advance, and the parameter list and types required to be set are shown in Table 1.
[0036] Table 1 Parameter list
[0037]
[0038] Figure 2 This is the flow chart for edge detection module execution. The input image is enhanced using Gaussian blur and contrast enhancement methods, and the Canny operator is used to perform edge detection on the enhanced features. The high and low thresholds of the Canny operator are automatically calculated based on the pixel values of the image. The calculation formula can be expressed as:
[0039] T low =max(0,μ-σ)
[0040] T high =min(255,μ+σ).
[0041] Among them, T low , T high Represent the low threshold and high threshold respectively, μ represents the pixel mean of the input image, and σ represents the pixel standard deviation of the input image, which are defined as follows:
[0042]
[0043] Among them, x i is the pixel value and N is the total number of pixels in the image.
[0044] The coordinates of the current defect centroid are calculated based on the defect edge coordinates detected by the Canny operator. If the detected defect has an unclosed edge, the unclosed area will be automatically filled and the defect coordinate information and centroid position will be recalculated.
[0045] Figure 3 This is the flow chart for clustering module execution. All defects in a single frame image are clustered based on the defect centroid position using the distance clustering method. The threshold of the clustering algorithm is specified by the "Distance Clustering Threshold" parameter in the parameter list. When multiple defects are clustered into the same cluster, the algorithm treats them as the same defect and updates the pixel coordinates corresponding to the defect.
[0046] Figure 4 This is the execution flow chart of the boundary condition judgment module. In this stage, the defects in the same cluster after clustering by the clustering module are regarded as the same defect, and their minimum bounding box is calculated. The vertex / bottom pixel coordinates and center point coordinates of the box are regarded as the vertex / bottom pixel coordinates and center point coordinates of the defect. Based on the calculated vertex / bottom pixel coordinates and the threshold set in the parameter list, the boundary coordinates of the proposed cropped ROI are iteratively calculated.
[0047] The iterative calculation of the proposed cropping boundary coordinates includes: when the cropping area blanking threshold is specified in the parameter list, adding a blank pixel threshold around the cropping area. The specific execution process can be expressed as: when the cropping area blanking is specified as d, the actual cropping area coordinates can be expressed as: x min =x min -d,x max =x max +d,y min =y min -d,y max =y max +d.
[0048] When the cropping area is specified as a square in the parameter list, the pixel distance of the long side of the cropping area is automatically calculated and used as the side length of the square, and the short side is compensated to this distance. The specific execution process can be expressed as follows: When the cropping ROI is specified as a square in the parameter list, it will find max{(x max -x min ),(y max -y min )} as the side length of the cutting defect ROI, and compensate the other side to this side length. Assuming that the y-axis direction is the long side, recalculate the x {min,max} , and its calculation formula can be expressed as:
[0049]
[0050] Center x is the x-coordinate of the defect centroid.
[0051] When the minimum crop pixel threshold is specified in the parameter list, the length of each side of the crop area is automatically calculated to see if it meets the minimum crop pixel threshold. If not, the unsatisfied side is automatically compensated to the threshold size. The specific execution process can be expressed as follows: When the "minimum crop image size" is specified in the parameter list, if the distance between one or both sides of the area to be cropped is less than the set threshold, the proposed cropping coordinates of the part less than the threshold are recalculated. Assuming that the image meets the threshold in the y-axis direction and does not meet the threshold in the x-axis direction, the x-axis coordinates are recalculated, and the calculation formula can be expressed as follows:
[0052]
[0053] Center x is the x coordinate of the defect centroid, d thre Specifies the minimum crop image size threshold.
[0054] Figure 5 This is the flow chart for executing the defect level judgment module. In this stage, all defects within the coordinates of the boundary to be cut will be regarded as single defects and the level will be judged. The pixel areas of all defects within the coordinates of the boundary to be cut will be accumulated and judged with the defect level threshold specified in the parameter list. The defect level and coordinates will be output based on the judgment result. The specific process can be expressed as follows: After obtaining the coordinates of the defect ROI to be cut, traverse all defects within the coordinates, and sum up all defect areas. The sum result is compared with the initially set defect area grading threshold to determine the defect level within the ROI. At the same time, the pixel coordinates of the center point of the ROI area are calculated, which are the absolute position coordinates of the current defect ROI in the original image. Assuming that the defect area grading threshold specified in the parameter list is set to [300,100], the defect level classification setting is as follows,
[0055]
[0056] Embodiment 1:
[0057] See also Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 6 The present invention proposes a method for automatically identifying and cutting metal strip surface defects based on edge detection, comprising the following steps:
[0058] S1. Set parameter list: In this embodiment, the image resolution is 257×257, the cluster distance threshold is set to 10, the cropping edge margin is set to 0, the minimum cropping image size is set to 0, whether to crop to a square is set to False, and the defect level judgment threshold is set to [300,100].
[0059] S2. Construct edge detection module: Use Gaussian blur and contrast enhancement methods to enhance the features of the input image, and use the Canny operator to detect the edges of the enhanced features. The upper and lower thresholds of the Canny operator are automatically calculated based on the pixel values of the image. The coordinates of the center of mass of the current defect are calculated based on the edge coordinates of the defect detected by the Canny operator. If the edges of the detected defect are not closed, the unclosed area will be automatically filled and the defect coordinate information and center of mass position will be recalculated.
[0060] S3. Construct a clustering module: cluster all defects detected in a single frame image using a distance clustering method based on the defect centroid position, and the clustering threshold is 10 set in step S1.
[0061] S4, constructing a boundary condition judgment module: iteratively calculating the proposed cutting boundary coordinates of the defects clustered by the clustering module in step S3.
[0062] S5. Construct a defect level judgment module: treat all defects within the proposed cutting boundary coordinates as single defects and perform level judgment, accumulate the pixel areas of all defects within the proposed cutting boundary coordinates and judge them with [300,100] set in step S1, and output the defect level and the coordinates of the cutting ROI center point based on the judgment results.
[0063] Figure 6 The results of Example 1 when processing the surface defect image of titanium metal strip are shown, where the first line is the input original image data with a resolution of 257×257, and the second line is the defect recognition effect of the corresponding image after being processed by Example 1 and the proposed cropped defect ROI area after iteration according to the initial set parameters (replaced with a white frame line, and the frame line coordinates are mapped back to the original image as the cropping coordinates).
[0064] Embodiment 2:
[0065] See also Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 7 The present invention proposes a method for automatically identifying and cutting metal strip surface defects based on edge detection.
[0066] S1. Set parameter list: In this embodiment, the image resolution is 257×257, the cluster distance threshold is set to 10, the cropping edge margin is set to 10, the minimum cropping image size is set to 20, whether to crop to a square is set to True, and the defect level judgment threshold is set to [300,100].
[0067] S2. Construct edge detection module: Use Gaussian blur and contrast enhancement methods to enhance the features of the input image, and use the Canny operator to detect the edges of the enhanced features. The upper and lower thresholds of the Canny operator are automatically calculated based on the pixel values of the image. The coordinates of the center of mass of the current defect are calculated based on the edge coordinates of the defect detected by the Canny operator. If the edges of the detected defect are not closed, the unclosed area will be automatically filled and the defect coordinate information and center of mass position will be recalculated.
[0068] S3. Construct a clustering module: cluster all defects detected in a single frame image using a distance clustering method based on the defect centroid position, and the clustering threshold is 10 set in step S1.
[0069] S4, constructing a boundary condition judgment module: iteratively calculating the proposed cutting boundary coordinates of the defects clustered by the clustering module in step S3.
[0070] S5. Construct a defect level judgment module: treat all defects within the proposed cutting boundary coordinates as single defects and perform level judgment, accumulate the pixel areas of all defects within the proposed cutting boundary coordinates and judge them with [300,100] set in step S1, and output the defect level and the coordinates of the cutting ROI center point based on the judgment results.
[0071] Figure 7 The results of Example 2 when processing the surface defect image of titanium metal strip are shown, where the first line is the input original image data with a resolution of 257×257, and the second line is the defect recognition effect of the corresponding image after processing by Example 2 and the proposed cropped defect ROI area after iteration according to the initial set parameters (replaced with a white frame line, and the frame line coordinates are mapped back to the original image as the cropping coordinates).
[0072] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.
Claims
1. A method for automatically identifying and cutting metal strip surface defects based on edge detection, characterized in that: The following steps are involved: S1. Set parameter list: specify in advance the parameter information that the method needs to use during operation. S2. Construct edge detection module: Use Gaussian blur and contrast enhancement method to enhance the features of input image, and use Canny operator to detect the edge of the enhanced features. The upper and lower thresholds of Canny operator are automatically calculated according to the pixel value of the image. The lower threshold T can be automatically calculated by calculating the pixel mean μ and pixel standard deviation σ of the input image data. low , and high threshold T high , and its calculation formula can be expressed as: T low =max(0,μ-σ) T high =min(255,μ+σ). S3, constructing a clustering module: using a distance clustering method and clustering all defects detected in a single frame image based on the defect centroid position, the clustering threshold is set according to the value in the parameter list set in step S1. S4, constructing a boundary condition judgment module: the defects in the same cluster after clustering by the clustering module in step S3 are regarded as the same defect, and their minimum bounding box is calculated, and the vertex / bottom pixel coordinates and center point coordinates of the box are regarded as the vertex / bottom pixel coordinates and center point coordinates of the defect. Based on the calculated vertex / bottom pixel coordinates and the threshold value in the parameter list set in step S1, the coordinates of the proposed cutting boundary are iteratively calculated. S5. Construct a defect level judgment module: treat all defects within the proposed cutting boundary coordinates as single defects and perform level judgment, accumulate the pixel areas of all defects within the proposed cutting boundary coordinates and judge them with the defect level threshold in the parameter list set in step S1, and output the defect level and coordinates based on the judgment result.
2. The method for automatically identifying and cutting metal strip surface defects based on edge detection according to claim 1, characterized in that: The metal strip includes but is not limited to stainless steel, titanium alloy, aluminum alloy and other materials.
3. The method for metal strip surface defect identification and cutting model construction according to claim 1, characterized in that: The step S2 will automatically calculate the vertex / bottom pixel coordinates of the defect feature after segmentation, and calculate the current defect centroid coordinates based on the obtained defect edge coordinates.
4. The method for metal strip surface defect identification and cutting model construction according to claim 1, characterized in that: In step S2, if the detected defect has an unclosed edge, the unclosed area will be automatically completed and the defect coordinate information and centroid position will be recalculated.
5. The method for metal strip surface defect identification and cutting model construction according to claim 1, characterized in that: The iterative calculation of the proposed cropping boundary coordinates described in step S4 includes: When the cropping area blank threshold is specified in the parameter list in step S1, a blank pixel threshold is added around the cropping area. When the cropping area is specified as a square in the parameter list in step S1, the pixel distance of the long side of the cropping area is automatically calculated and used as the side length of the square, and the short side distance is compensated to this distance. When the minimum cropping pixel threshold is specified in the parameter list in step S1, it is automatically calculated whether the length of each side of the cropping area meets the minimum cropping pixel threshold. If not, the unsatisfactory side is automatically compensated to the threshold.
Citation Information
Patent Citations
Defect detection method for irregular metal machining surface based on depth learning
CN109636772A
Defect detection algorithm based on edge smoothness
CN113570553A
Part surface quality detection method and system based on machine vision
CN118608504A
Machine vision-based detecting method and system for glass bottle bottom defects
WO2022027949A1
Cited By
Automatic positioning and shearing control system and method for lead plate machining
CN120480284A
Visual positioning method for cutting residual roll paper
CN121912444A