Method and system for detecting laser welding defects based on active learning
Through an active learning method, we learn the visual concepts in the laser welding process, and expand the sample set through multiple iterations to establish a defect classification model, solving the problem of laser welding defect detection under category imbalance, and achieving efficient defect detection.
Patent Information
- Application Number
- CN202510374021.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-04-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In intelligent manufacturing, laser welding defects are difficult to effectively learn and detect defects in case of category imbalance due to the lack of a large number of manual annotation data sets and defect samples are significantly less than normal samples.
Using an active learning-based method, we collect image data of the laser welding process, divide it into labeled sample subsets and unlabeled sample subsets, learn visual concepts of different categories, and expand the labeled sample sets through multiple iterations to establish a classification model of laser welding defects.
In the case of category imbalance, effective defect detection is achieved, improving the accuracy of defect detection during laser welding.
Smart Images

Figure CN119887772A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of laser welding image processing, and specifically to a method and system for detecting laser welding defects based on active learning. Background Art
[0002] At present, machine learning or deep learning methods are widely used in the industry to detect defects in the laser welding process. For example, researchers use laser power, welding speed, spacing distance, etc. as input parameters, and use machine learning models such as random forests and SVM to predict whether the weld has defects. At the same time, researchers use deep learning methods such as convolutional neural networks based on 3D point cloud data to detect the laser welding process. However, in intelligent manufacturing, laser welding lacks a large number of manually annotated data sets. At the same time, the number of defective samples is significantly less than that of normal samples. How to learn and detect defects in the case of class imbalance is an urgent problem to be solved. Summary of the invention
[0003] In view of this, the purpose of this application is to provide a method and system for detecting laser welding defects based on active learning, so as to solve the technical problem of how to learn and detect defects in the case of class imbalance.
[0004] The present application discloses a method for detecting laser welding defects based on active learning, comprising the following steps: S1. Collect a first image as a sample data set, and divide the sample data set into a labeled first sample subset and an unlabeled second sample subset; wherein the first image is an image in a laser welding process; S2. Based on active learning and the first sample subset, learn multiple visual concepts of different categories; perform a convolution operation on the first sample subset and output a feature vector of the first sample subset ; Calculate each visual concept and feature vector similarity; based on the similarity, the images of the first sample subset are classified into two categories; the two categories include defects and no defects; S3, re-dividing the images in the second sample subset based on the visual concept into a common class data subset, a rare class data subset, a cross class data subset and an unseen class data subset; S4, removing the image data of the common class data subset and the rare class data subset from the second sample subset, and expanding them into the first sample subset; returning to step S2 until a preset condition is met, wherein the preset condition is that the size of the common class data subset or the rare class data subset reaches a set threshold; S5. Performing learning based on the expanded images of the first sample subset to establish a classification model for laser welding defects; S6. Acquire a second image, and determine whether the second image has defects based on the classification model; the second image is an image of the laser welding process to be determined.
[0005] In some possible implementations, the calculation of each visual concept and feature vector Similarities include: S21, initialize the visual concept, when the visual concept is in the input feature vector When sliding, multiple feature vectors corresponding to each step size are generated , calculate the visual concept and each feature vector and determine the minimum distance; S22. Associate each visual concept with a feature vector The minimum distance between them is stored in the distance matrix Medium; Based on distance matrix Calculating the similarity includes: ; in, The distance matrix is calculated The minimum value in For similarity.
[0006] In some possible implementations, the performing binary classification on the images of the first sample subset based on the similarity includes: Based on the similarity, the output size is Vector ;in, is the number of visual concepts per category, is the number of categories; Based on classification model and vector The images of the first sample subset are classified, and the classification model includes a fully connected layer and a Softmax activation function.
[0007] In some possible implementations, the re-dividing the images in the second sample subset based on the visual concept into a common class data subset, a rare class data subset, a cross class data subset, and an unseen class data subset includes: S31, for each image in the second sample subset, generating a The similarity of visual concepts, is the number of categories, is the number of visual concepts per category specified; S32, determining whether half of all visual concepts of any image in the second sample subset belong to the common class and the other half belong to the rare class. If yes, the image is added to the cross-class data subset. If not, executing step S33; S33: Determine whether the coverage score of the visual concept most similar to any of the images is greater than a threshold value. If yes, go to step S34, if no, go to step S35; S34, calculating the similarity between the visual concept and any of the images, and when the similarity is greater than a threshold , then add any of the images to the common class data subset, if the similarity is less than the threshold , then any of the images is added to the unseen class data subset; S35, calculating the uniqueness score between the visual concept and any of the images, and when the uniqueness score is greater than a threshold , then add the image to the rare class data subset, when the uniqueness score is less than the threshold , end the process without marking the image.
[0008] As a second aspect of the present application, a system for detecting laser welding defects based on active learning is also provided, including: a data acquisition module, an active learning module, a data division module, a data adjustment module, a classification model training module and a defect judgment module; wherein the data acquisition module is used to acquire a first image as a sample data set, and divide the sample data set into a labeled first sample subset and an unlabeled second sample subset; wherein the first image is an image during the laser welding process; the active learning module is used to learn multiple visual concepts of different categories based on active learning and the first sample subset; the active learning module includes a feature vector unit, a similarity calculation unit and a binary classification unit; wherein the feature vector unit is used to perform a convolution operation on the first sample subset and output a feature vector of the first sample subset. ; Calculate each visual concept and feature vector similarity; based on the similarity, the images of the first sample subset are classified into two categories; the two categories include the presence of defects and the absence of defects; the data division module is used to re-divide the images in the second sample subset based on the visual concept, and divide them into common class data subsets, rare class data subsets, cross class data subsets and unseen class data subsets; the data adjustment module is used to remove the image data of the common class data subset and the rare class data subset from the second sample subset, and expand them into the first sample subset; return to the step active learning module until the preset condition is met; the preset condition is that the size of the common class data subset or the rare class data subset reaches a set threshold; the classification model training module is used to learn based on the images of the expanded first sample subset to establish a classification model for laser welding defects; the defect judgment module is used to obtain a second image, and judge whether the second image has defects based on the classification model; the second image is an image of the laser welding process to be judged.
[0009] In some possible implementations, the similarity calculation unit includes a first subunit and a second subunit; the first subunit is used to initialize the visual concept. When the visual concept is in the input feature vector When sliding, multiple feature vectors corresponding to each step size are generated , calculate the visual concept and each feature vector The second subunit is used to associate each visual concept with the feature vector The minimum distance between them is stored in the distance matrix Medium; Based on distance matrix Calculating the similarity includes: ; in, The distance matrix is calculated The minimum value in For similarity.
[0010] In some possible implementations, the binary classification unit includes a third subunit and a fourth subunit; the third subunit is used to output a size of Vector ; Wherein, m is the number of visual concepts in each category, c is the number of categories; the fourth subunit is used to classify the visual concepts based on the classification model and the vector The images of the first sample subset are classified, and the classification model includes a fully connected layer and a Softmax activation function.
[0011] In some possible implementations, the data partitioning module includes a similarity generation unit, a cross classification unit, a coverage score calculation unit, an unseen and common classification unit, and a rare classification unit; the similarity generation unit is used to generate a similarity score for each image in the second sample subset based on the active learning module. The similarity of visual concepts, is the number of categories, is the number of visual concepts in each category specified; the cross-classification unit is used to determine whether half of all visual concepts of any image in the second sample subset belong to the common class and the other half belong to the rare class. If so, the image is added to the cross-class data subset, otherwise it is transferred to the coverage score calculation unit; the coverage score calculation unit is used to determine whether the coverage score of the visual concept most similar to any image is greater than a threshold If yes, enter the unseen and common classification unit for execution, if no, enter the rare classification unit for execution; the unseen and common classification unit is used to calculate the similarity between the visual concept and any of the images, when the similarity is greater than a threshold , then add any of the images to the common class data subset, if the similarity is less than the threshold , then it means If the most similar image block is not similar to the trained visual concept, then any image is added to the unseen class data subset; the rare class classification unit is used to calculate the uniqueness score of the visual concept and any image. When the uniqueness score is greater than a threshold , then add the image to the rare class data subset, when the uniqueness score is less than the threshold , end the process without marking the image.
[0012] Beneficial effects: The data set is divided into a labeled sample set and an unlabeled sample set. Secondly, different categories of visual concepts are learned based on active learning. Images in the unlabeled sample set are classified based on visual concepts, and some classified images are incorporated into the labeled sample set. After multiple rounds of iterations, the labeled sample set is expanded, and the expanded labeled sample set is learned to establish a defect classification model; a classification model for whether there are defects is established by learning the new expanded labeled sample set; learning and detecting defects in the case of class imbalance is achieved.
[0013] Other advantages, objectives and features of the present application will be described in the following description to some extent, and will be apparent to those skilled in the art based on the following examination and study, or can be taught from the practice of the present application to some extent. The objectives and other advantages of the present application can be achieved and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain and illustrate the present application, but should not be construed as limiting the scope of protection of the present application.
[0015] Figure 1 is the system flow chart of this application; Figure 2 is the system structure diagram of this application; Among them: 1. Data acquisition module; 2. Active learning module; 3. Data division module; 4. Data adjustment module; 5. Classification model training module; 6. Defect judgment module. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0017] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0018] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0019] In the above description of the present application, the terms “first”, “second”, etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0020] like Figure 1 As shown, the present application discloses a method for detecting laser welding defects based on active learning, comprising the following steps: S1. Collect the first image as a sample data set, and divide the sample data set into a labeled first sample subset and an unlabeled second sample subset; wherein the first image is an image in the laser welding process; the first sample subset is a small data set with balanced categories, and the second sample subset is a large data set with unbalanced categories. Use a high-speed camera to record 10,000 frames per second of video for each item to be inspected on the production line, and generate a corresponding appearance image to be inspected for each frame of image , then preprocess the collected images and standardize them into the input corresponding to the model .
[0021] S2. Based on active learning and the first sample subset, learn multiple visual concepts of different categories.
[0022] In some embodiments, the learning of multiple visual concepts of different categories based on active learning and the first sample subset includes: S21, performing a convolution operation on the first sample subset, and outputting a feature vector of the first sample subset ; The convolution module performs convolution operations. The convolution module consists of four convolution layers and four pooling layers. The visual concept size of the convolution layer is 1x1. The convolution operation of each layer is as follows: ;
[0023] in, is a convolutional layer of visual concept size 1x1, is the maximum pooling layer, is the activation function, is the output of each layer; it is repeated 4 times in total, and the final output feature vector , the eigenvector It is the output of the convolution module feature maps, the feature map size is .
[0024] S22. Calculate each visual concept and feature vector In this embodiment, the calculation of each visual concept and the feature vector The similarity includes: S221, initializing the visual concept, when the visual concept is in the input feature vector When sliding, multiple feature vectors corresponding to each step size are generated , calculate the visual concept and each feature vector distance and determine the minimum distance; visual concepts in feature vectors When sliding over (the visual concept is smaller than the image, so it takes n moves to traverse the entire image), each move will correspond to a feature vector fv, and the minimum distance will be calculated once. ,in In this embodiment, the convolutional neural networks are all shallow networks, so , The size is set to 4; ; in, Multiply the values on the boundary of the eigenvector by a constant between 0 and 1. It is a visual concept, and its purpose is to keep the most important features of the target visual concept in the central part of the visual concept. is the L2 distance. is a global average pooling layer with an output size of h The average value of the matrix . Yes Return The minimum distance between S222, each visual concept and feature vector The minimum distance between them is stored in the distance matrix Medium; Based on distance matrix Calculating the similarity includes: ;in, The distance matrix is calculated The minimum value in for similarity; S23, based on the similarity, the images of the first sample subset are classified into two categories; the two categories include defects and no defects. In this embodiment, based on the similarity, the images of the first sample subset are classified into two categories, including: S231, based on the similarity, the output size is Vector ; Where m is the number of visual concepts in each category and c is the number of categories; S232, based on classification model and vector The images of the first sample subset are classified, and the classification model includes a fully connected layer and a Softmax activation function; active learning needs to generate the corresponding visual concept for each class according to the training data set, that is, the classification model is trained according to the labeled data set. Because the idea of transfer learning is borrowed, the parameters of the model in the active learning module are needed in the defect recognition module, so the active learning needs to be trained separately and the corresponding parameters are obtained.
[0025] S3. Re-divide the images in the second sample subset based on the visual concept into a common class data subset, a rare class data subset, a cross class data subset and an unseen class data subset.
[0026] In some possible implementations, the re-dividing the images in the second sample subset based on the visual concept into a common class data subset, a rare class data subset, a cross class data subset, and an unseen class data subset includes: S31, for each image in the second sample subset, generating a The similarity of visual concepts, is the number of categories, is the number of visual concepts of each category specified; after being trained, the active learning module can output the visual concept of each category corresponding to the unlabeled image in the second sample subset, and in the active learning module, after training with the labeled data set, each visual concept corresponding to each category has been fixed, and in S31, the similarity is the similarity between the image and each visual concept; S32, determine whether half of all visual concepts of any image in the second sample subset belong to the common class and the other half belong to the rare class. If yes, the image is added to the cross-class data subset. If not, proceed to step S33. In this process, a threshold x can be set for any image. Sort the similarities of the visual concepts from large to small, and take the first x visual concepts. If half of these x visual concepts are common and half are rare, the image needs to be manually judged and added to the cross-class data subset. Specifically, our defect detection is a binary classification. Assuming that each category contains 10 visual concepts, each image will have 20 visual concept similarities. On this basis, we set the threshold to 4, which means that we need to determine what category the top four visual concepts of each image similarity belong to. If two of these four visual concepts belong to the common class and two belong to the rare class, we will determine that this image needs to be added to the cross-class subset. S33: Determine whether the coverage score of the visual concept most similar to any of the images is greater than a threshold value. If yes, go to step S34, if no, go to step S35. The above description generates each image with The similarity of the visual concepts is calculated, and the maximum of these similarities is the most similar. The coverage score of the visual concept that is most similar to any of the images is calculated, including: ; in, Yes Category The number of images in the dataset, the category of the dataset is generally defined as uppercase C, then different categories in the dataset are represented by lowercase c, which can be understood as C={c1, c2, c3...cn}; for each image of the category , is a visual concept, if is the top 5% of similarity scores among all visual concepts of the image, then is 1; the coverage score is used to judge the similarity of a visual concept in all images of its category; S34, calculating the similarity between the visual concept and any of the images; determining the similarity between the visual concept and the unlabeled second sample subset, if it is greater than a threshold , then add any of the images to the common class data subset, if the similarity is less than the threshold , then it means If none of the most similar image patches is similar to the trained visual concepts, any of the images will be added to the unseen class data subset; S35, calculating the uniqueness score between the visual concept and any of the images, and when the uniqueness score is greater than a threshold , then add the image to the rare class data subset, when the uniqueness score is less than the threshold , the process ends without marking the image. The uniqueness score is used to determine whether a visual concept is unique to its category. The calculation method is as follows: ; in, is the set of visual concepts of category c, is the number of categories, if the visual concept is related to images of other categories The closer the distance is, the Set to 1, otherwise 0 (using similarity to calculate the distance between the two). It can be concluded that when a visual concept is unique only to this class, the uniqueness score is equal to 1.
[0027] S4, removing the image data of the common class data subset and the rare class data subset from the second sample subset and expanding them into the first sample subset; returning to step S2 until a preset condition is met. The preset condition is that the size of the common class data subset or the rare class data subset reaches a set threshold.
[0028] S5. Performing learning based on the expanded images of the first sample subset to establish a classification model for laser welding defects; The input is a labeled dataset , using the four convolutional layers and four pooling layers of the convolution module to output the intermediate vector , such as the formula: ; in, Represents the vector obtained after a convolution layer and a pooling layer; Getting the intermediate vector Finally, this module uses the classification module to identify the image and output the final result , as shown in the formula: ; in, is a fully connected layer, It is the activation function for binary classification; During the training process, in the first round of training, the present invention introduces parameters of the convolution module and the classification module in the active learning module to optimize the learning of the entire defect recognition module, so as to better learn the differences between images from the data set.
[0029] S6. Acquire a second image, and determine whether the second image has defects based on the classification model; the second image is an image of the laser welding process to be determined.
[0030] The data set is divided into a labeled sample set and an unlabeled sample set. Secondly, different categories of visual concepts are learned based on active learning. Images in the unlabeled sample set are classified based on visual concepts, and some classified images are incorporated into the labeled sample set. After multiple rounds of iterations, the labeled sample set is expanded, and the expanded labeled sample set is used to learn and establish a defect classification model; a classification model for whether there are defects is established by learning the new expanded labeled sample set; learning and detecting defects in the case of class imbalance is achieved.
[0031] In this embodiment, the parameters of the final visual concept are the parameters of the visual concept in the convolutional neural network.
[0032] As a second aspect of the present application, a system for detecting laser welding defects based on active learning is also provided, comprising: a data acquisition module 1, an active learning module 2, a data partitioning module 3, a data adjustment module 4, a classification model training module 5 and a defect judgment module 6; wherein the data acquisition module 1 is used to acquire a first image as a sample data set, and divide the sample data set into a labeled first sample subset and an unlabeled second sample subset; wherein the first image is an image in the laser welding process; the active learning module 2 is used to learn multiple visual concepts of different categories based on active learning and the first sample subset; the data partitioning module 3 is used to classify the second sample based on the visual concepts The images in this subset are re-divided into a common class data subset, a rare class data subset, a cross class data subset and an unseen class data subset; the data adjustment module 4 is used to remove the image data of the common class data subset and the rare class data subset from the second sample subset, and expand them into the first sample subset; return to the step active learning module until the preset conditions are met; the classification model training module 5 is used to learn based on the images of the expanded first sample subset to establish a classification model for laser welding defects; the defect judgment module 6 is used to obtain a second image and judge whether the second image has defects based on the classification model; the second image is an image of the laser welding process to be judged.
[0033] In some embodiments, the active learning module 2 includes a feature vector unit, a similarity calculation unit and a binary classification unit; wherein the feature vector unit is used to perform a convolution operation on the first sample subset and output a feature vector of the first sample subset. ; The similarity calculation unit is used to calculate each visual concept and feature vector The binary classification unit is used to perform binary classification on the images of the first sample subset based on the similarity; the binary classification includes the presence of defects and the absence of defects.
[0034] In some embodiments, the similarity calculation unit includes a first subunit and a second subunit; the first subunit is used to initialize the visual concept. When the visual concept is in the input feature vector When sliding, multiple feature vectors corresponding to each step size are generated , calculate the visual concept and each feature vector The second subunit is used to associate each visual concept with the feature vector The minimum distance between them is stored in the distance matrix Medium; Based on distance matrix Calculating the similarity includes: ; in, The distance matrix is calculated The minimum value in For similarity.
[0035] In some embodiments, the binary classification unit includes a third subunit and a fourth subunit; the third subunit is used to output a size of Vector ; Wherein, m is the number of visual concepts in each category, c is the number of categories; the fourth subunit is used to classify the visual concepts based on the classification model and the vector The images of the first sample subset are classified, and the classification model includes a fully connected layer and a Softmax activation function.
[0036] In some embodiments, the data partitioning module 3 includes a similarity generation unit, a cross classification unit, a coverage score calculation unit, an unseen and common classification unit, and a rare classification unit; the similarity generation unit is used to generate a similarity score for each image in the second sample subset based on the active learning module. The similarity of visual concepts, is the number of categories, is the number of visual concepts in each category specified; the cross-classification unit is used to determine whether half of all visual concepts of any image in the second sample subset belong to the common class and the other half belong to the rare class. If so, the image is added to the cross-class data subset, otherwise it is transferred to the coverage score calculation unit; the coverage score calculation unit is used to determine whether the coverage score of the visual concept most similar to any image is greater than a threshold If yes, enter the unseen and common classification unit for execution, if no, enter the rare classification unit for execution; the unseen and common classification unit is used to calculate the similarity between the visual concept and any of the images, when the similarity is greater than a threshold , then add any of the images to the common class data subset, if the similarity is less than the threshold , then it means If the most similar image block is not similar to the trained visual concept, then any image is added to the unseen class data subset; the rare class classification unit is used to calculate the uniqueness score of the visual concept and any image. When the uniqueness score is greater than a threshold , then add the image to the rare class data subset, when the uniqueness score is less than the threshold , end the process without marking the image.
[0037] Those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present application and to form different embodiments.
[0038] Those skilled in the art will appreciate that the description of each embodiment has its own emphasis, and for parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0039] Although the embodiments of the present application are described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present application, and such modifications and variations all fall within the scope defined by the attached claims. The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for detecting laser welding defects based on active learning, characterized in that: The steps include: S1. Collect a first image as a sample data set, and divide the sample data set into a labeled first sample subset and an unlabeled second sample subset; wherein the first image is an image in a laser welding process; S2. Based on active learning and the first sample subset, learn multiple visual concepts of different categories; perform a convolution operation on the first sample subset and output a feature vector of the first sample subset ; Calculate each visual concept and feature vector similarity; based on the similarity, the images of the first sample subset are classified into two categories; the two categories include defects and no defects; S3, re-dividing the images in the second sample subset based on the visual concept into a common class data subset, a rare class data subset, a cross class data subset and an unseen class data subset; S4, removing the image data of the common class data subset and the rare class data subset from the second sample subset, and expanding them into the first sample subset; returning to step S2 until a preset condition is met, wherein the preset condition is that the size of the common class data subset or the rare class data subset reaches a set threshold; S5. Performing learning based on the expanded images of the first sample subset to establish a classification model for laser welding defects; S6. Acquire a second image, and determine whether the second image has defects based on the classification model; the second image is an image of the laser welding process to be determined.
2. The method for detecting laser welding defects based on active learning according to claim 1, characterized in that: The calculation of each visual concept and feature vector Similarities include: S21, initialize the visual concept, when the visual concept is in the input feature vector When sliding, multiple feature vectors corresponding to each step size are generated , calculate the visual concept and each feature vector and determine the minimum distance; S22. Associate each visual concept with a feature vector The minimum distance between them is stored in the distance matrix Medium; Based on distance matrix Calculating the similarity includes: ; in, The distance matrix is calculated The minimum value in For similarity.
3. The method for detecting laser welding defects based on active learning according to claim 2, characterized in that: The performing binary classification on the images of the first sample subset based on the similarity comprises: Based on the similarity, the output size is Vector ; Where m is the number of visual concepts in each category and c is the number of categories; Based on classification model and vector The images of the first sample subset are classified, and the classification model includes a fully connected layer and a Softmax activation function.
4. The method for detecting laser welding defects based on active learning according to claim 3 is characterized in that: The re-dividing the images in the second sample subset based on the visual concept into a common class data subset, a rare class data subset, a cross class data subset and an unseen class data subset comprises: S31, for each image in the second sample subset, generating a The similarity of visual concepts, is the number of categories, is the number of visual concepts per category specified; S32, determining whether half of all visual concepts of any image in the second sample subset belong to the common class and the other half belong to the rare class. If yes, the image is added to the cross-class data subset. If not, executing step S33; S33: Determine whether the coverage score of the visual concept most similar to any of the images is greater than a threshold value. If yes, go to step S34, if no, go to step S35; S34, calculating the similarity between the visual concept and any of the images, and when the similarity is greater than a threshold , then add any of the images to the common class data subset, if the similarity is less than the threshold , then any of the images is added to the unseen class data subset; S35, calculating the uniqueness score between the visual concept and any of the images, and when the uniqueness score is greater than a threshold , then add the image to the rare class data subset, when the uniqueness score is less than the threshold , end the process without marking the image.
5. A system for detecting laser welding defects based on active learning, characterized in that: include: A data acquisition module, an active learning module, a data partitioning module, a data adjustment module, a classification model training module and a defect judgment module; wherein the data acquisition module is used to acquire a first image as a sample data set, and divide the sample data set into a labeled first sample subset and an unlabeled second sample subset; wherein the first image is an image in the laser welding process; the active learning module is used to learn multiple visual concepts of different categories based on active learning and the first sample subset; the active learning module includes a feature vector unit, a similarity calculation unit and a two-classification unit; wherein the feature vector unit is used to perform a convolution operation on the first sample subset and output a feature vector of the first sample subset ; Calculate each visual concept and feature vector similarity; based on the similarity, the images of the first sample subset are classified into two categories; the two categories include the presence of defects and the absence of defects; the data division module is used to re-divide the images in the second sample subset based on the visual concept, and divide them into common class data subsets, rare class data subsets, cross class data subsets and unseen class data subsets; the data adjustment module is used to remove the image data of the common class data subset and the rare class data subset from the second sample subset, and expand them into the first sample subset; return to the step active learning module until the preset condition is met; the preset condition is that the size of the common class data subset or the rare class data subset reaches a set threshold; the classification model training module is used to learn based on the images of the expanded first sample subset to establish a classification model for laser welding defects; the defect judgment module is used to obtain a second image, and judge whether the second image has defects based on the classification model; the second image is an image of the laser welding process to be judged.
6. The system for detecting laser welding defects based on active learning according to claim 5, characterized in that: The similarity calculation unit includes a first subunit and a second subunit; the first subunit is used to initialize the visual concept. When sliding, multiple feature vectors corresponding to each step size are generated , calculate the visual concept and each feature vector The second subunit is used to associate each visual concept with the feature vector The minimum distance between them is stored in the distance matrix Medium; Based on distance matrix Calculating the similarity includes: ; in, The distance matrix is calculated The minimum value in For similarity.
7. The system for detecting laser welding defects based on active learning according to claim 6, characterized in that: The two-classification unit includes a third subunit and a fourth subunit; the third subunit is used to output a size based on the similarity. Vector ; Wherein, m is the number of visual concepts in each category, c is the number of categories; the fourth subunit is used to classify the visual concepts based on the classification model and the vector The images of the first sample subset are classified, and the classification model includes a fully connected layer and a Softmax activation function.
8. The system for detecting laser welding defects based on active learning according to claim 7, characterized in that: The data partitioning module includes a similarity generation unit, a cross classification unit, a coverage score calculation unit, an unseen and common classification unit, and a rare classification unit; the similarity generation unit is used to generate a similarity score for each image in the second sample subset based on the active learning module. The similarity of visual concepts, is the number of categories, is the number of visual concepts in each category specified; the cross-classification unit is used to determine whether half of all visual concepts of any image in the second sample subset belong to the common class and the other half belong to the rare class. If so, the image is added to the cross-class data subset, otherwise it is transferred to the coverage score calculation unit; the coverage score calculation unit is used to determine whether the coverage score of the visual concept most similar to any image is greater than a threshold If yes, enter the unseen and common classification unit for execution, if no, enter the rare classification unit for execution; the unseen and common classification unit is used to calculate the similarity between the visual concept and any of the images, when the similarity is greater than a threshold , then add any of the images to the common class data subset, if the similarity is less than the threshold , then any of the images is added to the unseen class data subset; The rare class classification unit is used to calculate the uniqueness score between the visual concept and any of the images. When the uniqueness score is greater than a threshold , then add the image to the rare class data subset, when the uniqueness score is less than the threshold , end the process without marking the image.
Citation Information
Patent Citations
Defect recognition method based on active learning
CN110598753A
Data labeling method for industrial product surface defect detection
CN116797849A
Welding defect detection method, device and equipment, storage medium and program product
CN119693312A
A method for recognizing an object in an image using features vectors of an encoding neural network
EP3754548A1
Machine-in-the-loop, image-to-video computer vision bootstrapping
TW201941078A