Workpiece surface defect detection method based on visual identification
By selecting the spectral band suitable for the material and fusion of multispectral camera data, combining deep reinforcement learning models and standard sample calibration sensors, the problems of material differences and environmental changes in the detection of workpiece surface defects are solved, and detection accuracy and stability are improved.
Patent Information
- Application Number
- CN202411400643.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2024-11-05
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing visual recognition-based surface defect detection method of workpieces is difficult to fully reveal defect characteristics in a single spectral band when facing different materials. Especially the reflection problem of metal workpieces leads to a decrease in detection accuracy, and lacks an adaptive adjustment mechanism to deal with production. Changes in environment and lighting conditions.
By selecting spectral bands suitable for different materials, using multi-spectral cameras to obtain image data, and using a combination of data fusion algorithms and deep reinforcement learning models to build a defect recognition model, use standard sample calibration sensors to monitor environmental changes, and dynamically adjust model parameters to Improve detection stability.
It significantly improves detection accuracy and robustness, enhances the detection ability of workpieces of different materials, and ensures high recognition accuracy and system stability under environmental changes.
Smart Images

Figure CN118898620A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of computer vision, and in particular to a workpiece surface defect detection method based on visual recognition. Background Art
[0002] With the continuous improvement of industrial automation level, workpiece surface defect detection technology plays a vital role in the manufacturing industry. Traditional workpiece surface defect detection methods mainly rely on manual visual inspection, which is not only inefficient, but also easily affected by subjective factors, and it is difficult to ensure the consistency and reliability of detection. In recent years, with the development of computer vision technology, defect detection methods based on visual recognition have gradually become mainstream, especially in the fields of precision manufacturing, automotive parts, and electronic components. Such technologies are usually combined with image processing algorithms and machine learning models to achieve efficient and accurate detection of workpiece surface defects. However, the existing workpiece surface defect detection methods based on visual recognition still have some shortcomings. First, when facing workpieces of different materials, images of a single spectral band often cannot fully reveal the defect characteristics, especially for the reflection problem on the surface of metal workpieces, which will lead to a decrease in the accuracy of defect detection. Secondly, traditional image processing algorithms include edge detection and template matching. When dealing with defect detection tasks under complex backgrounds, they lack the ability to adapt to new defect types. In addition, due to the complexity and variability of the production environment, changes in lighting conditions and camera parameters will directly affect the stability of the detection results, and existing methods often lack an effective adaptive adjustment mechanism. Therefore, developing a method that can select appropriate spectral bands according to different materials, enhance defect characteristics using multi-spectral image fusion, and achieve high-precision defect recognition and adaptive environmental changes through deep reinforcement learning models has become a key issue to be solved. Summary of the invention
[0003] In view of the above existing problems, the present invention is proposed.
[0004] Therefore, the present invention provides a workpiece surface defect detection method based on visual recognition to solve the problem that due to the complexity and variability of the production environment, changes in lighting conditions and camera parameters will directly affect the stability of the detection results, while the existing methods often lack an effective adaptive adjustment mechanism.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions: In a first aspect, an embodiment of the present invention provides a method for detecting surface defects of a workpiece based on visual recognition, which comprises: Select appropriate spectral bands according to the material of the workpiece, use a multispectral camera to obtain image data in different spectral bands, and fuse the image data through a data fusion algorithm to obtain the target image data; Apply deep reinforcement learning technology to build a defect recognition model based on target image data. The defect recognition model is trained to identify preset defect types while continuously learning new defect patterns. Use standard samples to calibrate sensors, monitor environmental changes and adaptively adjust model parameters in defect recognition models; Obtain the image of the workpiece to be inspected, use the trained and calibrated defect recognition model to perform defect detection on the image of the workpiece to be inspected, obtain the detection results, and formulate a response plan based on the detection results.
[0006] As a preferred solution of the workpiece surface defect detection method based on visual recognition described in the present invention, wherein: the appropriate spectral band is selected according to the material of the workpiece, and image data under different spectral bands is obtained using a multi-spectral camera. The specific steps are: For metal workpieces, since surface reflection will affect the defect detection effect, the near-infrared NIR band is selected; For non-metallic materials, the visible light VIS band is selected; A multispectral camera with high resolution and high sensitivity is used to collect image data in the near-infrared NIR band and the visible light VIS band.
[0007] As a preferred solution of the workpiece surface defect detection method based on visual recognition described in the present invention, wherein: the image data is fused by a data fusion algorithm to obtain target image data, and the specific steps are as follows: Based on the method of fractional Fourier transform FrFT and principal component analysis PCA, a data fusion algorithm is constructed to perform image fusion. The expression is: ; in, represents the target image data, is a normalization constant, is the fractional Fourier transform operator, An angle parameter representing the transformation, which determines the degree of the transformation. In the frequency domain, The image data corresponding to the spectral bands, Indicates frequency, represents the principal component vector, represents the weight vector obtained by principal component analysis, Represents frequency variable of minor changes.
[0008] As a preferred solution of the workpiece surface defect detection method based on visual recognition described in the present invention, wherein: the application of deep reinforcement learning technology to build a defect recognition model based on target image data, identify preset defect types by training the defect recognition model, and continuously learn new defect patterns, the specific steps are: Collect a large amount of labeled defect sample image data from the actual production line as positive samples, and collect normal workpiece image data without defects as negative samples; Preprocess the collected positive and negative samples; Based on deep reinforcement learning model as the basis of defect recognition model; The network structure of the defect recognition model based on the deep reinforcement learning model is a neural network including convolutional layers, fully connected layers and output layers; The target image data Input into the convolution layer of CNN, and extract different local features of the target image data through a series of convolution kernels; Adding a pooling layer after the convolutional layer reduces the spatial dimension of the feature map while retaining the most important feature information; The feature map after multiple convolution and pooling operations is flattened into a one-dimensional vector, and then further extracted through the fully connected layer to obtain the abstract feature, which is expressed as: ; in, represents the feature extraction function, represents the fully connected layer operation, represents the maximum pooling layer operation, Represents the convolution layer operation; Finally get , that is, the eigenvector, expressed as: ; in, represents the feature extraction function, represents the feature vector; Based on feature extraction function and target image data Construct the prediction function, and the defect recognition expression is: ; in, represents the probability of different defect types, represents the prediction function, represents the parameter set of the defect recognition model, Represents the activation function , represents the weight matrix, represents the bias vector.
[0009] As a preferred solution of the workpiece surface defect detection method based on visual recognition of the present invention, the specific steps are as follows: using standard samples to calibrate sensors, monitoring environmental changes and adaptively adjusting model parameters in the defect recognition model, Select a set of labeled standard samples; Use a multispectral camera to capture images of standard samples; Preprocess the collected images; Use feature extraction function to extract feature vector of image; The characteristic vector of the standard sample With the known standard eigenvector For comparison, the Euclidean distance method is used to measure the deviation between feature vectors and obtain the calibration result, which is expressed as: ; in, Represents the feature vector With the standard eigenvector The deviation between represents the dimension of the feature vector, and denote the eigenvector and the standard eigenvector, respectively. elements, Represents an index variable; Set the threshold TT; when When , it means that the deviation is large and the model parameters need to be adjusted; otherwise, it means that the deviation is within the allowable range and there is no need to adjust the model parameters; When model parameters need to be adjusted, light intensity is collected regularly; When the calibration results and light intensity change, the camera exposure time and gain are adjusted dynamically. The expression is: ; in, and Represent the exposure time before and after adjustment, and represent the gains before and after adjustment, and is the adjustment factor.
[0010] As a preferred solution of the workpiece surface defect detection method based on visual recognition described in the present invention, wherein: the image of the workpiece to be detected is obtained, and the defect detection is performed on the image of the workpiece to be detected using a trained and calibrated defect recognition model to obtain a detection result, and a response plan is formulated according to the detection result. The specific steps are: Use a multispectral camera to obtain images of the workpiece to be inspected in the near infrared NIR band and the visible light VIS band; Perform image fusion on the workpiece image to be inspected to obtain the target workpiece data; Input the target workpiece image data into the defect recognition model to obtain the detection results ; Detection results based on defect recognition model , determine whether there is a defect and the specific defect type, the expression is: ; in, represents the probability value of crack defect, represents the probability value of scratch defect, represents the probability value of the pit defect, Indicates the probability value of the defect-free type; Set the threshold value TY; when If it is, it means there is a defect; otherwise, it means there is no defect.
[0011] The beneficial effects of the present invention are as follows: the present invention selects spectral bands suitable for different materials, uses a multispectral camera to acquire images, and improves the detectability of defect features through a data fusion algorithm. Compared with traditional methods, the present invention not only improves detection accuracy and robustness, but also introduces deep reinforcement learning technology to construct a defect recognition model, so that the model can maintain a high recognition accuracy while continuously learning new defect patterns. In addition, the present invention also adopts a method of calibrating sensors with standard samples to achieve adaptive adjustment to environmental changes, thereby significantly improving the stability and reliability of the detection system. By focusing on the shortcomings of the existing technology, the present invention provides a more reliable workpiece surface defect detection solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0013] Figure 1 This is a flow chart of the workpiece surface defect detection method based on visual recognition in Example 1.
[0014] Figure 2 Flow chart of the probabilities of different defect types in Example 1. DETAILED DESCRIPTION
[0015] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0016] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0017] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0018] Example 1, reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, provides a method for detecting surface defects of a workpiece based on visual recognition, comprising the following steps: S1 selects a suitable spectral band according to the material of the workpiece, uses a multispectral camera to obtain image data in different spectral bands, and fuses the image data through a data fusion algorithm to obtain target image data; For metal workpieces, since surface reflection will affect the defect detection effect, the near-infrared NIR band (700nm to 1000nm) is selected; For non-metallic materials, the visible light VIS band (400nm to 700nm) is selected; Use a multispectral camera with high resolution and high sensitivity to collect image data in the near-infrared NIR band and visible light VIS band. During the image acquisition process, the light must be uniform to avoid shadows and overexposure that affect the image quality. Uniform light conditions reduce false detections caused by shadows and overexposure, making the detection process more reliable and reducing the risk of false alarms and missed alarms. Selecting the spectral band that best suits the workpiece material can more effectively capture detailed information on the workpiece surface, thereby improving the accuracy of defect detection; This step is closely integrated with other steps (data fusion algorithm, deep reinforcement learning model) to form a complete and efficient detection process, which improves the overall integration and collaborative working ability; A data fusion algorithm is constructed based on the fractional Fourier transform FrFT and principal component analysis PCA method to perform image fusion. Through fractional Fourier transform and principal component analysis, the defect features can be better highlighted, thereby improving the accuracy of defect detection. The expression is: ; in, represents the target image data, is a normalization constant, is the fractional Fourier transform operator, An angle parameter representing the transformation, which determines the degree of the transformation. In the frequency domain, The image data corresponding to the spectral bands, Indicates frequency, represents the principal component vector, Represents the weight vector obtained by principal component analysis, which is used to quantify the importance of different principal components. Represents frequency variable Small changes in Thanks to the use of multispectral image fusion technology, the robustness in processing workpieces of various materials is enhanced, and high detection performance can be maintained even under changing lighting conditions.
[0019] S2 uses deep reinforcement learning technology to build a defect recognition model based on target image data. It trains the defect recognition model to identify preset defect types and continuously learns new defect patterns. A large amount of labeled defect sample image data is collected from the actual production line as positive samples. The sample types of defects include cracks, scratches and pits. At the same time, normal workpiece image data without defects is collected as negative samples. Preprocess the collected positive and negative samples, including size standardization and grayscale processing, to ensure data consistency; Based on deep reinforcement learning model as the basis of defect recognition model; The network structure of the defect recognition model based on the deep reinforcement learning model is a neural network including convolutional layers, fully connected layers and output layers; The convolution layer is used to extract image features, the fully connected layer is used to combine features, and the output layer corresponds to different defect types. The number of output layers is equal to the number of preset defect types plus one non-defective category. The target image data Input into the convolution layer of CNN, and extract different local features of the target image data through a series of convolution kernels; Adding a pooling layer after the convolutional layer reduces the spatial dimension of the feature map while retaining the most important feature information; The feature map after multiple convolution and pooling operations is flattened into a one-dimensional vector, and then further extracted through the fully connected layer to obtain the abstract feature, which is expressed as: ; in, represents the feature extraction function, represents the fully connected layer operation, represents the maximum pooling layer operation, Represents the convolution layer operation; Finally get , that is, the feature vector, which can be used as the input of the deep reinforcement learning model, and the expression is: ; in, represents the feature extraction function, which converts the target image data into a feature vector. represents the feature vector; Based on feature extraction function and target image data Construct the prediction function, and the defect recognition expression is: ; in, represents the probability of different defect types, represents the prediction function, represents the parameter set of the defect recognition model, Represents the activation function , Represents the weight matrix, which is a size of The matrix of & is the number of nodes in the output layer, which corresponds to different defect types. is the eigenvector The dimension of represents the bias vector; Defect types, including cracks, scratches, pits, and no defects.
[0020] S3 uses standard samples to calibrate sensors, monitor environmental changes, and adaptively adjust model parameters in defect recognition models; Select a series of standard samples with labels, including normal workpieces without defects and workpieces with known defect types; Use a multispectral camera to capture images of standard samples; Preprocess the acquired images, including size standardization and grayscale processing, to ensure data consistency; Use feature extraction function to extract feature vector of image; The characteristic vector of the standard sample With the known standard eigenvector For comparison, the Euclidean distance method is used to measure the deviation between feature vectors and obtain the calibration result, which is expressed as: ; in, Represents the feature vector With the standard eigenvector The deviation between The value range of is from 0 to positive infinity. represents the dimension of the feature vector, and denote the eigenvector and the standard eigenvector, respectively. elements, Represents an index variable; Set the threshold TT; when When , it means that the deviation is large and the model parameters need to be adjusted; otherwise, it means that the deviation is within the allowable range and there is no need to adjust the model parameters; When the model parameters need to be adjusted, the light intensity is collected regularly to ensure that the parameters are within a reasonable range; Record the environmental parameters during each calibration to facilitate subsequent analysis of the impact of environmental changes on performance; When the calibration results and light intensity change, the camera exposure time and gain are adjusted dynamically. The expression is: ; in, and Represent the exposure time before and after adjustment, and represent the gains before and after adjustment, and To adjust the coefficient, it can be adjusted according to the calibration results and the changes in light intensity; Gain refers to the length of time the image sensor is exposed to light.
[0021] S4 obtains the image of the workpiece to be inspected, uses the trained and calibrated defect recognition model to perform defect detection on the image of the workpiece to be inspected, obtains the detection result, and formulates a response plan based on the detection result; Use a multispectral camera to obtain images of the workpiece to be inspected in the near infrared NIR band and the visible light VIS band; Perform image fusion on the workpiece image to be inspected to obtain the target workpiece image data; Input the target workpiece image data into the defect recognition model to obtain the detection results ; Detection results based on defect recognition model , determine whether there is a defect and the specific defect type, where: The dimension is , The value range of is 1, 2, 3, 4, corresponding to the probability values of different defect types (cracks, scratches, pits) and the defect-free category, respectively. The expression is: ; in, represents the probability value of crack defect, represents the probability value of scratch defect, represents the probability value of the pit defect, Indicates the probability value of the defect-free type; Set the threshold value TY; when When , it means there is a defect, and the defect type and its corresponding probability value output by the detection function are recorded; otherwise, it means there is no defect; Then Compare with the threshold TY respectively; when When it is detected, it indicates that there is a crack defect, and the workpiece is immediately marked and removed from the production line to enter the re-inspection process; when When it is, it means there is a scratch defect, which is also marked and removed and enters the re-inspection process; when When it is, it means there is a pit defect, which is marked and removed and enters the re-inspection process; when When , it means that no defects are detected and the workpiece can continue to pass through the production line; when Any two defect types simultaneously When TY, it means that there is a batch problem with the workpiece. All defective workpieces should be isolated and clearly marked to prevent them from being mixed with qualified products. when Three defect types at the same time When TY is reached, it means that there is a serious batch problem with the workpiece. The production activities should be stopped immediately until the root cause of the problem is found and solved. An emergency meeting should be held with the management and heads of relevant departments to discuss the severity of the problem and the solution.
[0022] In summary, the present invention achieves this by: selecting spectral bands suitable for different materials, acquiring images using a multispectral camera, and improving the detectability of defect features through a data fusion algorithm. Compared with traditional methods, the present invention not only improves detection accuracy and robustness, but also introduces deep reinforcement learning technology to construct a defect recognition model, so that the model can maintain a high recognition accuracy while continuously learning new defect patterns. In addition, the present invention also adopts a method of calibrating sensors with standard samples to achieve adaptive adjustment to environmental changes, thereby significantly improving the stability and reliability of the detection system. By focusing on the shortcomings of the prior art, the present invention provides a more reliable solution for workpiece surface defect detection.
[0023] Example 2, referring to Table 1, is the second example of the present invention. To further verify the technical solution of the present invention, experimental simulation data of a workpiece surface defect detection method based on visual recognition is provided.
[0024] In order to verify the effectiveness of the workpiece surface defect detection method based on visual recognition provided by the present invention, the following experiments were conducted: Experimental materials and equipment: Metal workpiece sample (steel plate): size 200mm×200mm, thickness 5mm; Non-metal workpiece sample (plastic plate): size 200mm×200mm, thickness 3mm; Multispectral camera: with high resolution (2048x2048 pixels) and high sensitivity, supporting near infrared (NIR) band (700nm to 1000nm) and visible light (VIS) band (400nm to 700nm); Computer: Equipped with a high-performance GPU for processing image data and running deep learning models; Experimental steps: Step S1: Select a suitable spectral band and obtain image data; Use a multispectral camera to capture images of metal workpiece samples in the NIR band (700nm to 1000nm) to ensure uniform light distribution and avoid shadows and overexposure; Use the same device to collect images of non-metallic workpiece samples in the VIS band (400nm to 700nm), also ensuring uniform light; Step S2: performing image fusion; The data fusion algorithm is constructed based on fractional Fourier transform and principal component analysis. The target image data is expressed as ; Step S3: construct and train a defect recognition model; Collect image data of metal workpieces with cracks, scratches and pits as positive samples, and collect image data of metal workpieces without defects as negative samples; Preprocess the image data using size standardization and grayscale processing to ensure data consistency; A defect recognition model is built based on deep reinforcement learning technology. The model includes convolutional layers, fully connected layers, and output layers. The target image data Input into the model for training; Step S4: calibrating the sensor using a standard sample; Select a series of labeled standard samples, including normal workpieces without defects and workpieces with known defect types; Use a multispectral camera to collect images of standard samples every day and perform preprocessing; Use feature extraction function to extract feature vector of the image and compare it with standard feature vector; Adjust the exposure time and gain of the camera according to the comparison result; Step S5: Formulate a response plan based on the model output results; Set the threshold TY and formulate countermeasures based on the defect probability value output by the model; Experimental data record: Record the accuracy, recall, and F1 score of the detection results under each set of experimental conditions to evaluate the detection performance; The details are shown in Table 1 below: Table 1 Experimental record table By comparing the experimental data, it can be seen that the workpiece surface defect detection method based on visual recognition of the present invention has significantly better detection accuracy, recall rate and F1 score than the prior art, whether it is a metal workpiece or a non-metal workpiece. Detection accuracy: For metal workpieces, the detection accuracy of the method of the present invention reaches 98.5%, which is much higher than the 92.5% of the prior art; and for non-metal workpieces, the accuracy is also improved from 91.2% to 97.8%, which shows that the method of the present invention has obvious advantages in improving the detection accuracy; Recall rate: The recall rate reflects the ability of the model to identify all true positive examples. The recall rate of the method of the present invention for metal workpieces is 98.2%, which is 6.2 percentage points higher than the existing technology. For non-metal workpieces, the recall rate is also improved by 7 percentage points to 97.5%, which shows that the method of the present invention performs well in reducing missed detections. F1 score: The F1 score combines the accuracy and recall rate, and is an important indicator for evaluating model performance. The F1 score of the method of the present invention on metal workpieces is 0.983, and that of non-metal workpieces is 0.976, both higher than 0.922 and 0.908 of the prior art. This further proves the superiority of the method of the present invention in comprehensive performance. In summary, the present invention significantly improves the accuracy and robustness of workpiece surface defect detection by selecting appropriate spectral bands, using a multispectral camera to acquire high-quality image data, and combining data fusion algorithms and deep reinforcement learning models; especially when processing workpieces of different materials, the method of the present invention exhibits stronger adaptability and higher detection performance, and has obvious creativity and novelty.
[0025] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for detecting surface defects of a workpiece based on visual recognition, characterized in that: include, Select appropriate spectral bands according to the material of the workpiece, use a multispectral camera to obtain image data in different spectral bands, and fuse the image data through a data fusion algorithm to obtain the target image data; Apply deep reinforcement learning technology to build a defect recognition model based on target image data, identify preset defect types by training the defect recognition model, and continuously learn new defect patterns; Use standard samples to calibrate sensors, monitor environmental changes and adaptively adjust model parameters in defect recognition models; Obtain the image of the workpiece to be inspected, use the trained and calibrated defect recognition model to perform defect detection on the image of the workpiece to be inspected, obtain the detection result, and formulate a response plan based on the detection result.
2. The method for detecting workpiece surface defects based on visual recognition according to claim 1, characterized in that: The specific steps of selecting a suitable spectral band according to the material of the workpiece and using a multi-spectral camera to obtain image data in different spectral bands are as follows: For metal workpieces, since surface reflection will affect the defect detection effect, the near-infrared NIR band is selected; For non-metallic materials, the visible light VIS band is selected; A multispectral camera with high resolution and high sensitivity is used to collect image data in the near-infrared NIR band and the visible light VIS band.
3. The method for detecting workpiece surface defects based on visual recognition according to claim 1, characterized in that: The image data is fused by a data fusion algorithm to obtain target image data, and the specific steps are: Based on the method of fractional Fourier transform FrFT and principal component analysis PCA, a data fusion algorithm is constructed to perform image fusion. The expression is: ; in, represents the target image data, is a normalization constant, is the fractional Fourier transform operator, An angle parameter representing the transformation, which determines the degree of the transformation. In the frequency domain, The image data corresponding to the spectral bands, Indicates frequency, represents the principal component vector, represents the weight vector obtained by principal component analysis, Represents frequency variable of minor changes.
4. The method for detecting workpiece surface defects based on visual recognition according to claim 3, characterized in that: The application of deep reinforcement learning technology builds a defect recognition model based on target image data, identifies preset defect types by training the defect recognition model, and continuously learns new defect patterns. The specific steps are: Collect a large amount of labeled defect sample image data from the actual production line as positive samples, and collect normal workpiece image data without defects as negative samples; Preprocess the collected positive and negative samples; Based on deep reinforcement learning model as the basis of defect recognition model; The network structure of the defect recognition model based on the deep reinforcement learning model is a neural network including convolutional layers, fully connected layers and output layers; The target image data Input into the convolution layer of CNN, and extract different local features of the target image data through a series of convolution kernels; Adding a pooling layer after the convolutional layer reduces the spatial dimension of the feature map while retaining the most important feature information; The feature map after multiple convolution and pooling operations is flattened into a one-dimensional vector, and then further extracted through the fully connected layer to obtain the abstract feature, which is expressed as: ; in, represents the feature extraction function, represents the fully connected layer operation, represents the maximum pooling layer operation, Represents the convolution layer operation; Finally get , that is, the eigenvector, expressed as: ; in, represents the feature extraction function, represents the feature vector; Based on feature extraction function and target image data Construct the prediction function, and the defect recognition expression is: ; in, represents the probability of different defect types, represents the prediction function, represents the parameter set of the defect recognition model, Represents the activation function , represents the weight matrix, represents the bias vector.
5. The method for detecting workpiece surface defects based on visual recognition according to claim 4, characterized in that: The method uses standard samples to calibrate sensors, monitor environmental changes and adaptively adjust model parameters in the defect recognition model. The specific steps are: Select a set of labeled standard samples; Use a multispectral camera to capture images of standard samples; Preprocess the collected images; Use feature extraction function to extract feature vector of the image; The characteristic vector of the standard sample With the known standard eigenvector For comparison, the Euclidean distance method is used to measure the deviation between feature vectors to obtain the calibration result, which is expressed as: ; in, Represents the feature vector With the standard eigenvector The deviation between represents the dimension of the feature vector, and denote the eigenvector and the standard eigenvector, respectively. elements, Represents an index variable; Set the threshold TT; when When , it means that the deviation is large and the model parameters need to be adjusted; otherwise, it means that the deviation is within the allowable range and there is no need to adjust the model parameters; When model parameters need to be adjusted, light intensity is collected regularly; When the calibration results and light intensity change, the camera exposure time and gain are adjusted dynamically. The expression is: ; in, and Represent the exposure time before and after adjustment, and represent the gains before and after adjustment, and is the adjustment factor.
6. The method for detecting workpiece surface defects based on visual recognition according to claim 5, characterized in that: The specific steps of obtaining the image of the workpiece to be inspected, using the trained and calibrated defect recognition model to perform defect detection on the image of the workpiece to be inspected, obtaining the detection result, and formulating a response plan based on the detection result are as follows: Use a multispectral camera to obtain images of the workpiece to be inspected in the near infrared NIR band and the visible light VIS band; Perform image fusion on the workpiece image to be inspected to obtain the target workpiece image data; Input the target workpiece image data into the defect recognition model to obtain the detection results ; Detection results based on defect recognition model , determine whether there is a defect and the specific defect type, the expression is: ; in, represents the probability value of crack defect, represents the probability value of scratch defect, represents the probability value of the pit defect, Indicates the probability value of the defect-free type; Set the threshold value TY; when If it is, it means there is a defect; otherwise, it means there is no defect.
Citation Information
Patent Citations
Strip steel surface defect detection method and system
CN115272293A
Ring spinning broken yarn detection method and system based on image analysis
CN117779255A
Photovoltaic module defect intelligent identification method based on multi-source signals
CN117853455A
Method for detecting thermal runaway gas of battery
CN117969760A
Building structure internal defect detection method and system based on intelligent metasurface
CN118032817A
Cited By
Defect detection model training method, defect detection method and training system
CN119169006A
Defect detection method and device based on panoramic image of inner wall of drainage pipeline
CN119205776A
EVA high-concentration color master batch detection method based on multispectral imaging
CN119223817A
Method and device for detecting appearance defects of electroplated layer of power pin product and related product
CN119228796A
Power pin product electroplating layer appearance defect detection method, device and related products
CN119228796B
