A metal surface defect detection and classification method, system, device and medium
Patent Information
- Application Number
- CN202411173839.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2044-08-26
AI Technical Summary
但由于对抗生成网络训练不稳定且难以收敛,并且无监督学习对数据质量极其敏感,从而产生的模型效果不佳和过拟合的问题
1.本发明通过在步骤2中采用灰度归一化和自适应直方图均衡化对步骤1整理的图像样本数据集进行对比度增强处理,使图像对比度和噪声抑制能力显著提升,进一步改善图像的视觉清晰度和细节表现;具有提高图像质量、增强后续处理的准确性以及优化图像特征提取效果的优点。
Smart Images

Figure CN119130952B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial testing technology, specifically relating to a method, system, equipment, and medium for detecting and classifying defects on metal surfaces. Background Technology
[0002] Metal sheets are widely used in industrial production and daily life, but their manufacturing process is complex, involving multiple equipment and processes, which can easily lead to various surface defects. These defects not only weaken the wear resistance and corrosion resistance of the metal sheet, but also affect its electromagnetic properties and aesthetic appearance, thus adversely impacting electromagnetic performance and coating effects. Therefore, surface defect detection is a crucial step for metal sheet manufacturers. It can not only quickly identify and reject defective products, ensuring product quality and maintaining the company's reputation, but also, by analyzing the detection results, promptly identify and correct problems in the production process, promoting the optimization and improvement of the production process.
[0003] In the metal products industry, product quality inspection and control occupy a core position. Among these, metal surface defect detection, as a key link in ensuring product quality and enhancing product competitiveness, has become a significant focus of technological innovation in the metal industry. This detection technology is not only crucial to the metal industry but also widely benefits other industrial sectors, thus receiving significant national attention and being listed as a key technology research project, gaining widespread support and focus. Since the 1970s, machine vision inspection technology has embarked on a comprehensive exploration and research journey, and was successfully applied to production practice in the 1980s. Entering the 1990s, defect detection based on image processing technology experienced rapid development, with numerous innovative achievements. Theoretical research and production practice progressed in tandem, enabling product quality inspection in the production field to enter a relatively mature application stage. Currently, many domestic research institutions regard the research and development of metal surface defect detection technology as a key scientific and technological task, and have achieved significant technological breakthroughs, effectively meeting the domestic metal industry's demand for high-quality inspection technology and significantly improving the overall quality of my country's metal products.
[0004] Patent application CN202011496247.9 discloses a method, system, device, and storage medium for detecting defects on metal surfaces. It generates defect-free images using a generative adversarial network (GAN) and then employs unsupervised learning methods from deep learning, significantly reducing reliance on data and improving detection accuracy, without requiring prior identification of defect types. However, the GAN training is unstable and difficult to converge, and unsupervised learning is extremely sensitive to data quality, resulting in poor model performance and overfitting issues.
[0005] Patent application CN202110614111.1 discloses a metal surface defect detection system based on machine vision. By improving optical detection methods and optimizing image processing algorithms, it achieves high detection accuracy, fast detection speed, high detection stability, good repeatability, and stable output detection results. However, the hardware required for the three systems is relatively expensive, the image resolution cannot be guaranteed, and the algorithms are relatively complex, resulting in problems such as complicated model calculations and high costs. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention aims to provide a method, system, device, and medium for detecting and classifying metal surface defects. It processes images of different defect types using grayscale normalization, adaptive histogram equalization, Gabor filters, maximum entropy algorithms, morphological processing, and a modified local binary mode. The processed images are then used to calculate defect location and size, and a GUI measurement page is designed. This invention achieves significant image processing effects, improving image contrast, enhancing defect boundary recognition, realizing precise image segmentation and detailed structural optimization, accurately extracting image features, and supporting efficient classification training. It offers advantages such as improved image quality, enhanced defect detection accuracy, and optimized feature extraction and analysis.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A method for detecting and classifying defects on metal surfaces includes the following steps: Step 1: Collect images of metal surfaces with different defect types, and organize the images of metal surfaces with different defect types into an image sample dataset; Step 2: Perform contrast enhancement processing on the image sample dataset prepared in Step 1 using grayscale normalization and adaptive histogram equalization to obtain an image set with enhanced contrast and reduced noise; Step 3: Use a Gabor filter to process the image set that has undergone contrast enhancement and noise reduction in Step 2, resulting in an image set with reduced noise and enhanced defect boundaries; Step 4: Use the maximum entropy algorithm to perform threshold segmentation on the image set that has been reduced in noise and enhanced in defect boundaries in Step 3 to obtain the image set with the optimal threshold.
[0008] Step 5: Use the morphological processing function (bwmorph function) built into MATLAB, with the parameter set to "thin", to repeat the operation multiple times on the image set with the best threshold obtained in Step 4, to obtain the image set after thinning. Step 6: Use the improved local binary mode to extract features from the image set after thinning in Step 5, convert the extracted features into feature vectors, and organize them into a matrix; Step 7: Build a support vector machine model and perform classified supervised training on the feature vectors transformed in Step 6 to obtain a trained image set; Step 8: Extract and label the image set trained in Step 7 as rolled-in oxide scale defects, spot defects, and scratch defects, and calculate the location and size of rolled-in oxide scale defects, spot defects, and scratch defects respectively; Step 9: Design a GUI for the image set whose defect locations and sizes were calculated in Step 8.
[0009] The specific method for step 2 is as follows: Step 2.1: Process the image sample dataset prepared in Step 1 using the gray-level normalization formula to ensure that the gray-level values of the image sample dataset are distributed between 0 and 255; the gray-level normalization formula is defined as: (1) In the formula, —The grayscale value of the original image; —The minimum grayscale value of the original image; —The maximum grayscale value of the original image; —The grayscale value of the image after grayscale normalization; Step 2.2: Perform adaptive histogram equalization on the image sample dataset after grayscale normalization in Step 2.1. The specific method is as follows: Step 2.2.1: Set a threshold for the original histogram distribution and cut off the portion (clamping) that is greater than the threshold; Step 2.2.2: Equalize the cut-off portion, and then superimpose the equalized cut-off portion onto the original histogram distribution that is less than the threshold. Step 2.2.3: Equalize the distribution of the superimposed histogram to further enhance contrast and effectively reduce noise.
[0010] The specific method for step 3 is as follows: Step 3.1: Apply a Gabor filter to the image set obtained in Step 2.2 for contrast enhancement and noise reduction; the Gabor filter is defined by a Gaussian kernel function modulated by a sinusoidal plane wave. ) (2) in: It is a rotated coordinate system. It is the direction parameter of the Gabor filter, which determines the filtering direction selection characteristic of the Gabor filter; It is the standard deviation of the Gaussian kernel function, which controls the width of the Gaussian function; It refers to the bandwidth, which affects the filter's bandwidth and frequency characteristics; This is the spatial scaling factor; The filtered image is: (3) (4) in, These are pixel coordinates; g This is the response of the Gabor filter, that is, the output value of the filter at each pixel location; I These are the pixel values of the original image, i.e., the image data that needs to be filtered. Step 3.2: Use different filter parallel line directions ( Gabor filtering is applied to rolled-in oxide scale defects and spot defects; ; Step 3.3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full context.] Filter addition and The summation and subtraction of the filters cancel out the ripple caused by the directional selectivity of Gabor filtering, while filtering out noise and enhancing the defect boundary.
[0011] The specific method for step 4 is as follows: Step 4.1: Set the threshold Increment from 0 to 255 by incrementing by 1 each time, according to the threshold. The image set processed in step 3.3 is divided into background (0) and foreground (1); Step 4.2: For each threshold The optimal threshold is determined through calculation. The specific calculation method is as follows: Step 4.2.1: Calculate the probability distribution of each gray value in the background (0) and foreground (1) in the background and foreground. ; Step 4.2.2: Calculate the background (0) and foreground (1) ; in: The cumulative distribution in the background; Step 4.2.3: Calculate the entropy of the background (0) and foreground (1): (5) Step 4.2.4: Calculate the inter-class entropy of the binary image: (6) Step 4.2.5: Select the threshold that maximizes inter-class entropy. Through continuous iterative traversal Find the optimal threshold.
[0012] The specific method for step 6 is as follows: Step 6.1: Select multiple circular regions with different radii, each with a different number of edge points; using the selected circular region parameters, extract multiple grayscale value sequences from the image set after thinning in step 5; Step 6.2: Perform one-dimensional discrete fast Fourier transform on the multiple sets of different gray value sequences obtained in Step 6.1 to obtain multiple spectrograms; Step 6.3: Following the order of the radius of the circular region, concatenate the feature sequences corresponding to the multiple spectrograms obtained in Step 6.2 to form a complete circular region feature vector; repeat this process for other regions of each image until the feature information of the entire image is obtained; Step 6.4: Utilize the image features obtained in Step 6.3 to obtain an accurate description of the defect area, and calculate the maximum bounding rectangle region of the detected defect location; extract features again from the grayscale image inside the rectangle, and convert these features into a feature vector; Step 6.5: Based on each feature vector in Step 6.4, combine the feature vectors of all images together to form a feature matrix.
[0013] The specific method for step 7 is as follows: Step 7.1: Represent each row of the feature matrix formed in Step 6.5 as a feature vector of a sample, and organize these feature vectors into a training sample set; the training sample set is defined as: (7) in :i Indicates the first i There are n samples, where n represents the sample size. For the first i Feature vectors of the image, It is the first i The tags for the image; Step 7.2: Based on the training sample set prepared in Step 7.1, find an optimal separating hyperplane in the feature space, that is, solve for the optimal w and b, specifically: Step 7.2.1: The hyperplane is defined by the linear equation (6): (8) Step 7.2.2: Define the optimization problem: The objective is set as: minimizing (9) The parameters w and b that maximize the distance from the eigenvector to the hyperplane simultaneously satisfy the following constraints: (10) Step 7.2.3: Introduce Lagrange multipliers and construct the Lagrange function: (11) Step 7.2.4: Solve the Lagrange dual problem using the quadratic programming (QP) algorithm to obtain the optimal Lagrange multipliers. : (12) Step 7.2.5: Solve for the optimal w and b: (13) Step 7.3: Using the solved optimal parameters w and b, establish a linearly separable support vector machine model; then use the support vector machine model to classify and train the feature vectors in step 6.5 to obtain a trained image set.
[0014] The specific method for step 8 is as follows: Step 8.1: Obtain defect classification images: The image set trained in step 7.3 is extracted and labeled as rolled-in oxide scale defects, spot defects, and scratch defects; Step 8.2: Calculation of the location and size of the rolled-in oxide scale defect: Step 8.2.1: Boundary Extraction and Mask Application: For each image that detects rolled-in oxide scale defects, first extract the boundary region of the defect; then, perform a mask operation on the original image for this boundary region; Step 8.2.2: Calculate the grayscale centroid: Use the centroid calculation formula: , (14) in Represents pixels The gray value is used to calculate the gray centroid of the rolled-in oxide scale defect area and take it as the center position of the defect. Step 8.2.2: Record the location and size of the defect: Based on the centroid location and boundary information, record the specific location and size of the rolled-in oxide scale defect; Step 8.3: Calculation of the location and size of spot defects: Step 8.3.1: Spot Area Calculation: For images with detected spot defects, calculate the total pixel area of the spot region. and the total pixel area of the image ; Step 8.3.2: Calculate the spot area ratio: Calculate the ratio of the spot area to the total metal surface area. (15) This ratio is used to assess the severity of spot defects; Step 8.3.3: Record the location and size of the spots: Based on the boundary information of the spot area, record the specific location and area percentage of the spots; Step 8.4: Calculation of the location and size of the scratch defect: Step 8.4.1: Line detection and segmentation: For images with detected scratch defects, the Hough transform algorithm is used for line detection; Step 8.4.2: Line filtering and classification: Calculate the length of each detected line and remove those lines whose length is less than the set threshold; calculate the angle between all detected lines and the y-axis, and classify the lines into vertical lines and horizontal lines based on the angle. Step 8.4.2: Sorting and Accumulating Lines: For vertical lines, sort them by the X coordinate of their midpoint from smallest to largest; for horizontal lines, sort them by the Y coordinate of their midpoint from smallest to largest; by traversing the lines, judge the coordinate difference between adjacent lines, and accumulate the lines that meet the conditions into the same scratch. Step 8.4.4: Calculate the scratch length and record the position: For each scratch, calculate the maximum and minimum values of its endpoint coordinates to determine the scratch length; process the remaining unprocessed straight lines in the same way and record the specific position and length of the scratch; Step 8.5: Generate the calculated image set: Step 8.5.1: Synthesize calculation results: Combine the location and size information of rolled-in oxide scale defects, spot defects and scratch defects obtained in steps 8.2, 8.3 and 8.4 into the corresponding images to generate an image set with defect location and size markers; Step 8.5.2: Save and output: Save the image set containing information on the location and size of defects for further analysis or use.
[0015] A metal surface defect detection and classification system, comprising: Image acquisition module: Acquires images of metal surfaces with different defect types, and organizes these images into an image sample dataset. Image processing module: Automatically processes image sample datasets and performs corresponding feature extraction through grayscale normalization, adaptive histogram equalization, Gabor filter, maximum entropy algorithm, morphological processing and improved local binary mode, and constructs feature vectors for subsequent analysis; Classification supervision module: Builds a support vector machine model and performs classification supervision training on the feature vectors; Defect calculation module: Extracts and labels the trained image set as rolled-in oxide scale defects, spot defects and scratch defects, and calculates the location and size of rolled-in oxide scale defects, spot defects and scratch defects respectively.
[0016] A metal surface defect detection and classification device, comprising: Memory: Used to store computer programs that implement the metal surface defect detection and classification method described above; Processor: Used to implement the metal surface defect detection and classification method as described above when executing the computer program.
[0017] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method for detecting and classifying metal surface defects.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention enhances the contrast of the image sample dataset prepared in step 1 by employing grayscale normalization and adaptive histogram equalization in step 2, thereby significantly improving image contrast and noise suppression capabilities, and further enhancing the visual clarity and detail of the image; it has the advantages of improving image quality, enhancing the accuracy of subsequent processing, and optimizing image feature extraction.
[0019] 2. This invention uses a Gabor filter in step 3 to process the image set that has undergone contrast enhancement and noise reduction in step 2, resulting in significant filtering and noise suppression effects. It can effectively enhance the defect boundaries and texture features in the image; it has the advantages of improving image recognition accuracy, optimizing defect detection effect, and enhancing texture feature description.
[0020] 3. This invention, by applying the maximum entropy algorithm to perform threshold segmentation on the image set in step 4, can efficiently separate image regions, improve image processing accuracy, and optimize image analysis performance; it has the advantages of enhancing image information extraction, increasing processing speed, improving image clarity, and reducing missegmentation rate. 4. By performing morphological processing on the image set with the optimal threshold in step 5, this invention produces a significant image thinning effect, which can effectively extract fine structures and edges; it has the advantages of improving image detail, enhancing image resolution, and optimizing image quality.
[0021] 5. In step 6, this invention uses a modified local binary mode to extract features from the thinned image set, resulting in accurate feature descriptions and comprehensive image feature information. This effectively identifies and describes details and defects in the image, and has the advantages of improving the accuracy of feature extraction, enhancing the ability to identify defective regions, and optimizing the integration and analysis of feature information.
[0022] 6. By employing the support vector machine algorithm in step 7 to perform supervised classification training on the sorted matrix, this invention produces accurate classification results and excellent model performance, effectively distinguishing and identifying different types and features in metal defect images. This method has the advantages of improving classification accuracy, enhancing the model's generalization ability, and optimizing the accuracy and efficiency of defect detection.
[0023] In summary, this invention processes images of different defect types using grayscale normalization, adaptive histogram equalization, Gabor filters, maximum entropy algorithms, morphological processing, and improved local binary patterns. The processed images are then used to calculate defect location and size, and a GUI measurement page is designed. The image processing results are significant, improving image contrast, enhancing defect boundary recognition, achieving precise image segmentation and detailed structural optimization, accurately extracting image features, and supporting efficient classification training. This invention offers advantages such as improved image quality, enhanced defect detection accuracy, and optimized feature extraction and analysis, and can be widely applied in high-precision image analysis fields such as metal defect detection, industrial quality control, and computer vision. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating the implementation steps of the present invention; Figure 2 This is the image after contrast enhancement according to the present invention; Figure 3 This is a comparison image of the original speckle image and the image after Gabor filtering. Figure 4 This is a comparison image of the original image of the oxide scale rolled in according to the present invention and the image after Gabor filtering. Figure 5 This is a comparison chart showing the effects of the present invention after processing with the maximum entropy algorithm, Otsu's method, and Niblack's method; Figure 6 This is an image after morphological refinement processing according to the present invention; Figure 7 This is an image showing the detection results of oxide scale defects in this invention; Figure 8 This is an image of the spot defect detection results of the present invention; Figure 9 This is an image of the scratch defect detection results of the present invention; Figure 10 This is the initial test page for the GUI of this invention; Figure 11 This invention provides a GUI page for testing oxide scale defects. Figure 12 This is the GUI spot defect test page of the present invention; Figure 13This is the GUI scratch defect test page for this invention. Detailed Implementation
[0025] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and embodiments.
[0026] See Figure 1 A method for detecting and classifying defects on metal surfaces, comprising the following steps: Step 1: Acquire images of metal surfaces with different defect types, and organize the metal surface images with different defect types into an image sample dataset; the defect types include rolled-in oxide scale defects, spot defects, and scratch defects; Step 2: Perform contrast enhancement processing on the image sample dataset prepared in Step 1 using grayscale normalization and adaptive histogram equalization to obtain an image set with enhanced contrast and reduced noise; The specific method for step 2 is as follows: Step 2.1: Process the image sample dataset prepared in Step 1 using a gray-level normalization formula to ensure that the gray-level values of the image sample dataset are distributed between 0 and 255. This avoids interference from insufficient image contrast (uneven distribution of image pixel brightness) in subsequent processing. The gray-level normalization formula is defined as follows: (1) In the formula, —The grayscale value of the original image; —The minimum grayscale value of the original image; —The maximum grayscale value of the original image; —The grayscale value of the image after grayscale normalization; Step 2.2: Perform adaptive histogram equalization on the image sample dataset after grayscale normalization in Step 2.1 to further enhance contrast and effectively reduce noise. The specific method is as follows: Step 2.2.1: Set a threshold for the original histogram distribution and cut off the portion (clamping) that is greater than the threshold; Step 2.2.2: Equalize the cut-off portion, and then superimpose the equalized cut-off portion onto the original histogram distribution that is less than the threshold, that is, add a "DC bias" to the histogram. Step 2.2.3: Equalize the distribution of the superimposed histogram to further enhance contrast and effectively reduce noise.
[0027] Step 3: Use a Gabor filter to process the image set that has undergone contrast enhancement and noise reduction in Step 2, resulting in an image set with reduced noise and enhanced defect boundaries; The specific method for step 3 is as follows: Step 3.1: Apply a Gabor filter to the contrast-enhanced and noise-reduced image set obtained in Step 2.2 using a filtering algorithm; the Gabor filter is defined by a Gaussian kernel function modulated by a sinusoidal plane wave. ) (2) in: It is a rotated coordinate system. It is the direction parameter of the Gabor filter, which determines the filtering direction selection characteristic of the Gabor filter, that is, the sharpening and smoothing effect in different directions. It is the standard deviation of the Gaussian kernel function, which controls the width of the Gaussian function; It refers to the bandwidth, which affects the filter's bandwidth and frequency characteristics; This is the spatial scaling factor; Gabor filters can be divided into real and imaginary parts. The real part can be used for smoothing filters, helping to remove noise and smooth the image. The imaginary part can be used for edge detection, highlighting the texture and edge information of the image. The filter convolution kernel can be obtained using the formula defined by the Gabor function. Specifically, by selecting appropriate parameters, Gabor filter convolution kernels with different directions and frequency characteristics can be generated. These convolution kernels are used to filter the image to simultaneously achieve smoothing and edge sharpening.
[0028] The filtered image is: (3) (4) in, These are pixel coordinates; g This is the response of the Gabor filter, that is, the output value of the filter at each pixel location; I These are the pixel values of the original image, i.e., the image data that needs to be filtered. Step 3.2: Use different filter parallel line directions ( Gabor filtering is applied to rolled-in oxide scale defects and spot defects; ; Step 3.3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full context.] Filter addition and The summation and subtraction of the filters cancel out the ripple caused by the directional selectivity of Gabor filtering, while filtering out noise and enhancing the defect boundary.
[0029] Step 4: Use the maximum entropy algorithm to perform threshold segmentation on the image set that has been reduced in noise and enhanced in defect boundaries in Step 3 to obtain the image set with the optimal threshold.
[0030] The specific method for step 4 is as follows: Step 4.1: Set the threshold Increment from 0 to 255 by incrementing by 1 each time, according to the threshold. The image set processed in step 3.3 is divided into background (0) and foreground (1); Step 4.2: For each threshold The optimal threshold is determined through calculation. The specific calculation method is as follows: Step 4.2.1: Calculate the probability distribution of each gray value in the background (0) and foreground (1) in the background and foreground. ; Step 4.2.2: Calculate the background (0) and foreground (1) ; in: The cumulative distribution in the background; Step 4.2.3: Calculate the entropy of the background (0) and foreground (1): (5) Step 4.2.4: Calculate the inter-class entropy of the binary image: (6) Step 4.2.5: Select the threshold that maximizes inter-class entropy. Through continuous iterative traversal Find the optimal threshold.
[0031] Step 5: Use the morphological processing function (bwmorph function) built into MATLAB, with the parameter set to "thin", to repeat the operation multiple times on the image set with the best threshold obtained in Step 4, to obtain the image set after thinning. Step 6: Use the improved local binary mode to extract features from the image set after thinning in Step 5, convert the extracted features into feature vectors, and organize them into a matrix; The specific method for step 6 is as follows: Step 6.1: Select multiple circular regions with different radii, each with a different number of edge points; typically, small, medium, and large radii are chosen to capture image features at different scales. The selection of circular region parameters affects subsequent feature extraction, so choosing an appropriate radius and number of edge points is crucial. Using the selected circular region parameters, extract multiple sets of grayscale value sequences from the image set after thinning in Step 5. These sequences are calculated from the pixel values within the circular regions, and the grayscale value sequences reflect the grayscale changes in local image regions, used to describe the local texture features of the image. This embodiment extracts three sets of grayscale value sequences corresponding to the selected circular region parameters.
[0032] Step 6.2: Perform one-dimensional discrete fast Fourier transform on the multiple sets of different gray value sequences obtained in Step 6.1 to obtain multiple spectrograms. These spectrograms retain the main frequency features of the sequence and have certain rotation invariance and gray-level invariance. Step 6.3: According to the radius of the circular region, the feature sequences corresponding to the multiple spectrograms obtained in Step 6.2 are concatenated together to form a complete circular region feature vector; repeat this process for other regions of each image until the feature information of the entire image is obtained; in this embodiment, three spectrograms are obtained by transforming three sets of gray value sequences.
[0033] Step 6.4: Utilize the image features obtained in Step 6.3 to obtain an accurate description of the defect area, and calculate the maximum bounding rectangle region of the detected defect location; extract features again from the grayscale image inside the rectangle, and convert these features into a feature vector; Step 6.5: Based on each feature vector in Step 6.4, combine the feature vectors of all images together to form a feature matrix.
[0034] Step 7: Build a support vector machine model and perform classified supervised training on the feature vectors transformed in Step 6 to obtain a trained image set; The specific method for step 7 is as follows: Step 7.1: Represent each row of the feature matrix formed in Step 6.5 as a feature vector of a sample, and organize these feature vectors into a training sample set; the training sample set is defined as: (7) in :i Indicates the first i There are n samples, where n represents the sample size. For the first i Feature vectors of the image, It is the first i The tags for the image; Step 7.2: Based on the training sample set prepared in Step 7.1, find an optimal separating hyperplane in the feature space to separate the positive and negative samples, making the sample data points as far away from the hyperplane as possible. Find the parameters w and b that maximize the distance from the feature vector to the hyperplane; solve for the optimal w and b, specifically: Step 7.2.1: The hyperplane is defined by the linear equation (6): (8) Step 7.2.2: Define the optimization problem: The objective is set as: minimizing (9) The parameters w and b that maximize the distance from the eigenvector to the hyperplane simultaneously satisfy the following constraints: (10) Step 7.2.3: Introduce Lagrange multipliers and construct the Lagrange function: (11) Step 7.2.4: Solve the Lagrange dual problem using the quadratic programming (QP) algorithm to obtain the optimal Lagrange multipliers. : (12) Step 7.2.5: Solve for the optimal w and b: (13) Step 7.3: Using the solved optimal parameters w and b, establish a linearly separable support vector machine model; then use the support vector machine model to classify and train the feature vectors in step 6.5 to obtain a trained image set.
[0035] Through the above training process, a support vector machine model that can effectively classify metal defect images is obtained; this model is applied to the metal defect detection task to achieve automatic classification and training of image sets.
[0036] Step 8: Extract and label the image set trained in Step 7 as rolled-in oxide scale defects, spot defects, and scratch defects, and calculate the location and size of rolled-in oxide scale defects, spot defects, and scratch defects respectively; The specific method for step 8 is as follows: Step 8.1: Obtain defect classification images: The image set trained in step 7.3 is extracted and labeled as rolled-in oxide scale defects, spot defects, and scratch defects; Step 8.2: Calculation of the location and size of the rolled-in oxide scale defect: Step 8.2.1: Boundary Extraction and Mask Application: For each image that detects rolled-in oxide scale defects, first extract the boundary region of the defect; then, perform a mask operation on the original image for this boundary region; Step 8.2.2: Calculate the grayscale centroid: Use the centroid calculation formula: , (14) in Represents pixels The gray value is used to calculate the gray centroid of the rolled-in oxide scale defect area and take it as the center position of the defect. Step 8.2.2: Record the location and size of the defect: Based on the centroid location and boundary information, record the specific location and size of the rolled-in oxide scale defect; Step 8.3: Calculation of the location and size of spot defects: Step 8.3.1: Spot Area Calculation: For images with detected spot defects, calculate the total pixel area of the spot region. and the total pixel area of the image ; Step 8.3.2: Calculate the spot area ratio: Calculate the ratio of the spot area to the total metal surface area. (15) This ratio is used to assess the severity of spot defects; Step 8.3.3: Record the location and size of the spots: Based on the boundary information of the spot area, record the specific location and area percentage of the spots; Step 8.4: Calculation of the location and size of the scratch defect: Step 8.4.1: Line detection and segmentation: For images with detected scratch defects, the Hough transform algorithm is used for line detection; since scratches are not necessarily strictly straight lines, these detected lines may overlap or have angles. Step 8.4.2: Line filtering and classification: Calculate the length of each detected line and remove those lines whose length is less than the set threshold; calculate the angle between all detected lines and the y-axis, and classify the lines into vertical lines and horizontal lines based on the angle. Step 8.4.2: Sorting and Accumulating Lines: For vertical lines, sort them by the X coordinate of their midpoint from smallest to largest; for horizontal lines, sort them by the Y coordinate of their midpoint from smallest to largest; by traversing the lines, judge the coordinate difference between adjacent lines, and accumulate the lines that meet the conditions into the same scratch. Step 8.4.4: Calculate the scratch length and record the position: For each scratch, calculate the maximum and minimum values of its endpoint coordinates to determine the scratch length; process the remaining unprocessed straight lines in the same way and record the specific position and length of the scratch; Step 8.5: Generate the calculated image set: Step 8.5.1: Synthesize calculation results: Combine the location and size information of rolled-in oxide scale defects, spot defects and scratch defects obtained in steps 8.2, 8.3 and 8.4 into the corresponding images to generate an image set with defect location and size markers; Step 8.5.2: Save and output: Save the image set containing information on the location and size of defects for further analysis or use.
[0037] Step 9: Design a GUI for the image set obtained in Step 8 with calculated defect locations and sizes; The specific method for step 9 is as follows: Step 9.1: Interface Layout Design: Create a main interface containing two image display windows, two buttons, two user input windows, one data download button, two text boxes, and one table; ensure the interface layout is reasonable and user-friendly. Step 9.2: Image display window: Step 9.2.1: Implement image display function: Add two image display windows to the main interface; Original image display window: Used to display the original grayscale image; Annotated Image Display Window: Used to display the processed image, including annotations of the location and size of detected defects; Step 9.2.2: Image Loading Function: Implements the function of importing images from files. When the user clicks the "Import Image" button, the user selects a local grayscale image file and loads it into the original image display window. Step 9.3: Image Processing Button: Add an "Image Processing" button to the main interface; when the user clicks this button, the system will perform defect detection on the original image and display the processing results in the labeled image display window, including the location and size of the defects; Step 9.4: User Input Window: Create User Input Window: Add two user input windows and enter the following parameters: camera focal length (f) and object distance (d). Calculate the actual scratch size: Use the geometric optics Gaussian formula to calculate the distance. ; (16) Calculate the actual object length using the vertical magnification formula. ; (17) Step 9.5: Dataset Download Button: Add a "Download Dataset" button. When a user clicks this button, a dialog box will open, allowing the user to enter or select the URL to download the dataset and then download it. Step 9.6: Display defect information in the text box: Create two defect information text boxes to display the following information: Defect type: Displays the types of defects detected (e.g., rolled-in oxide scale, spots, scratches); defect size (number); and displays the number of defects detected and the size of each type of defect. Step 9.7: The table displays scratch information: Step 9.7.1: Create a table control: Add a table control to display the following information: Scratch pixel size: The pixel size of each detected scratch in the image; Actual scratch size: The actual size of each scratch calculated (based on the focal length and object distance input by the user). Step 9.7.2: Table Data Update: After image processing, fill the table with the pixel size and actual size of the scratches, and update the interface display; Step 9.8: Testing and Optimization: Step 9.8.1: Functionality Test: Conduct a comprehensive test to ensure that the image import, processing, calculation, and display functions are working properly; check that all buttons, input boxes, and display areas function as expected; Step 9.8.2: Optimize user experience: Make adjustments based on test feedback to optimize interface layout, function response time, and user interaction experience; Step 9.9: Deployment and Release: After all features have been developed and tested, package the application and make it available for users to download or release on the target platform.
[0038] A metal surface defect detection and classification system, comprising: Image acquisition module: Acquires images of metal surfaces with different defect types, and organizes these images into an image sample dataset. Image processing module: Automatically processes image sample datasets and performs corresponding feature extraction through grayscale normalization, adaptive histogram equalization, Gabor filter, maximum entropy algorithm, morphological processing and improved local binary mode, and constructs feature vectors for subsequent analysis.
[0039] Classification supervision module: Builds a support vector machine model and performs classification supervision training on the feature vectors; Defect calculation module: Extracts and labels the trained image set as rolled-in oxide scale defects, spot defects and scratch defects, and calculates the location and size of rolled-in oxide scale defects, spot defects and scratch defects respectively.
[0040] A metal surface defect detection and classification device, comprising: Memory: Used to store computer programs that implement the metal surface defect detection and classification method described above; Processor: Used to implement the metal surface defect detection and classification method as described above when executing the computer program.
[0041] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method for detecting and classifying metal surface defects.
[0042] The application effects of this invention will be described in detail below with reference to simulation experiments.
[0043] In constructing the image acquisition platform, a series of precise and systematic steps were followed to ensure that the platform could efficiently and accurately capture image data of metal surface defects. First, the installation and configuration of the light source were carefully considered. A side-mounted light source was specifically selected, and its position, angle, and brightness were meticulously adjusted to achieve optimal illumination of the metal surface while generating clear shadows to enhance defect visibility. To minimize interference from external environmental factors, the light source was cleverly placed within a sealed enclosure, a design that significantly improved the system's stability and reliability. A total of 600 grayscale images containing metal surface defects (scratches, rolled-in oxide scale, spots) were acquired during the experiment.
[0044] First, the image is read and the grayscale value of each pixel is extracted; these values are typically in the range of 0 to 255. Next, the minimum and maximum grayscale values in the image are identified to determine the distribution range of grayscale values. Then, the grayscale normalization formula (1) is used to normalize each original grayscale value to the range of 0 to 1. The normalized values are applied to each pixel of the image to generate the normalized image. Finally, the normalized image is saved or displayed for subsequent analysis or processing.
[0045] Apply contrast-limited adaptive histogram equalization (CLAHE) to the acquired image; set the corresponding parameters: Clip Limit = 0.01, Number of Tiles = 8x8; Figure 2 As shown, the image contrast is significantly enhanced after equalization, and the details are more prominent, which facilitates subsequent threshold segmentation.
[0046] Use respectively Gabor filtering is applied to the three defects, while other parameters remain unchanged. The kernel size is 25x25. For example... Figure 3 , Figure 4 As can be seen from the effect diagram, Gabor filtering is not applied to scratches, but only to rolled-in oxide scale and spots.
[0047] By using Different convolution kernels were used to filter scratches, and it was found that only when... The scratches only become visible after filtering, demonstrating that Gabor filtering is indeed directionally selective. Furthermore, when the filtering direction aligns with the scratch direction, it generates significant ripple oscillations at the scratch boundary, making the scratch appear wider. Therefore, we do not perform Gabor filtering on scratches, but only on rolled-in oxide scale and spots.
[0048] When applying Gabor filtering to rolled-in oxide scale and spots, significant oscillations along the filter direction appear in the background. To reduce these oscillations, four Gabor filters at different angles are used, and the results from each angle are weighted and averaged. By summing and subtracting the filter response images, the ripple phenomenon caused by the directional selectivity of the Gabor filter can be effectively counteracted, while noise is removed and defect boundaries are enhanced. Although Gabor filtering may make the image appear more blurred, it preserves and enhances features such as edges, peaks, valleys, and ridge contours, thereby improving the contrast between defects and the background and edge contour information.
[0049] Threshold segmentation was performed on defective images using the Otsu method, the maximum entropy algorithm, and the Niblack method. Figure 5 The image shows a comparison of the threshold segmentation results of the three algorithms. Otsu's method effectively reveals the shortcomings, but it also introduces some image noise. The maximum entropy method and Niblack's method achieve similar segmentation results, but considering that the maximum entropy method is a global threshold segmentation method, its computational cost is much lower than that of Niblack's method. Therefore, considering both performance and computational complexity, this invention selects the maximum entropy algorithm.
[0050] For scratch defects, gaps often appear in the middle of the scratch after thresholding, which is detrimental to subsequent straight line detection. Therefore, we first perform a closing operation on the image to eliminate these small gaps. We chose a 5x5 square structuring element for the operation. After the closing operation, the narrow gaps in the middle of the scratch, which was originally divided into three segments, were filled, and the scratch became continuous. For overly coarse scratches, failure to refine them may have adverse effects. Therefore, we used MATLAB's built-in morphological processing function (bwmorph function), selected the parameter "thin", and repeated the operation 5 times to obtain the refined scratch. Figure 6 The resulting image shows that the gaps in the scratch image have been eliminated, and the scratch lines are clearer.
[0051] For each detected defect, the maximum outer rectangle was calculated, and features of the grayscale image within the rectangle were extracted. These features were converted into vectors, forming a 600x18 feature matrix (600 images, 18 features per image). Support Vector Machine (SVM) was used for classification training. 540 images were used as the training set, and 60 images as the test set. Results showed that the classifier achieved a test accuracy of 93.3%.
[0052] For the rolled-in oxide scale defect, its location was determined using feature extraction and classifier training methods, and its centroid was marked with a blue asterisk. For example... Figure 7 As shown, a total of 16 rolled-in oxide scale defects were counted.
[0053] For the blotchy defects, their size was calculated using the feature extraction and classifier training method, and their boundaries were marked with red circles. For example... Figure 8 As shown, the area occupied by the spots is 5.13%.
[0054] For scratch defects, the above algorithm was used to obtain the starting point coordinates and length of each scratch, and the two endpoints were marked with crosses, while the actual positions of the scratches were marked with straight lines. The results are as follows: Figure 9 As shown, four scratches were detected, with the starting point coordinates and lengths as follows (assuming a focal length of 2cm, an object distance of 50cm, and a pixel-to-actual-size conversion ratio of 0.048cm / pixel): First line: 80 pixels, actual size 3.84cm; Second: 172 pixels, actual size 8.26cm; Article 3: 169 pixels, actual size 8.09cm; Article 4: 173 pixels, actual size 8.31cm; Use crosses to mark the two endpoints and lines to mark the straight lines of the scratches.
[0055] To facilitate operation and demonstration, a metal defect classification and measurement page was developed. It includes two image display windows: one showing the original curve and the other displaying an image with the detected defect location and size marked. Two buttons are used for importing grayscale images from files and for image processing, respectively. Two user input windows allow users to input the camera's focal length and object distance to calculate the actual scratch size. Figure 10 This is the initial test page for the GUI of this invention; Figure 11 , Figure 12 , Figure 13 These are test pages for rolled-in oxide scale defects, spot defects, and scratch defects, respectively.
[0056] As can be seen from the simulation experiments, compared with the existing technology, the present invention exhibits significant advantages in the acquisition and processing of metal surface defect images: In terms of light source design and control: the combination of side light source and sealed box not only optimizes the lighting conditions, but also improves the stability and anti-interference ability of the system. It is a rare high-efficiency light source design scheme in the existing technology. Through the precise configuration of side light source and sealed box design, the stability of image acquisition is improved, external interference is reduced, image quality is significantly improved, and the defect recognition rate is increased by about 20%.
[0057] Regarding image preprocessing: from grayscale normalization and adaptive histogram equalization (CLAHE) to Gabor filter optimization, and then to threshold segmentation and morphological processing, each step has been finely adjusted according to the characteristics of metal surface defects, forming a complete image processing chain that significantly improves the accuracy and efficiency of defect detection.
[0058] Gray-scale normalization: Normalizes gray-scale values to the range of 0 to 1, providing a more stable data foundation for subsequent processing and enhancing the generalization ability of the algorithm.
[0059] CLAHE Application: CLAHE processing enhances image contrast by approximately 30%, making defect details clearer and providing better conditions for subsequent threshold segmentation.
[0060] Gabor filter optimization: Optimized filtering strategies were adopted for scratches, rolled-in oxide scale, and spots. In particular, multi-angle Gabor filtering and weighted averaging reduced background oscillations, enhanced defect boundaries, and improved defect identification accuracy by about 15%.
[0061] Threshold segmentation algorithm selection: The maximum entropy method is adopted. Compared with the Otsu method and the Niblack method, it reduces the computational complexity by about 40% while maintaining high segmentation accuracy.
[0062] Defect detection and measurement accuracy: In scratch detection, through closing operation and refinement processing, the continuity and clarity of scratches are significantly improved, and the error in scratch length measurement is controlled within ±0.1cm, with an accuracy of up to 99%.
[0063] In terms of multi-intelligent classification and measurement systems: by combining support vector machine models with GUI interface design, automatic defect classification, location positioning and size measurement are realized, providing a convenient and efficient solution for industrial inspection.
[0064] In terms of user experience: Through the development of the GUI interface, users can easily import images, adjust parameters, and view processing results, which greatly improves the operability and user experience of the system.
[0065] In summary, this invention demonstrates significant advantages and innovations in light source design, image processing algorithms, defect detection accuracy, and user-friendliness, bringing new breakthroughs to the field of metal surface defect detection.
Claims
1. A method for detecting and classifying defects on metal surfaces, characterized in that: Includes the following steps: Step 1: Collect images of metal surfaces with different defect types, and organize the images of metal surfaces with different defect types into an image sample dataset; Step 2: Perform contrast enhancement processing on the image sample dataset prepared in Step 1 using grayscale normalization and adaptive histogram equalization to obtain an image set with enhanced contrast and reduced noise; Step 3: Use a Gabor filter to process the image set that has undergone contrast enhancement and noise reduction in Step 2, resulting in an image set with reduced noise and enhanced defect boundaries; Step 4: Use the maximum entropy algorithm to perform threshold segmentation on the image set that has been reduced in noise and enhanced in defect boundaries in Step 3 to obtain the image set with the optimal threshold; Step 5: Use MATLAB's built-in morphological processing function, with the parameter set to "thin", to repeat the operation multiple times on the image set with the optimal threshold obtained in Step 4, to obtain the thinned image set; Step 6: Use the improved local binary mode to extract features from the image set after thinning in Step 5, convert the extracted features into feature vectors, and organize them into a matrix; The specific method for step 6 is as follows: Step 6.1: Select multiple circular regions with different radii, each with a different number of edge points; using the selected circular region parameters, extract multiple grayscale value sequences from the image set after thinning in step 5; Step 6.2: Perform one-dimensional discrete fast Fourier transform on the multiple sets of different gray value sequences obtained in Step 6.1 to obtain multiple spectrograms; Step 6.3: Following the order of the radius of the circular region, concatenate the feature sequences corresponding to the multiple spectrograms obtained in Step 6.2 to form a complete circular region feature vector; repeat this process for other regions of each image until the feature information of the entire image is obtained; Step 6.4: Utilize the image features obtained in Step 6.3 to obtain an accurate description of the defect area, and calculate the maximum bounding rectangle region of the detected defect location; extract features again from the grayscale image inside the rectangle, and convert these features into a feature vector; Step 6.5: Based on each feature vector in Step 6.4, combine the feature vectors of all images together to form a feature matrix; Step 7: Build a support vector machine model and perform classified supervised training on the feature vectors transformed in Step 6 to obtain a trained image set; Step 8: Extract and label the image set trained in Step 7 as rolled-in oxide scale defects, spot defects, and scratch defects, and calculate the location and size of rolled-in oxide scale defects, spot defects, and scratch defects respectively; Step 9: Design a GUI for the image set whose defect locations and sizes were calculated in Step 8.
2. The method for detecting and classifying metal surface defects according to claim 1, characterized in that: The specific method for step 2 is as follows: Step 2.1: Process the image sample dataset prepared in Step 1 using the gray-level normalization formula to ensure that the gray-level values of the image sample dataset are distributed between 0 and 255; the gray-level normalization formula is defined as: (1) In the formula, —The grayscale value of the original image; —The minimum grayscale value of the original image; —The maximum grayscale value of the original image; —The grayscale value of the image after grayscale normalization; Step 2.2: Perform adaptive histogram equalization on the image sample dataset after grayscale normalization in Step 2.
1. The specific method is as follows: Step 2.2.1: Set a threshold for the original histogram distribution and cut off the portion that is greater than the threshold; Step 2.2.2: Equalize the cut-off portion, and then superimpose the equalized cut-off portion onto the original histogram distribution that is less than the threshold. Step 2.2.3: Equalize the distribution of the superimposed histogram to further enhance contrast and effectively reduce noise.
3. The method for detecting and classifying metal surface defects according to claim 2, characterized in that: The specific method for step 3 is as follows: Step 3.1: Apply a Gabor filter to the image set obtained in Step 2.2 for contrast enhancement and noise reduction; the Gabor filter is defined by a Gaussian kernel function modulated by a sinusoidal plane wave. ) (2) in: It is a rotated coordinate system. It is the direction parameter of the Gabor filter, which determines the filtering direction selection characteristic of the Gabor filter; It is the standard deviation of the Gaussian kernel function, which controls the width of the Gaussian function; It refers to the bandwidth, which affects the filter's bandwidth and frequency characteristics; This is the spatial scaling factor; The filtered image is: (3) (4) in, () represents pixel coordinates; g This is the response of the Gabor filter, that is, the output value of the filter at each pixel location; I These are the pixel values of the original image, i.e., the image data that needs to be filtered. Step 3.2: Use different filter parallel line directions Gabor filtering is applied to rolled-in oxide scale defects and spot defects; ; Step 3.3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require Filter addition and The summation and subtraction of the filters cancel out the ripple caused by the directional selectivity of Gabor filtering, while also filtering out noise and enhancing the defect boundary.
4. The method for detecting and classifying metal surface defects according to claim 3, characterized in that: The specific method for step 4 is as follows: Step 4.1: Set the threshold Increment from 0 to 255 by incrementing by 1 each time, according to the threshold. The image set processed in step 3.3 is divided into background 0 and foreground 1; Step 4.2: Calculate the best threshold for each threshold The best threshold is calculated by performing a calculation: Step 4.2.1 : Calculate the probability distribution of each gray value in the background 0 and the foreground 1 ; Step 4.2.2: Calculate the background 0 and foreground 1 in ; wherein: is the cumulative distribution in the background; Step 4.2.3: Calculate the entropy of background 0 and foreground 1: ;(5) Step 4.2.4: Calculate the inter-class entropy of the binary image: (6) Step 4.2.5: Select the threshold that maximizes inter-class entropy. Through continuous iterative traversal Find the optimal threshold.
5. The method of detecting and classifying defects on a metal surface according to claim 1, wherein: The specific method for step 7 is as follows: Step 7.1: Represent each row of the feature matrix formed in Step 6.5 as a feature vector of a sample, and organize these feature vectors into a training sample set; the training sample set is defined as: (7) wherein :i represents the i-th i sample, n represents the sample size, is the i-th i eigenvector of the i-th graph, and i is the label of the i-th Step 7.2: Based on the training sample set prepared in Step 7.1, find an optimal separating hyperplane in the feature space, that is, solve for the optimal w and b, specifically: Step 7.2.1: The hyperplane is defined by the linear equation (6): (8) Step 7.2.2: Define the optimization problem: The goal is set to: minimize (9) The parameters w and b that maximize the distance of the feature vector to the hyperplane simultaneously satisfy the constraint conditions: (10) Step 7.2.3: Introduce Lagrange multipliers and construct the Lagrange function: (11) Step 7.2.4: Solve the Lagrange dual problem using the quadratic programming (QP) algorithm to obtain the optimal Lagrange multipliers. : (12) Step 7.2.5: Solve for the optimal w and b: (13) Step 7.3: Using the solved optimal parameters w and b, establish a linearly separable support vector machine model; then use the support vector machine model to classify and train the feature vectors in step 6.5 to obtain a trained image set.
6. The method of metal surface defect detection and classification according to claim 5, wherein: The specific method for step 8 is as follows: Step 8.1: Obtain defect classification images: The image set trained in step 7.3 is extracted and labeled as rolled-in oxide scale defects, spot defects, and scratch defects; Step 8.2: Calculation of the location and size of the rolled-in oxide scale defect: Step 8.2.1: Boundary Extraction and Mask Application: For each image that detects rolled-in oxide scale defects, first extract the boundary region of the defect; then, perform a mask operation on the original image for this boundary region; Step 8.2.2: Calculate the grayscale centroid: Use the centroid calculation formula: , (14) in Represents pixels The gray value is used to calculate the gray centroid of the rolled-in oxide scale defect area and take it as the center position of the defect. Step 8.2.2: Record the location and size of the defect: Based on the centroid location and boundary information, record the specific location and size of the rolled-in oxide scale defect; Step 8.3: Calculation of the location and size of spot defects: Step 8.3.1 : Spot area calculation: For images where a spot defect is detected, calculate the total pixel area of the spot area and the total pixel area of the image ; Step 8.3.2: Calculate the spot area ratio: Calculate the ratio of the spot area to the total metal surface area. (15) This ratio is used to assess the severity of spot defects; Step 8.3.3: Record the location and size of the spots: Based on the boundary information of the spot area, record the specific location and area percentage of the spots; Step 8.4: Calculation of the location and size of the scratch defect: Step 8.4.1: Line detection and segmentation: For images with detected scratch defects, the Hough transform algorithm is used for line detection; Step 8.4.2: Line filtering and classification: Calculate the length of each detected line and remove those lines whose length is less than the set threshold; calculate the angle between all detected lines and the y-axis, and classify the lines into vertical lines and horizontal lines based on the angle. Step 8.4.2: Sorting and Accumulating Lines: For vertical lines, sort them by the X coordinate of their midpoint from smallest to largest; for horizontal lines, sort them by the Y coordinate of their midpoint from smallest to largest; by traversing the lines, judge the coordinate difference between adjacent lines, and accumulate the lines that meet the conditions into the same scratch. Step 8.4.4: Calculate the scratch length and record the position: For each scratch, calculate the maximum and minimum values of its endpoint coordinates to determine the scratch length; process the remaining unprocessed straight lines in the same way and record the specific position and length of the scratch; Step 8.5: Generate the calculated image set: Step 8.5.1: Synthesize calculation results: Combine the location and size information of rolled-in oxide scale defects, spot defects and scratch defects obtained in steps 8.2, 8.3 and 8.4 into the corresponding images to generate an image set with defect location and size markers; Step 8.5.2: Save and output: Save the image set containing information on the location and size of defects for further analysis or use.
7. A metal surface defect detection and classification system applying a metal surface defect detection and classification method according to any one of claims 1-6, characterized in that: include: Image acquisition module: Acquires images of metal surfaces with different defect types, and organizes these images into an image sample dataset. Image processing module: Automatically processes image sample datasets and performs corresponding feature extraction through grayscale normalization, adaptive histogram equalization, Gabor filter, maximum entropy algorithm, morphological processing and improved local binary mode, and constructs feature vectors for subsequent analysis; Classification supervision module: Builds a support vector machine model and performs classification supervision training on the feature vectors; Defect calculation module: Extracts and labels the trained image set as rolled-in oxide scale defects, spot defects and scratch defects, and calculates the location and size of rolled-in oxide scale defects, spot defects and scratch defects respectively.
8. A metal surface defect detection and classification apparatus, characterized by: include: Memory: Used to store computer programs implementing the metal surface defect detection and classification method as described in any one of claims 1-6; Processor: Used to implement the metal surface defect detection and classification method as described in any one of claims 1-6 when executing the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program that, when executed by a processor, implements a method for detecting and classifying metal surface defects as described in any one of claims 1-6.
Citation Information
Patent Citations
Metal surface defect detection method, system, device and storage medium
CN112634219B
Metal surface defect detection system based on machine vision
CN113237895A
Flame identification method, system and device and medium
CN113177467A
Casting surface defect detection method based on computer vision
CN116758061A