Workpiece end face defect detection method and system based on deep learning
By using deep learning methods to enhance workpiece end face images, calculate offsets, and analyze difference frames, combined with a detection model, the instability problem of traditional detection methods is solved, achieving efficient and accurate detection of workpiece end face defects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHAANXI QINCHUAN GRINDING MASCH CO LTD
- Filing Date
- 2024-01-08
- Publication Date
- 2026-06-26
AI Technical Summary
In the existing technology, defect detection of workpiece end faces relies on manual visual inspection or traditional image processing algorithms, which are subjective and unstable, and the detection effect is poor, especially for complex defect types and workpiece end faces with large variability.
By employing a deep learning-based approach, image enhancement, region labeling, image offset calculation, image difference frame lookup, and classification detection using a pre-defined detection model are performed on the acquired workpiece end face image. This process identifies defect areas and extracts features, achieving automated and accurate defect detection.
It improves the efficiency and accuracy of workpiece end face defect detection, realizes fast, flexible and reliable defect detection, adapts to specific needs and optimizes query efficiency, and supports quality control and process optimization.
Smart Images

Figure CN117689654B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of workpiece defect detection, and in particular to a method and system for detecting defects on the end face of a workpiece based on deep learning. Background Technology
[0002] The end face of a workpiece refers to the end surface or contact surface of a workpiece, which is usually the part that comes into contact with other workpieces or equipment. It can be a flat surface, a curved surface, or a surface with a specific shape. The quality of the end face of a workpiece directly affects its connection, sealing, and operation with other components.
[0003] Currently, defect detection on workpiece end faces typically relies on manual visual inspection or traditional image processing algorithms. However, these methods are subjective and unstable, and their detection results are poor for complex defect types and highly variable workpiece end faces. Therefore, a method and system for detecting defects on workpiece end faces based on deep learning is needed to improve the detection efficiency of workpiece end face defects. Summary of the Invention
[0004] The present invention provides a method and system for detecting defects on the end face of a workpiece based on deep learning, the main purpose of which is to improve the detection efficiency of defects on the end face of a workpiece.
[0005] To achieve the above objectives, the present invention provides a method for defect detection of workpiece end faces based on deep learning, comprising:
[0006] Obtain the workpiece end face image corresponding to the workpiece being processed, perform image enhancement on the workpiece end face image to obtain an end face enhanced image, and perform region marking on the end face enhanced image to obtain the end face marked region corresponding to the workpiece end face image.
[0007] Query the region anomalies corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in a preset first direction and second direction based on the region anomalies, including:
[0008] The image offset of the workpiece end face image in the preset first and second directions is calculated using the following formula:
[0009] Wherein, Py represents the image offset of the workpiece end face image in the preset first and second directions, N represents the abnormal points in the region, |N| represents the total number of elements of the abnormal points in the region, P1 represents the preset point set corresponding to the preset first direction, |P1| represents the number of elements of the preset point set in the preset first direction, P2 represents the preset point set corresponding to the preset second direction, |P2| represents the number of elements of the preset point set in the preset second direction, and A(p+n) represents the pixel value at point (p+n) of the workpiece end face image.
[0010] Based on the image offset, query the image difference frame corresponding to the workpiece end face image, extract the image pixel value corresponding to the workpiece end face image, and calculate the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value.
[0011] Based on the image difference values, the workpiece end face image is classified and detected using a preset end face detection model to obtain a classified image;
[0012] Defect regions in the classified image are identified, and feature extraction is performed on the defect regions to obtain regional defect features. Based on the regional defect features, defect detection is performed on the end face image of the workpiece to obtain the defect detection result corresponding to the processed workpiece.
[0013] Optionally, the step of image enhancement of the workpiece end face image to obtain an enhanced end face image includes:
[0014] The workpiece end face image is denoised to obtain a denoised end face image;
[0015] Identify the feature type corresponding to the denoised end face image;
[0016] Based on the feature type, determine the edge features corresponding to the denoised end face image;
[0017] Based on the edge features, edge enhancement is performed on the denoised end face image to obtain an enhanced end face image.
[0018] Optionally, the step of region marking the end-face enhanced image to obtain the end-face marked region corresponding to the workpiece end-face image includes:
[0019] Identify the edge pixel values corresponding to the enhanced end face image;
[0020] Based on the edge pixel values, the enhanced end face image is binarized to obtain a binarized end face image;
[0021] Identify the connected regions corresponding to the binarized end-face image;
[0022] Seed points are marked on the connected regions to obtain region marker points;
[0023] Based on the region marker points, the binarized end face image is marked to obtain the end face marker region corresponding to the workpiece end face image.
[0024] Optionally, querying the image difference frame corresponding to the workpiece end face image based on the image offset includes:
[0025] Based on the image offset, determine the target image corresponding to the workpiece end face image;
[0026] Identify the target location corresponding to the target image;
[0027] Based on the target position, the workpiece end face image and the target image are aligned to obtain an aligned image group;
[0028] Extract the pixel coordinates from the aligned image group;
[0029] Based on the pixel coordinates, calculate the pixel difference between the workpiece end face image and the target image;
[0030] Based on the pixel difference value, query the image difference frame corresponding to the workpiece end face image.
[0031] Optionally, calculating the pixel difference value between the workpiece end face image and the target image based on the pixel coordinate points includes:
[0032] The pixel difference between the workpiece end face image and the target image is calculated using the following formula:
[0033]
[0034] Wherein, D represents the pixel difference between the workpiece end face image and the target image, W represents the width corresponding to the workpiece end face image and the target image, H represents the height corresponding to the workpiece end face image and the target image, F(i,j) represents the pixel value of the workpiece end face image at coordinate point (i,j), T(i,j) represents the pixel value of the target image at coordinate point (i,j), i represents the horizontal coordinate, and j represents the vertical coordinate.
[0035] Optionally, calculating the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value includes:
[0036] The image difference value corresponding to the workpiece end face image is calculated using the following formula:
[0037]
[0038] Where Tc represents the image difference value corresponding to the workpiece end face image, N represents the total number of pixels corresponding to the image pixel value, and W i P represents the weight of the i-th pixel in the workpiece end face image. i t P represents the pixel value of the i-th pixel in the current frame of the image difference frame. i t-1 D represents the pixel value of the i-th pixel in the previous frame of the image difference frame.t The image difference frame is represented by t, which represents the time point corresponding to the image difference frame.
[0039] Optionally, based on the image difference values, the workpiece end face image is classified and detected using a preset end face detection model to obtain a classified image, including:
[0040] Identify the difference index corresponding to the image difference values;
[0041] Based on the difference index, the workpiece end face image is classified and detected using a preset end face detection model to obtain the image category corresponding to the workpiece end face image.
[0042] Based on the image category, determine the classification image corresponding to the workpiece end face image.
[0043] Optionally, the step of performing defect detection on the workpiece end face image based on the regional defect features to obtain the defect detection result corresponding to the processed workpiece includes:
[0044] Identify the feature subset corresponding to the defect features in the region;
[0045] Sequence labeling is performed on the feature subset to obtain the defect sequence corresponding to the end face image features;
[0046] Based on the defect sequence, defect detection is performed on the end face image features to obtain defect detection results.
[0047] To address the aforementioned problems, this invention also provides a defect detection system for workpiece end faces based on deep learning, the system comprising:
[0048] The region marking module is used to acquire the workpiece end face image corresponding to the processed workpiece, perform image enhancement on the workpiece end face image to obtain an end face enhanced image, and perform region marking on the end face enhanced image to obtain the end face marked region corresponding to the workpiece end face image.
[0049] The offset calculation module is used to query the region anomaly points corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in the first and second directions based on the region anomaly points.
[0050] The image generation module is used to query the image difference frame corresponding to the workpiece end face image based on the image offset, extract the image pixel value corresponding to the workpiece end face image, and generate a first difference map corresponding to the workpiece end face image based on the image difference frame and the image pixel value.
[0051] The classification and detection module is used to classify and detect the workpiece end face image based on the image difference value using a preset end face detection model to obtain a classified image;
[0052] The defect detection module is used to identify defect regions in the classified image, extract features from the defect regions to obtain regional defect features, and perform defect detection on the workpiece end face image based on the regional defect features to obtain the defect detection result corresponding to the processed workpiece.
[0053] This invention acquires an image of the workpiece end face corresponding to the processed workpiece, and then enhances the image to obtain an enhanced end face image. This makes the features more obvious and prominent, which is beneficial to the accuracy and stability of subsequent feature extraction and defect detection algorithms. This helps to quickly and accurately detect defects on the workpiece end face. By querying the anomaly points corresponding to the end face recognition area, this invention can provide a more flexible solution, meet specific needs, optimize query efficiency, and achieve more accurate and reliable anomaly point detection. Based on the image offset, this invention queries the image difference frames corresponding to the workpiece end face image, which can provide important information about workpiece changes and defects, helping to achieve quality control, process optimization, and... By adjusting the target in a timely manner, this invention classifies and detects the workpiece end-face image based on the image difference value using a preset end-face detection model, obtaining a classified image. This improves classification accuracy, speed, and flexibility, and enables automated workpiece end-face image classification and detection, thus more accurately determining the category to which the workpiece end-face image belongs. This invention also performs defect detection on the workpiece end-face image based on the defect features of the region, obtaining the corresponding defect detection result for the processed workpiece. Specific data structures, algorithm optimization techniques, and parallel computing methods can be used to accelerate the detection speed, and detection accuracy can be improved by adjusting model parameters and data preprocessing, achieving more accurate and reliable defect detection. Therefore, this invention proposes a deep learning-based method and system for workpiece end-face defect detection to improve the efficiency of workpiece end-face defect detection. Attached Figure Description
[0054] Figure 1 This is a flowchart illustrating a method for detecting defects on the end face of a workpiece based on deep learning, according to an embodiment of the present invention.
[0055] Figure 2 This is a schematic diagram of a module for a workpiece end face defect detection system based on deep learning, provided in an embodiment of the present invention.
[0056] Figure 3 This is a schematic diagram of the internal structure of an electronic device that implements a method for detecting defects on the end face of a workpiece based on deep learning, according to an embodiment of the present invention.
[0057] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0058] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0059] This application provides a method for detecting defects on the end face of a workpiece based on deep learning. The execution entity of this method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the method for detecting defects on the end face of a workpiece based on deep learning can be executed by software or hardware installed on a terminal device or a server device. The software can be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cluster of cloud servers. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0060] Reference Figure 1 The diagram shown is a flowchart illustrating a method for detecting defects on the end face of a workpiece based on deep learning, according to an embodiment of the present invention. In this embodiment, the method for detecting defects on the end face of a workpiece based on deep learning includes:
[0061] S1. Obtain the workpiece end face image corresponding to the workpiece being processed, perform image enhancement on the workpiece end face image to obtain an enhanced end face image, and perform region marking on the enhanced end face image to obtain the end face marking region corresponding to the workpiece end face image.
[0062] This invention acquires an image of the workpiece end face corresponding to the processed workpiece, and then performs image enhancement on the workpiece end face image to obtain an enhanced end face image. This makes the features more obvious and prominent, which is beneficial to the accuracy and stability of subsequent feature extraction and defect detection algorithms, thereby helping to quickly and accurately detect defects on the workpiece end face.
[0063] The workpiece end face image refers to an image of the side or end of the workpiece during processing or use; the end face enhancement image refers to an improved image obtained after processing the workpiece end face image.
[0064] As an embodiment of the present invention, the step of enhancing the workpiece end face image to obtain an end face enhanced image includes: denoising the workpiece end face image to obtain a denoised end face image; identifying the feature type corresponding to the denoised end face image; determining the edge features corresponding to the denoised end face image based on the feature type; and enhancing the edge of the denoised end face image based on the edge features to obtain an end face enhanced image.
[0065] The denoised end face image refers to the workpiece end face image after noise removal processing; the feature type refers to the type of feature represented by the workpiece end face image determined by identification and analysis; and the edge feature refers to the boundary and contour information of the workpiece extracted from the denoised end face image.
[0066] Furthermore, the denoised end-face image can be obtained through image filtering algorithms, such as median filtering, mean filtering, and Gaussian filtering. The feature type can be obtained through a target detection and segmentation model. The specific steps include: identifying the denoised end-face image data; querying the image requirements corresponding to the denoised end-face image data; determining the target detection and segmentation model corresponding to the denoised end-face image based on the image requirements; using the target detection and segmentation model to segment and detect the denoised end-face image to obtain the feature regions and category information corresponding to the denoised end-face image; and determining the feature type corresponding to the denoised end-face image based on the feature regions and the category information.
[0067] Wherein, the denoised end face image data refers to the workpiece end face image data obtained after denoising processing; the image requirement refers to the requirement that matches the denoised end face image data according to the task requirements and feature types; the target detection and segmentation model refers to the trained model used to identify and segment specific feature types; the feature region refers to the feature region in the workpiece end face image extracted by the target detection and segmentation model; and the category information refers to the information that each feature region is classified into a specific feature type by the model.
[0068] In detail, based on the feature type, the edge features corresponding to the denoised end face image are determined. The specific steps include: identifying the type factor corresponding to the feature type; performing edge detection on the denoised end face image based on the type factor to obtain detected edge segments; connecting the detected edge segments to obtain edge paths; and extracting features from the edge paths to obtain edge features.
[0069] Wherein, the type factor refers to the parameter, feature template or other relevant index selected according to the feature type to describe the feature; the detected edge segment refers to the discrete line segment or curve fragment extracted from the denoised end face image by the edge detection algorithm; the edge path refers to the continuous edge line formed by connecting the detected edge segments; and the edge feature refers to the boundary and contour information of the workpiece extracted from the denoised end face image.
[0070] This invention obtains the marked end face region corresponding to the workpiece end face image by marking the end face enhanced image. This allows the workpiece end face to be distinguished from other regions, enabling the analysis and evaluation of specific attributes and features of the end face, and further realizing the detection of workpiece quality.
[0071] The end face marking area refers to the area representing the position and range of the workpiece end face obtained by marking the end face enhancement image.
[0072] As an embodiment of the present invention, the step of region marking the end-face enhancement image to obtain the end-face marked region corresponding to the workpiece end-face image includes: identifying the edge pixel values corresponding to the end-face enhancement image; performing binarization processing on the end-face enhancement image based on the edge pixel values to obtain a binarized end-face image; identifying the connected regions corresponding to the binarized end-face image; marking the connected regions with seed points to obtain region marked points; and performing region marking on the binarized end-face image based on the region marked points to obtain the end-face marked region corresponding to the workpiece end-face image.
[0073] Wherein, the edge pixel value refers to the pixel value on the edge of the end face enhancement image; the binarized end face image refers to the end face image obtained after binarization processing; the connected region refers to the pixel region with similar pixel values that are connected to each other in the binarized end face image; and the region marker point refers to the marker point obtained after seeding the connected region.
[0074] Furthermore, the edge pixel values can be obtained through edge detection algorithms, such as Canny and Sobel; the binarized end face image can be obtained through global thresholding methods, such as Otsu's method and bimodal analysis; the connected regions can be obtained through semantic segmentation models, such as U-Net and Mask R-CNN; and the region markers can be obtained through region labeling algorithms, such as Mean-Shift and Superpixel.
[0075] S2. Query the region anomaly points corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in the preset first direction and second direction based on the region anomaly points.
[0076] This invention provides a more flexible solution by querying the anomaly points corresponding to the end face identification area, and can meet specific needs, optimize query efficiency, and achieve more accurate and reliable anomaly point detection.
[0077] The term "regional anomaly point" refers to a pixel point that appears in a certain region and is unusual or abnormal compared to its surroundings.
[0078] Optionally, the outliers in the region can be obtained using a clustering algorithm. The specific steps include: collecting region data within the end-face recognition region; preprocessing the region data to obtain preprocessed data; identifying the recognition target corresponding to the end-face recognition region; determining the clustering algorithm corresponding to the region data based on the recognition target; using the clustering algorithm to cluster the preprocessed data to obtain data clusters; querying outliers in the data clusters; and determining the region outliers corresponding to the end-face recognition region based on the outliers.
[0079] Specifically, the regional data refers to the data collected in the end-face recognition area, including images, sensor data, or other relevant information; the preprocessed data refers to the data obtained after operating and transforming the regional data; the data cluster refers to the preprocessed data being divided into different groups or clusters based on similarity by the clustering algorithm; and the outlier refers to a data point in the data cluster that has different characteristics or behaviors from other points.
[0080] As an embodiment of the present invention, the step of calculating the image offset of the workpiece end face image in a preset first direction and a second direction based on the anomaly points in the region includes:
[0081] The image offset of the workpiece end face image in the preset first and second directions is calculated using the following formula:
[0082]
[0083] Wherein, Py represents the image offset of the workpiece end face image in the preset first and second directions, N represents the abnormal points in the region, |N| represents the total number of elements of the abnormal points in the region, P1 represents the preset point set corresponding to the preset first direction, |P1| represents the number of elements of the preset point set in the preset first direction, P2 represents the preset point set corresponding to the preset second direction, |P2| represents the number of elements of the preset point set in the preset second direction, and A(p+n) represents the pixel value of the workpiece end face image at point (p+n).
[0084] Specifically, the first direction refers to the horizontal direction on the workpiece end face image, or it can also be represented as the transverse direction on the workpiece end face image; the second direction refers to the vertical direction on the workpiece end face image, or it can also be represented as the longitudinal direction on the workpiece end face image.
[0085] S3. Based on the image offset, query the image difference frame corresponding to the workpiece end face image, extract the image pixel value corresponding to the workpiece end face image, and calculate the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value.
[0086] Based on the image offset, this invention queries the image difference frame corresponding to the workpiece end face image, which can provide important information about workpiece changes and defects, helping to achieve goals such as quality control, process optimization, and timely adjustment.
[0087] The image difference frame refers to an image frame generated by comparing the differences between two or more consecutive frames.
[0088] As an embodiment of the present invention, the step of querying the image difference frame corresponding to the workpiece end face image based on the image offset includes: determining the target image corresponding to the workpiece end face image based on the image offset; identifying the target position corresponding to the target image; aligning the workpiece end face image and the target image based on the target position to obtain an aligned image group; extracting pixel coordinate points in the aligned image group; calculating the pixel difference value between the workpiece end face image and the target image based on the pixel coordinate points; and querying the image difference frame corresponding to the workpiece end face image based on the pixel difference value.
[0089] Wherein, the target image refers to the image corresponding to the workpiece end face image after translation based on image offset; the target position refers to the specific position of the target image in the workpiece end face image; the aligned image group refers to a group of images obtained by aligning the workpiece end face image and the target image; the pixel coordinate point refers to the spatial coordinate of the pixel extracted from the aligned image group; and the pixel difference value refers to the difference between the pixel values of the workpiece end face image and the target image at the same pixel position.
[0090] Furthermore, the target image can be obtained through an image registration algorithm, the specific steps of which include: identifying the original image corresponding to the workpiece end face image; extracting feature points from the original image to obtain image feature points; calculating the transformation parameters between the workpiece end face image and the original image based on the image feature points; performing a transformation operation on the workpiece end face image based on the transformation parameters to obtain a transformed image; and performing sampling difference on the transformed image to obtain the target image corresponding to the workpiece end face image.
[0091] Wherein, the original image refers to an initial image or reference image containing the workpiece end face; the image feature points refer to representative key points extracted from the original image by the image registration algorithm; the transformation parameters refer to parameters representing the transformation relationship between the workpiece end face image and the original image, such as position, rotation, and scaling; and the transformed image refers to an image obtained by transforming the workpiece end face image according to the transformation parameters.
[0092] Specifically, the target location can be obtained through feature point matching algorithms, such as SIFT, SURF, and ORB; the aligned image group can be obtained through image registration models, such as local sub-pixel registration and global transform registration; the pixel coordinates can be obtained through corner detection algorithms, such as Harris corner detection and FAST corner detection; the pixel difference value can be obtained through the following pixel difference value calculation formula, wherein calculating the pixel difference value between the workpiece end face image and the target image based on the pixel coordinates includes:
[0093] The pixel difference between the workpiece end face image and the target image is calculated using the following formula:
[0094]
[0095] Wherein, D represents the pixel difference between the workpiece end face image and the target image, W represents the width corresponding to the workpiece end face image and the target image, H represents the height corresponding to the workpiece end face image and the target image, F(i,j) represents the pixel value of the workpiece end face image at coordinate point (i,j), T(i,j) represents the pixel value of the target image at coordinate point (i,j), i represents the horizontal coordinate, and j represents the vertical coordinate.
[0096] This invention extracts the image pixel values corresponding to the workpiece end face image to obtain visual feature information about the workpiece, and uses this information to perform tasks such as data analysis, pattern recognition, and quality control, thereby improving workpiece quality and production efficiency.
[0097] Wherein, the image pixel value refers to the numerical representation of each pixel in the workpiece end face image. Optionally, the image pixel value can be obtained by a feature extraction method, the specific steps of which include: performing image preprocessing on the workpiece end face image to obtain a preprocessed image; identifying the feature type corresponding to the preprocessed image; performing feature extraction on the preprocessed image based on the feature type to obtain image features; and identifying the image pixel value corresponding to the image features.
[0098] The image pixel value refers to the numerical value of each pixel in the image, representing the brightness or color information of that pixel; the feature type refers to a specific attribute or pattern used to describe the image content, such as edge, texture, color histogram, etc.; the image feature refers to a representative feature extracted from the preprocessed image, which can be used to represent some important information of the image.
[0099] As an embodiment of the present invention, calculating the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value includes:
[0100] The image difference value corresponding to the workpiece end face image is calculated using the following formula:
[0101]
[0102] Where Tc represents the image difference value corresponding to the workpiece end face image, N represents the total number of pixels corresponding to the image pixel value, and W i P represents the weight of the i-th pixel in the workpiece end face image. i t P represents the pixel value of the i-th pixel in the current frame of the image difference frame. i t-1 D represents the pixel value of the i-th pixel in the previous frame of the image difference frame. t The image difference frame is represented by t, which represents the time point corresponding to the image difference frame.
[0103] S4. Based on the image difference value, the workpiece end face image is classified and detected using a preset end face detection model to obtain a classified image.
[0104] Based on the image difference value, this invention uses a preset end-face detection model to classify and detect the workpiece end-face image, obtaining a classified image. This can improve classification accuracy, speed of detection, and flexibility, and realize automated workpiece end-face image classification and detection, thereby more accurately determining the category to which the workpiece end-face image belongs.
[0105] The end-face detection model refers to a CNN-based model, which includes convolutional layers, activation functions, pooling layers, fully connected layers, a loss function, and an optimization algorithm. The convolutional layers extract features by sliding one or more convolutional kernels across the image. The activation function introduces a non-linear transformation, enabling the network to learn non-linear relationships. The pooling layer reduces the spatial size of the feature map while retaining key features. The fully connected layer connects all features from the previous layer to each neuron in the current layer. The loss function measures the difference between the model's predicted output and the actual label, aiding in subsequent detection. The optimization algorithm updates the model's parameters to minimize the loss function. The classified image refers to the result image obtained after classifying and detecting the workpiece end-face image.
[0106] As an embodiment of the present invention, the step of classifying and detecting the workpiece end face image based on the image difference value using a preset end face detection model to obtain a classified image includes: identifying the difference index corresponding to the image difference value; classifying and detecting the workpiece end face image based on the difference index using a preset end face detection model to obtain the image category corresponding to the workpiece end face image; and determining the classified image corresponding to the workpiece end face image based on the image category.
[0107] The difference index refers to an index obtained by quantifying the calculated image difference values. The specific steps include: normalizing the image difference values to obtain normalized data; identifying the data range corresponding to the normalized data; and calculating the difference index corresponding to the image difference values based on the data range using a preset mapping function.
[0108] In detail, the normalized data refers to data that has been processed to scale the image difference values to a specific range; the data range refers to the numerical range of the normalized data; and the image category refers to the category to which the workpiece end face image belongs after classification and detection according to a preset end face detection model.
[0109] Furthermore, the difference index can be obtained through histogram algorithms, such as cross-correlation and chi-square distance algorithms; the image category can be obtained through CNN models, such as VGG, ResNet, and Inception models.
[0110] S5. Identify the defect region in the classified image, extract features from the defect region to obtain the region defect features, and perform defect detection on the workpiece end face image based on the region defect features to obtain the defect detection result corresponding to the processed workpiece.
[0111] This invention identifies defective regions in the classified images, enabling algorithm optimization for specific problems, eliminating unnecessary calculations or redundant steps, thereby improving the algorithm's running speed and efficiency, and adapting to the needs of large-scale image processing and real-time applications.
[0112] The defective region refers to a specific area in the classified image where there is some kind of abnormality, flaw, or error.
[0113] Optionally, the defective region can be obtained using a threshold segmentation algorithm, such as the Otsu algorithm.
[0114] This invention extracts features from the defective region to obtain regional defect features, which can reduce dimensionality, abstract important information, enhance interpretability, and improve classification or detection performance, thereby making the end-face detection model more efficient, accurate, and reliable.
[0115] The regional defect features refer to the quantitative indicators extracted from the defect region that describe the attributes of the defect region.
[0116] Optionally, the regional defect features can be obtained through feature extraction functions, such as calcHist, mean, and stddev. The calcHist function calculates the histogram features of an image or region; the mean function calculates the mean features of an image or region, accepting the input image or region and returning the mean value; and the stddev function calculates the standard deviation features of an image or region, accepting the input image or region and returning the standard deviation value.
[0117] This invention performs defect detection on the end face image of the workpiece based on the defect features of the region, and obtains the defect detection result corresponding to the processed workpiece. It can use specific data structures, algorithm optimization techniques, parallel computing and other methods to speed up the detection speed, and improve the detection accuracy by adjusting model parameters and data preprocessing, so as to achieve more accurate and reliable defect detection.
[0118] The defect detection result refers to the information about defects or abnormalities output by the program after analyzing and processing the features of the end face image.
[0119] As an embodiment of the present invention, the step of performing defect detection on the workpiece end face image based on the regional defect features to obtain the defect detection result corresponding to the processed workpiece includes: identifying a feature subset corresponding to the regional defect features; performing sequence annotation on the feature subset to obtain a defect sequence corresponding to the end face image features; and performing defect detection on the end face image features based on the defect sequence to obtain a defect detection result.
[0120] The feature subset refers to a subset of features selected from the features of the original end face image; the defect sequence refers to the feature sequence obtained after performing defect detection on the workpiece end face image based on the regional defect features.
[0121] In detail, the sequence labeling of the feature subset to obtain the defect sequence corresponding to the end face image features includes: determining the labeling rule corresponding to the feature subset; labeling the subset region corresponding to the feature subset with defects based on the labeling rule to obtain subset defect labels; identifying the defect label code corresponding to the subset defect label; and performing sequence labeling on the defect label code to obtain the defect sequence corresponding to the end face image features.
[0122] The marking rules refer to the rules or criteria used to define different defect types in the feature subset; the subset defect labels refer to the labels obtained by marking the subset regions in the feature subset according to the marking rules; and the defect label codes refer to mapping the subset defect labels to unique codes or identifiers.
[0123] Furthermore, the feature subset can be obtained through machine learning framework tools, such as OpenCV, scikit-image, and TensorFlow; the defect sequence can be obtained through supervised learning models, such as label propagation algorithms, self-generating models, and generative adversarial networks.
[0124] This invention acquires an image of the workpiece end face corresponding to the processed workpiece, and then enhances the image to obtain an enhanced end face image. This makes the features more obvious and prominent, which is beneficial to the accuracy and stability of subsequent feature extraction and defect detection algorithms. This helps to quickly and accurately detect defects on the workpiece end face. By querying the anomaly points corresponding to the end face recognition area, this invention can provide a more flexible solution, meet specific needs, optimize query efficiency, and achieve more accurate and reliable anomaly point detection. Based on the image offset, this invention queries the image difference frames corresponding to the workpiece end face image, which can provide important information about workpiece changes and defects, helping to achieve quality control, process optimization, and... By adjusting the target in a timely manner, this invention classifies and detects the workpiece end-face image based on the image difference value using a preset end-face detection model, obtaining a classified image. This improves classification accuracy, speed, and flexibility, and enables automated workpiece end-face image classification and detection, thus more accurately determining the category to which the workpiece end-face image belongs. This invention also performs defect detection on the workpiece end-face image based on the defect features of the region, obtaining the corresponding defect detection result for the processed workpiece. Specific data structures, algorithm optimization techniques, and parallel computing methods can be used to accelerate the detection speed, and detection accuracy can be improved by adjusting model parameters and data preprocessing, achieving more accurate and reliable defect detection. Therefore, this invention proposes a deep learning-based method and system for workpiece end-face defect detection to improve the efficiency of workpiece end-face defect detection.
[0125] like Figure 2 The diagram shown is a functional block diagram of a method and system for detecting defects on the end face of a workpiece based on deep learning, provided in an embodiment of the present invention.
[0126] The deep learning-based defect detection system 200 for workpiece end faces described in this invention can be installed in an electronic device. Depending on the functions implemented, the deep learning-based defect detection system 200 may include a region marking module 201, an offset calculation module 202, an image generation module 203, a classification detection module 204, and a defect detection module 205. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and perform a fixed function, stored in the memory of the electronic device.
[0127] In this embodiment, the functions of each module / unit are as follows:
[0128] The region marking module 201 is used to acquire the workpiece end face image corresponding to the processed workpiece, perform image enhancement on the workpiece end face image to obtain an end face enhanced image, and perform region marking on the end face enhanced image to obtain the end face marked region corresponding to the workpiece end face image.
[0129] The offset calculation module 202 is used to query the region anomaly points corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in the first and second directions based on the region anomaly points, including:
[0130] The image offset of the workpiece end face image in the preset first and second directions is calculated using the following formula:
[0131] Wherein, Py represents the image offset of the workpiece end face image in the preset first and second directions, N represents the abnormal points in the region, |N| represents the total number of elements of the abnormal points in the region, P1 represents the preset point set corresponding to the preset first direction, |P1| represents the number of elements of the preset point set in the preset first direction, P2 represents the preset point set corresponding to the preset second direction, |P2| represents the number of elements of the preset point set in the preset second direction, and A(p+n) represents the pixel value at point (p+n) of the workpiece end face image.
[0132] The image generation module 203 is used to query the image difference frame corresponding to the workpiece end face image based on the image offset, extract the image pixel value corresponding to the workpiece end face image, and generate a first difference map corresponding to the workpiece end face image based on the image difference frame and the image pixel value.
[0133] The classification and detection module 204 is used to classify and detect the workpiece end face image based on the image difference value using a preset end face detection model to obtain a classified image;
[0134] The defect detection module 205 is used to identify defect regions in the classified image, extract features from the defect regions to obtain regional defect features, and perform defect detection on the workpiece end face image based on the regional defect features to obtain the defect detection result corresponding to the processed workpiece.
[0135] In detail, each module in the deep learning-based defect detection system 200 for workpiece end faces described in this embodiment of the invention employs the same technical means as the deep learning-based defect detection method for workpiece end faces described in the accompanying drawings, and can produce the same technical effect, which will not be repeated here.
[0136] like Figure 3 The diagram shown is a schematic representation of the electronic device that implements the method for detecting defects on the end face of a workpiece based on deep learning, according to the present invention.
[0137] The electronic device 1 may include a processor 30, a memory 31, a communication bus 32, and a communication interface 33. It may also include a computer program stored in the memory 31 and capable of running on the processor 30, such as an artificial intelligence-based engineering safety monitoring program.
[0138] In some embodiments, the processor 30 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 30 is the control unit of the electronic device 1, connecting various components of the electronic device through various interfaces and lines. It executes programs or modules stored in the memory 31 (e.g., executing AI-based engineering safety monitoring programs) and calls data stored in the memory 31 to perform various functions of the electronic device and process data.
[0139] The memory 31 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 31 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 31 can be an external storage device of the electronic device, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 31 can include both internal and external storage units of the electronic device. The memory 31 can be used not only to store application software and various types of data installed on the electronic device, such as the code of database configuration connection programs, but also to temporarily store data that has been output or will be output.
[0140] The communication bus 32 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 31 and at least one processor 30, etc.
[0141] The communication interface 33 is used for communication between the electronic device 1 and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), or, optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0142] Figure 3 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 3 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0143] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 30 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0144] It should be understood that the embodiments described are for illustrative purposes only.
[0145] The database configuration connection program stored in the memory 31 of the electronic device 1 is a combination of multiple computer programs, which, when run in the processor 30, can achieve the following:
[0146] Obtain the workpiece end face image corresponding to the workpiece being processed, perform image enhancement on the workpiece end face image to obtain an end face enhanced image, and perform region marking on the end face enhanced image to obtain the end face marked region corresponding to the workpiece end face image.
[0147] Query the region anomalies corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in a preset first direction and second direction based on the region anomalies, including:
[0148] The image offset of the workpiece end face image in the preset first and second directions is calculated using the following formula:
[0149] Wherein, Py represents the image offset of the workpiece end face image in the preset first and second directions, N represents the abnormal points in the region, |N| represents the total number of elements of the abnormal points in the region, P1 represents the preset point set corresponding to the preset first direction, |P1| represents the number of elements of the preset point set in the preset first direction, P2 represents the preset point set corresponding to the preset second direction, |P2| represents the number of elements of the preset point set in the preset second direction, and A(p+n) represents the pixel value at point (p+n) of the workpiece end face image.
[0150] Based on the image offset, query the image difference frame corresponding to the workpiece end face image, extract the image pixel value corresponding to the workpiece end face image, and calculate the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value.
[0151] Based on the image difference values, the workpiece end face image is classified and detected using a preset end face detection model to obtain a classified image;
[0152] Defect regions in the classified image are identified, and feature extraction is performed on the defect regions to obtain regional defect features. Based on the regional defect features, defect detection is performed on the end face image of the workpiece to obtain the defect detection result corresponding to the processed workpiece.
[0153] Specifically, the processor 30's implementation method of the above-mentioned computer program can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0154] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium. The storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0155] The present invention also provides a storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:
[0156] Obtain the workpiece end face image corresponding to the workpiece being processed, perform image enhancement on the workpiece end face image to obtain an end face enhanced image, and perform region marking on the end face enhanced image to obtain the end face marked region corresponding to the workpiece end face image.
[0157] Query the region anomalies corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in a preset first direction and second direction based on the region anomalies, including:
[0158] The image offset of the workpiece end face image in the preset first and second directions is calculated using the following formula:
[0159] Wherein, Py represents the image offset of the workpiece end face image in the preset first and second directions, N represents the abnormal points in the region, |N| represents the total number of elements of the abnormal points in the region, P1 represents the preset point set corresponding to the preset first direction, |P1| represents the number of elements of the preset point set in the preset first direction, P2 represents the preset point set corresponding to the preset second direction, |P2| represents the number of elements of the preset point set in the preset second direction, and A(p+n) represents the pixel value at point (p+n) of the workpiece end face image.
[0160] Based on the image offset, query the image difference frame corresponding to the workpiece end face image, extract the image pixel value corresponding to the workpiece end face image, and calculate the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value.
[0161] Based on the image difference values, the workpiece end face image is classified and detected using a preset end face detection model to obtain a classified image;
[0162] Defect regions in the classified image are identified, and feature extraction is performed on the defect regions to obtain regional defect features. Based on the regional defect features, defect detection is performed on the end face image of the workpiece to obtain the defect detection result corresponding to the processed workpiece.
[0163] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0164] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0165] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0166] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0167] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features of the invention herein.
Claims
1. A method for defect detection on the end face of a workpiece based on deep learning, characterized in that, The method includes: Obtain the workpiece end face image corresponding to the workpiece being processed, perform image enhancement on the workpiece end face image to obtain an end face enhanced image, and perform region marking on the end face enhanced image to obtain the end face marked region corresponding to the workpiece end face image. Query the region anomalies corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in a preset first direction and second direction based on the region anomalies, including: The image offset of the workpiece end face image in the preset first and second directions is calculated using the following formula: ; in, This represents the image offset of the workpiece end face image in a preset first and second direction, where N represents the number of abnormal points in the region. The total number of elements representing outliers in the region. This represents the preset point set corresponding to the preset first direction. This indicates the number of elements in the preset point set along the first preset direction. This represents the preset point set corresponding to the preset second direction. This indicates the number of elements in the preset point set in the second direction. Represents the image points of the workpiece end face Pixel value at; Based on the image offset, query the image difference frame corresponding to the workpiece end face image, extract the image pixel value corresponding to the workpiece end face image, and calculate the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value. The step of calculating the image difference value corresponding to the workpiece end face image based on the image difference frame and the image pixel value includes: The image difference value corresponding to the workpiece end face image is calculated using the following formula: ; Wherein, Tc represents the image difference value corresponding to the workpiece end face image, and N represents the total number of pixels corresponding to the image pixel value. This represents the weight of the i-th pixel in the workpiece end face image. This represents the pixel value of the i-th pixel in the current frame of the image difference frame. This represents the pixel value of the i-th pixel in the previous frame of the image difference frame. The image difference frame is represented by t, which represents the time point corresponding to the image difference frame. Based on the image difference values, the workpiece end face image is classified and detected using a preset end face detection model to obtain a classified image; Defect regions in the classified image are identified, and feature extraction is performed on the defect regions to obtain regional defect features. Based on the regional defect features, defect detection is performed on the end face image of the workpiece to obtain the defect detection result corresponding to the processed workpiece.
2. The method for defect detection of workpiece end faces based on deep learning as described in claim 1, characterized in that, The step of enhancing the workpiece end face image to obtain an enhanced end face image includes: The workpiece end face image is denoised to obtain a denoised end face image; Identify the feature type corresponding to the denoised end face image; Based on the feature type, determine the edge features corresponding to the denoised end face image; Based on the edge features, edge enhancement is performed on the denoised end face image to obtain an enhanced end face image.
3. The method for defect detection of workpiece end faces based on deep learning as described in claim 1, characterized in that, The step of marking the end face enhanced image to obtain the end face marked area corresponding to the workpiece end face image includes: Identify the edge pixel values corresponding to the enhanced end face image; Based on the edge pixel values, the enhanced end face image is binarized to obtain a binarized end face image; Identify the connected regions corresponding to the binarized end-face image; Seed points are marked on the connected regions to obtain region marker points; Based on the region marker points, the binarized end face image is marked to obtain the end face marker region corresponding to the workpiece end face image.
4. The method for defect detection of workpiece end faces based on deep learning as described in claim 1, characterized in that, The step of querying the image difference frame corresponding to the workpiece end face image based on the image offset includes: Based on the image offset, determine the target image corresponding to the workpiece end face image; Identify the target location corresponding to the target image; Based on the target position, the workpiece end face image and the target image are aligned to obtain an aligned image group; Extract the pixel coordinates from the aligned image group; Based on the pixel coordinates, calculate the pixel difference between the workpiece end face image and the target image; Based on the pixel difference value, query the image difference frame corresponding to the workpiece end face image.
5. The method for defect detection of workpiece end faces based on deep learning as described in claim 4, characterized in that, The step of calculating the pixel difference value between the workpiece end face image and the target image based on the pixel coordinate points includes: The pixel difference between the workpiece end face image and the target image is calculated using the following formula: ; Where D represents the pixel difference between the workpiece end face image and the target image, W represents the width of the workpiece end face image and the target image respectively, and H represents the height of the workpiece end face image and the target image respectively. This indicates that the image of the workpiece end face is located at the coordinate point. Pixel value at that location, This indicates that the target image is at coordinate point The pixel value at the location, where i represents the horizontal coordinate and j represents the vertical coordinate.
6. The method for defect detection of workpiece end faces based on deep learning as described in claim 1, characterized in that, The step of classifying and detecting the workpiece end face image based on the image difference value using a preset end face detection model to obtain a classified image includes: Identify the difference index corresponding to the image difference values; Based on the difference index, the workpiece end face image is classified and detected using a preset end face detection model to obtain the image category corresponding to the workpiece end face image. Based on the image category, determine the classification image corresponding to the workpiece end face image.
7. The method for defect detection of workpiece end faces based on deep learning as described in claim 1, characterized in that, The step of performing defect detection on the workpiece end face image based on the regional defect features to obtain the defect detection result corresponding to the processed workpiece includes: Identify the feature subset corresponding to the defect features in the region; Sequence labeling is performed on the feature subset to obtain the defect sequence corresponding to the end face image features; Based on the defect sequence, defect detection is performed on the end face image features to obtain defect detection results.
8. A defect detection system for workpiece end faces based on deep learning, characterized in that, The system is used to perform the deep learning-based defect detection method for workpiece end faces as described in any one of claims 1-7, the system comprising: The region marking module is used to acquire the workpiece end face image corresponding to the processed workpiece, perform image enhancement on the workpiece end face image to obtain an end face enhanced image, and perform region marking on the end face enhanced image to obtain the end face marked region corresponding to the workpiece end face image. The offset calculation module is used to query the region anomaly points corresponding to the end face recognition area, and calculate the image offset of the workpiece end face image in the first and second directions based on the region anomaly points, including: The image offset of the workpiece end face image in the preset first and second directions is calculated using the following formula: ; in, This represents the image offset of the workpiece end face image in a preset first and second direction, where N represents the number of abnormal points in the region. The total number of elements representing outliers in the region. This represents the preset point set corresponding to the preset first direction. This indicates the number of elements in the preset point set along the first preset direction. This represents the preset point set corresponding to the preset second direction. This indicates the number of elements in the preset point set in the second direction. Represents the image points of the workpiece end face Pixel value at; The image generation module is used to query the image difference frame corresponding to the workpiece end face image based on the image offset, extract the image pixel value corresponding to the workpiece end face image, and generate a first difference map corresponding to the workpiece end face image based on the image difference frame and the image pixel value. The classification and detection module is used to classify and detect the workpiece end face image based on the image difference value using a preset end face detection model to obtain a classified image; The defect detection module is used to identify defect regions in the classified image, extract features from the defect regions to obtain regional defect features, and perform defect detection on the workpiece end face image based on the regional defect features to obtain the defect detection result corresponding to the processed workpiece.