A surface defect detection method, system and device

By integrating the MAML algorithm and the DETR network into the MD network algorithm and combining it with LSTM layers, a general surface defect detection platform is constructed, which solves the problem of detection accuracy under small sample size and achieves surface defect detection with high precision and generalization ability.

CN117291898BActive Publication Date: 2026-03-27SICHUAN UNIVERSITY OF SCIENCE AND ENGINEERING
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-11
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing deep learning surface defect detection methods are insufficient in practical applications due to the small sample size, which makes it difficult to meet detection requirements and results in inadequate detection accuracy.

Method used

The MD network algorithm, which integrates the MAML algorithm based on meta-learning and the DETR network algorithm, and combines it with the LSTM layer of the Long Short-Term Memory network, is used to fine-tune the network parameters through a human-computer interaction interface to build a general surface defect detection platform. The detection accuracy is improved by using small sample training.

Benefits of technology

With a small sample size, the accuracy and generalization ability of surface defect detection are improved, enabling high-precision detection of new targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117291898B_ABST
    Figure CN117291898B_ABST
Patent Text Reader

Abstract

The application discloses a surface defect detection method, system and device, and the method comprises the following steps: acquiring an industrial surface defect dataset; constructing an MD network algorithm model by fusing an MAML algorithm based on a meta-learning method and a DETR network algorithm; training the MD network algorithm model by using the industrial surface defect dataset; constructing a general surface defect detection platform according to the trained MD network algorithm model and a long short-term memory network; acquiring a surface defect image sample to be detected; and performing surface defect detection by using the general surface defect detection platform; when the defect detection is correct, updating the industrial surface defect dataset by using the surface defect image sample and the corresponding defect detection result; and when the defect detection is incorrect, calculating a loss function by using a man-machine interactive interface, and adjusting the general surface defect detection platform. The application can improve the accuracy of surface defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of defect detection, in particular to a surface defect detection method, system and device. BACKGROUND

[0002] In industrial production, surface defect detection is an important link to ensure product quality and production safety in engineering manufacturing and industrial production, and has great help for surface remanufacturing and repair. In the industrial production process, due to external factor interference, raw material characteristics, production line aging and other problems, the produced products exist surface defects such as scratches, rust, damage, pits, missing, etc. Visual defect detection technology combined with image processing algorithm is widely used in various industrial scenes with the outstanding advantages of low cost, non-contact, non-damage and safe and reliable. Early algorithms only assess defects through image processing and feature extraction methods, using threshold, list or manual form to judge the existence of defects. This method has poor adaptability, low efficiency and no intelligent evaluation results.

[0003] In recent years, a surface defect detection method combining machine vision and machine learning has been proposed, which replaces the human brain to judge the existence of defects. Among them, the surface defect detection based on deep learning has become the mainstream method of current surface defect detection with a series of advantages such as high detection accuracy and fast detection speed. However, this method also has a big problem, that is, the good performance of deep learning is based on a large number of sample training. In actual engineering application, this element is difficult to meet, so the small sample problem in surface defect detection has gradually become the key problem whether this kind of detection method can be applied. SUMMARY

[0004] The purpose of the present application is to provide a surface defect detection method, system and device, which solves the problem of small sample quantity in industrial surface defect detection and can improve the accuracy of surface defect detection.

[0005] To achieve the above purpose, the present application provides the following scheme:

[0006] A surface defect detection method, comprising:

[0007] obtaining an industrial surface defect data set; the industrial surface defect data set includes surface defect image samples that have been labeled with defect types;

[0008] constructing an MD network algorithm model that combines MAML algorithm based on meta-learning method and DETR network algorithm; the MD network algorithm model is used for surface defect detection;

[0009] training the MD network algorithm model using the industrial surface defect data set;

[0010] According to the trained MD network algorithm model and the long short-term memory network, a general surface defect detection platform is constructed;

[0011] A surface defect image sample to be detected is acquired, and the general surface defect detection platform is used for surface defect detection;

[0012] When the defect detection is correct, the industrial surface defect data set is updated by using the surface defect image sample and the corresponding defect detection result;

[0013] When the defect detection is incorrect, the loss function is calculated through the man-machine interactive interface, and the general surface defect detection platform is adjusted.

[0014] Optionally, the MD network algorithm model is trained by using the industrial surface defect data set, and specifically includes:

[0015] The MD network algorithm model is forward propagated and backward propagated by using a single training task;

[0016] In the process of backward propagation, the gradient of the MD network algorithm model is calculated according to the loss function of the predicted value and the true value of the MD network algorithm model, and the parameter θ' of the MD network algorithm model is updated along the gradient descent direction, to complete a one-time inner loop gradient descent process;

[0017] The MD network algorithm model is gradient descended by using multiple training tasks, and the loss function values on all training tasks are superimposed;

[0018] According to the parameter θ', the gradient is comprehensively calculated and the initial parameter θ of the MD network algorithm model is updated, to complete a one-time outer loop gradient descent process;

[0019] And the step of forward propagating and backward propagating the MD network algorithm model by using a single training task is returned, until the parameter θ converges.

[0020] Optionally, when the defect detection is incorrect, the loss function is calculated through the man-machine interactive interface, and the general surface defect detection platform is adjusted, and specifically includes:

[0021] The loss function of the general surface defect detection platform is determined;

[0022] The loss value of the loss function is back propagated to the long short-term memory network according to the size, and the parameter is adjusted;

[0023] The MD network algorithm model is backward propagated according to the size of the loss value of the loss function.

[0024] Optionally, the loss function of the general surface defect detection platform is determined, and specifically includes:

[0025] LossValue = Loss(output, y);

[0026] Wherein, LossValue is the loss value of the loss function, output is the output result of the surface defect detection platform, y is the user feedback result, and the Loss() function is used to calculate the difference between the two.

[0027] A surface defect detection system comprises:

[0028] A data set acquisition module is configured to acquire an industrial surface defect data set, wherein the industrial surface defect data set comprises surface defect image samples with annotated defect types.

[0029] An MD network algorithm model construction module is configured to construct an MD network algorithm model by fusing a MAML algorithm based on a meta-learning method and a DETR network algorithm, wherein the MD network algorithm model is used for surface defect detection.

[0030] An MD network algorithm model training module is configured to train the MD network algorithm model by using the industrial surface defect data set.

[0031] A general surface defect detection platform construction module is configured to construct a general surface defect detection platform based on the trained MD network algorithm model and a long short-term memory network.

[0032] A surface defect detection module is configured to acquire surface defect image samples to be detected and perform surface defect detection by using the general surface defect detection platform.

[0033] A data set updating module is configured to update the industrial surface defect data set by using the surface defect image samples and corresponding defect detection results when the defect detection is correct.

[0034] A platform fine-tuning module is configured to calculate a loss function by using a man-machine interactive interface and adjust the general surface defect detection platform when the defect detection is incorrect.

[0035] An electronic device comprises a memory and a processor, wherein the memory is configured to store a computer program, and the processor is configured to run the computer program to make the electronic device execute the surface defect detection method.

[0036] Optionally, the memory is a computer readable storage medium.

[0037] According to the embodiments of the present application, the following technical effects are provided:

[0038] The surface defect detection method, system and device provided by the application are based on the meta-learning theory, a new target detection network algorithm (MD network algorithm) is proposed by fusing the MAML algorithm and the DETR target detection network algorithm, the algorithm can maintain high generalization while only using small samples to train the network weight, can identify various common surface defects in industrial production, but the detection precision is low. Therefore, the platform increases the LSTM layer before the prediction layer of the MD algorithm, fine-tunes the network parameters when the model needs to detect new targets, thereby improving the surface defect detection precision, and the universal detection platform improves the network algorithm performance under the condition of small sample size to a certain extent. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the drawings needed in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0040] Figure 1 A surface defect detection method flowchart provided by the application;

[0041] Figure 2 A schematic diagram of the overall training of a surface defect detection method;

[0042] Figure 3 An MD network algorithm parameter update structure diagram;

[0043] Figure 4 A single task training schematic diagram;

[0044] Figure 5 A human-computer interaction interface schematic diagram;

[0045] Figure 6 A universal surface defect detection platform adjustment schematic diagram;

[0046] Figure 7 An industrial surface defect data set update schematic diagram;

[0047] Figure 8 An MD network algorithm model training schematic diagram;

[0048] Figure 9 A universal surface defect detection platform structure schematic diagram;

[0049] Figure 10 A back propagation schematic diagram. DETAILED DESCRIPTION

[0050] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0051] The present application aims to provide a surface defect detection method, system and device, which can improve the accuracy of surface defect detection.

[0052] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.

[0053] As shown in Figure 1 A surface defect detection method provided by the present application comprises:

[0054] S101, obtaining an industrial surface defect data set; the industrial surface defect data set comprises surface defect image samples that have been labeled with defect types;

[0055] S102, constructing an MD network algorithm model that combines a MAML algorithm based on a meta-learning method and a DETR network algorithm; the MD network algorithm model is used for surface defect detection;

[0056] S103, training the MD network algorithm model using the industrial surface defect data set.

[0057] S103 specifically comprises:

[0058] The MD network algorithm model is subjected to forward propagation and backward propagation using a single training task;

[0059] In the process of backward propagation, the gradient of the MD network algorithm model is calculated according to the Loss function of the predicted value and the true value of the MD network algorithm model, and the parameter θ' of the MD network algorithm model is updated in the gradient descent direction, completing a one-time inner loop gradient descent process.

[0060] The MD network algorithm model is subjected to a gradient descent process using multiple training tasks, and the Loss function values on all training tasks are superimposed.

[0061] According to the parameter θ', the gradient is calculated and the initial parameter θ of the MD network algorithm model is updated, completing a one-time outer loop gradient descent process.

[0062] And returning to the step of using a single training task to perform forward propagation and backward propagation on the MD network algorithm model until the parameter θ converges.

[0063] The MD network algorithm mainly includes updating parameters by increasing multiple gradient descents in the process of multi-task learning. Figure 3 and Figure 8 As shown in the figure, the network is first optimized in the internal network weight, then the loss corresponding to each gradient is added and averaged according to different weights, and then a gradient descent is performed. Through the loss function in the multi-step gradient adjustment, the weight parameters obtained by the model training can focus more on the feature information of the target, even in the case of learning a small number of sample categories, when a new task is encountered, the sensitivity to the target can be maintained in the new task, so that the model has better generalization.

[0064] The MD algorithm is a MAML algorithm based on the meta-learning idea and the DETR target detection network algorithm. The MD algorithm is trained by adding the MAML algorithm during the training of the DETR target detection network algorithm. Specifically, in the small sample learning task, the network model is trained in the classification N-way, K-shot task (that is, the target categories trained have N, and N can include all common defects in the industrial field), and each category has K samples, and the value of K is generally 3 or 5, that is, a small sample). In the training process, each new task training is performed through the inner loop and outer loop twice gradient descent method shown in formula (1) and (2) in the figure, so that the model can maintain the sensitivity to the target in the multi-task and small sample case, and the model has high generalization. Figure 8

[0065] S104, a general surface defect detection platform is constructed according to the trained MD network algorithm model and the long short-term memory network.

[0066] The small sample industrial product surface defect general detection platform based on the meta-learning method, the surface defect general detection platform in which the MD network algorithm and the LSTM network layer are fused, the network structure mainly includes adding an LSTM layer in front of the prediction layer (FFN layer) of the MD network algorithm, and the LSTM layer is a long short-term memory network. The network controls the memory of the network through memory cells and state cells, wherein the state of the above-mentioned cells is protected and controlled through the forgetting gate, the input gate and the output gate, respectively, so that the network algorithm has the functions of memory and forgetting. The single task training schematic diagram of the general detection platform algorithm is shown in the figure. Figure 4

[0067] The surface defect general detection platform in which the MD network algorithm and the LSTM network layer are fused, and the platform algorithm structure is shown in the figure. An LSTM layer is added in front of the final prediction layer (FFN layer) of the detection platform, as shown in the figure. Figure 9 Figure Eight ​​​As shown in the network, the tensor data is extracted into a feature vector, and then the target detection frame is predicted through an LSTM layer. Through subsequent training of the network parameters of the LSTM layer, higher detection accuracy can be achieved for new detection targets.

[0068] The network parameter fine-tuning method of the man-machine interactive interface, after the network parameter training is completed, the user inputs a small amount of new class detection samples for detection, and the network (training completed) outputs the detection result, and the user judges whether the detection is accurate through the interface. If accurate, the next detection result image is displayed, and if not accurate, the user feeds back the detection error detection frame. According to the user return result, the general surface defect detection platform calculates the loss function, and the network model is back propagated, so as to achieve the purpose of improving the precision.

[0069] S105, obtaining a surface defect image sample to be detected; and using a general surface defect detection platform to detect surface defects.

[0070] S106, when the defect detection is correct, updating the industrial surface defect data set by using the surface defect image sample and the corresponding defect detection result.

[0071] The data set updating is a data recycling expansion algorithm. After the network correctly detects a new detection target, the successfully detected data is recycled, the original data set is expanded, and the MD network is retrained using the expanded data to increase the model generalization and realize knowledge accumulation.

[0072] The general detection platform for small sample industrial product surface defects based on the meta-learning method, the data recycling expansion algorithm, and the method as shown in Figure 7 The method mainly includes recycling the successfully recognized data to the data set to expand the original data set after recognizing a new detection target, and realizing the knowledge accumulation process similar to the human growth process.

[0073] S107, when the defect detection is incorrect, calculating a loss function through the man-machine interactive interface method, and adjusting the general surface defect detection platform.

[0074] The general detection platform for small sample industrial product surface defects based on the meta-learning method, the network parameter fine-tuning method of the man-machine interactive interface Figure 5 The method mainly includes feeding back the recognition result through the man-machine interactive interface when the network detects a new kind of defect to be recognized, and calculating the network loss function value (such as Figure 6The loss value is determined according to the loss function, and the loss value is back propagated to the long short-term memory network, and the parameters are adjusted.

[0075] As shown in Figure 2 As shown in the figure, the training method of the application is divided into two stages of initial training and fine-tuning training. First, the general surface defect detection platform uses a large number of commonly used surface defect image samples of industrial products to train the platform parameters, and obtains a highly generalized network parameter. Secondly, when the user needs to identify the sample to be detected, the network parameter is trained again (fine-tuning training) through a small amount of sample data input by the user, so as to improve the detection accuracy of the platform to the sample to be detected. Among them, the purpose of the initial training stage is to train the model parameters through the N-way, K-shot task (i.e. multi-class, small sample task), so as to obtain a model with low precision but good generalization performance on each task; the fine-tuning training stage is to fine-tune the model through the new detection class (small sample) and the human-computer interaction interface feedback, so as to improve the detection accuracy of the model on the new class and realize the purpose of small sample training.

[0076] The initial training of the platform algorithm model is carried out using a large amount of common industrial surface defect data (multi-class, small sample), and the fine-tuning training of the platform is carried out using new samples to be detected. Among them, the MD network algorithm is an MD network algorithm based on the fusion of MAML algorithm and DETR network algorithm; the overall algorithm of the fusion of MD network algorithm and LSTM network layer in the fine-tuning stage constitutes the general surface defect detection platform; in the fine-tuning training stage of the algorithm, the loss function is calculated through the method of human-computer interaction interface, and the MD network parameters and LSTM network parameters are fine-tuned respectively; finally, in order to realize the continuous similar "knowledge accumulation process" of the model, the basic data is expanded through data recycling and expansion algorithm after detection.

[0077] S107 specifically includes:

[0078] Determine the loss function of the general surface defect detection platform.

[0079] According to the size of the loss value of the loss function, the loss value is back propagated to the long short-term memory network, and the parameters are adjusted.

[0080] According to the size of the loss value of the loss function, the loss value is back propagated to the long short-term memory network, and the parameters are adjusted.

[0081] The determination of the loss function of the general surface defect detection platform specifically includes:

[0082] LossValue = Loss (output, y);

[0083] Wherein, LossValue is the loss value of the loss function, output is the output result of the surface defect detection platform, y is the user feedback result, and the function of Loss() is to calculate the difference between the two.

[0084] The following is described by specific embodiments:

[0085] Step one, collect common multi-class, small sample size surface defect image data in industrial products to form a database, specifically: collect N categories (multi-class) image data such as surface corrosion, scratches, rust, dents, and stains, mark the surface defects in each category in the image defect part, mark K samples (K is usually 3 or 5) in each category as a support set, and at the same time, mark the samples with the above surface defects but not marked as a query set, to jointly build training tasks 1 to n (for example: Figure 4 Task 1 is shown).

[0086] Step two, send each of the above tasks into the MD algorithm (MAML algorithm + DETR network model algorithm) for training, and train the model through Figure Seven The inner loop process is shown, at this time the MD model network parameters are not updated. Specifically, as shown in Figure 3 Use the tasks 1 to n built in step one to train the MD network algorithm, and the training process is as shown in Figure 4 , specifically:

[0087] (1) The MD network algorithm reads image data from the query level and converts the image data into 800x800x3 format, and sends it to the Resnet50 feature extraction network layer for feature extraction. In this process, the input data is first upgraded to a 400x400x64 feature vector through a 7x7x64 convolution kernel with a step of 2, and then a maximum pooling layer with a step of 2 is used to change it to a 200x200x64 feature vector. Then, as shown in the above process, pass through 4 convolution layers in turn, and finally output a 25x25x2048 feature vector from the Resnet50 feature extraction network layer.

[0088] (2) The above 25x25x2048 feature vector enters the Encoder part of the Transformer to start the encoding process. Since the number of channels of the network is too large (2048), it will directly cause insufficient memory. Therefore, a 1x1 convolution kernel is used to compress the channels, and the compressed channels are 256, which is the feature length used by the Transformer. Thus, a 25x25x256 feature matrix is obtained.

[0089] (3) The weights of the Resnet50 feature extraction network layer and the Encoder layer of the Transformer in the query set in the above (1) and (2) are shared with the support set, and the labeled surface defect images in the support set are subjected to the feature extraction and encoding process of the above (1) and (2) to obtain a 1x1x256 feature matrix.

[0090] (4) The 1x1x256 feature matrix extracted from the above support set and the 25x25x256 feature matrix extracted from the query set are subjected to feature fusion, i.e. corresponding multiplication in each dimension of the feature, and finally a 25x25x256 feature fusion vector is obtained.

[0091] (5) The feature matrix after the above feature fusion is tiled and converted in the height and width dimensions to obtain a 625x256 matrix, which is then input into the Decoder part of the Transformer to start the decoding process. In the decoder part, a learnable query vector q (a [100, 256] matrix) is used to dot multiply the enhanced effective feature layer, i.e. the above 625x256 matrix, to obtain the prediction result.

[0092] Step three, after completing the task 1 to task n in step two above Figure 8 , the outer loop process in Figure 8 is performed, and the MD model network parameters are updated, and finally the inner loop and outer loop twice gradient descent methods shown in Figure 8 and formulas (1), (2) are used to make the model sensitive to the target in the case of multi-task and few samples. Specifically:

[0093] (1) The MD network algorithm model is subjected to forward propagation and backward propagation on a single task, and in the process of backward propagation, the model gradient is calculated according to the Loss function (i.e. loss function) of the model prediction value and the true value, and the model parameter θ' is updated in the gradient descent direction, completing one inner loop gradient descent process.

[0094] (2) The MD network algorithm model is subjected to the above gradient descent process through multiple tasks, and the Loss function (loss function) values calculated on all tasks are superimposed, and the network MD network algorithm initial parameter θ is updated by comprehensively calculating the gradient and using the above obtained parameter θ', completing one outer loop gradient descent process.

[0095] (3) Repeat the above process until the model parameters converge to obtain a model parameter with high generalization.

[0096] The fine-tuning training process is verified by the user feedback error detection frame through the man-machine interface. When detecting the defects of the new class sample to be detected, the following process needs to be passed through:

[0097] Step four, the user prepares a small amount of images with surface defects as a query set, and prepares 3-5 images with surface defects marked as a support set. And input the new class sample to be detected into the general surface defect detection platform. The platform detects the image input by the user through the model parameter with strong generalization obtained in step three, and outputs the detection result to the man-machine interface. Specifically:

[0098] (1) The above user input support set and query set images are constructed as fine-tuning tasks, such as steps two and Figure Three Resnet50 layers are used for feature extraction, the Encoder part of the Transformer is used for encoding process, the Decoder part of the Transformer is used for decoding process and outputs the prediction result to the LSTM network layer.

[0099] (2) The input of the LSTM network layer, that is, the 625x256 matrix is stretched and reconstructed into a one-dimensional array containing 160000 elements, as shown in Figure 9 After passing through the LSTM network layer, the one-dimensional array is sent to the FFN layer for full connection and parameter prediction.

[0100] (3) The FFN layer compresses the 160000 elements into 6 parameters as the final output of the prediction result through full connection. The 6 parameters are: C, S, X, Y, L, and W. C represents the defect type detected by the detection frame (C has only two values in the platform, i.e. background or defect); S represents the confidence score of the defect type detected by the detection frame; X represents the corresponding horizontal axis coordinate of the center point of the detection frame on the image; Y represents the corresponding vertical axis coordinate of the center point of the detection frame on the image; L represents the length of the detection frame; W represents the width of the detection frame.

[0101] (4) The LSTM network layer outputs the above 6 parameters to the man-machine interface in turn, and displays the specific position of the detection frame on the interface through the above parameters. (As shown in Figure 5

[0102] Step six, after displaying the detection frame on the man-machine interface, the user checks the output result. If the detection is correct, the next image detection is performed. If the detection is incorrect, the user inputs the detection frame number of the detection error through the interface as shown in Figure 5

[0103] ​​Step 7: The network model uses the feedback results from a small number of novel sample tests input by the user to perform backpropagation on the MD network algorithm model to adjust its parameters; then, the memory function of the LSTM network is adjusted. Specifically:

[0104] (1) The Loss function is calculated using the formula shown in equation (3). Here, output in the Loss() function is the output result of the general detection platform, and y is the user feedback result. The function of Loss() is to calculate the difference between the two.

[0105] LossValue=Loss(output,y) Formula (3)

[0106] (2) The parameters are first backpropagated to the LSTM network layer by adjusting the LossValue. Specifically, the memory of the network is adjusted by changing the weights of the memory gates, thus altering the output state. A small LossValue causes the memory gate weights to approach 1, selecting to remember the output features; a large LossValue causes the memory gate weights to approach 0, selecting to forget the output features. This improves the network's ability to remember features of detected error boxes.

[0107] (3) Secondly, based on the magnitude of the LossValue, the MD network parameters are backpropagated to improve the model's sensitivity to new types of test samples. That is, as... Figure 4 As shown: When backpropagating to the Decoder part of the Transformer in the MD network, as shown in equation (4) and Figure 10 As shown (where the black arrows represent forward propagation and the red arrows represent backward propagation, w) 13 w 23 w' represents the forward propagation weights. 13 w' 23 The forward propagation weights are used to update the weight parameters of each neuron node sequentially. Similarly, the same method is used to backpropagate the Encoder part of the Transformer and the ResNet50 feature extraction layer, adjusting the weight parameters of each neuron node. This improves the network model's sensitivity to new types of samples.

[0108] Step 8: After the feedback from n images is completed, the model fine-tuning is finished. At this point, you can directly import the images to be inspected for large-scale detection.

[0109] The data retrieval and augmentation algorithm, after performing defect detection on new targets, re-recovers successfully detected images into the dataset. The retrieval process is as follows:

[0110] Step nine, read the image of successful detection, and record the new target species name, defect location coordinates, and convert them into corresponding formats and store them in the database. Specifically:

[0111] (1) Read the detected image, convert the image format to jpg format and save it to the database.

[0112] (2) Read the category and location of the detection frame in the detected image, that is, the network output parameters C, X, Y, L and W in step four.

[0113] (3) Convert the read parameter C to txt format as the new category name, and convert the position parameters X, Y, L and W to json format as label data, and save them to the database.

[0114] Corresponding to the above method, the present application also provides a surface defect detection system, comprising:

[0115] A data set acquisition module is configured to acquire an industrial surface defect data set; the industrial surface defect data set includes surface defect image samples with annotated defect types.

[0116] An MD network algorithm model construction module is configured to construct an MD network algorithm model that combines a MAML algorithm based on a meta-learning method and a DETR network algorithm; the MD network algorithm model is used for surface defect detection.

[0117] An MD network algorithm model training module is configured to train the MD network algorithm model using the industrial surface defect data set.

[0118] A general surface defect detection platform construction module is configured to construct a general surface defect detection platform based on the trained MD network algorithm model and a long short-term memory network.

[0119] A surface defect detection module is configured to acquire surface defect image samples to be detected; and use the general surface defect detection platform to perform surface defect detection.

[0120] A data set updating module is configured to update the industrial surface defect data set using the surface defect image samples and the corresponding defect detection results when the defect detection is correct.

[0121] A platform fine-tuning module is configured to calculate a loss function through a human-computer interaction interface when the defect detection is incorrect, and adjust the general surface defect detection platform.

[0122] In order to implement the method corresponding to the above-mentioned embodiments to achieve the corresponding functions and technical effects, the application further provides an electronic device comprising a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to make the electronic device execute the surface defect detection method.

[0123] The memory is a computer readable storage medium.

[0124] Based on the above description, the technical scheme of the application or the part of the prior art that essentially contributes or the part of the technical scheme can be embodied in the form of a software product, the computer software product is stored in a storage medium, and includes a plurality of instructions for making a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the embodiments of the application. The foregoing computer storage medium includes a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk and various program code storage media.

[0125] The embodiments in the specification are described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts of each embodiment can be referred to each other. For the system disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part.

[0126] The principles and implementation modes of the application are described by using specific examples in this paper. The above embodiment is only used to help understand the method of the application and its core idea; at the same time, for those skilled in the art, according to the idea of the application, the specific implementation mode and application range will be changed. In conclusion, the content of the specification should not be understood as a limitation of the application.

Claims

1. A method for detecting surface defects, characterized in that, include: Obtain industrial surface defect datasets; The industrial surface defect dataset includes: surface defect image samples with labeled defect types; An MD network algorithm model is constructed that integrates the MAML algorithm based on meta-learning methods and the DETR network algorithm; the MD network algorithm model is used for surface defect detection. Train the MD network algorithm model using an industrial surface defect dataset; A general surface defect detection platform is constructed based on the trained MD network algorithm model and long short-term memory network. Acquire surface defect image samples to be detected; and perform surface defect detection using a general surface defect detection platform; When the defect detection is correct, the industrial surface defect dataset is updated using surface defect image samples and the corresponding defect detection results. When a defect detection error occurs, the loss function is calculated through a human-computer interaction interface, and the general surface defect detection platform is adjusted accordingly. The method of training the MD network algorithm model using an industrial surface defect dataset specifically includes: The forward and backward propagation of the MD network algorithm model is performed using a single training task. During backpropagation, the gradient of the MD network algorithm model is calculated based on the loss function between the predicted and actual values, and the parameters of the MD network algorithm model are updated along the gradient descent direction. This completes one inner loop gradient descent process. Gradient descent is performed on the MD network algorithm model using multiple training tasks, and the loss function values ​​on all training tasks are summed. According to parameters The gradient is calculated and the initial parameters of the MD network algorithm model are updated. This completes one outer loop gradient descent process. Then return to the steps of performing forward and backward propagation on the MD network algorithm model using a single training task, until the parameters are... convergence.

2. The surface defect detection method according to claim 1, characterized in that, When a defect detection error occurs, a loss function is calculated through a human-computer interaction interface, and adjustments are made to the general surface defect detection platform. Specifically, this includes: Determine the loss function for a general surface defect detection platform; The loss value of the loss function is backpropagated to the long short-term memory network, and the parameters are adjusted accordingly. The MD network algorithm model is backpropagated based on the magnitude of the loss value of the loss function.

3. The surface defect detection method according to claim 2, characterized in that, The loss function for determining the general surface defect detection platform specifically includes: ; in, LossValue denoted as the loss value of the loss function, output is the output result of the surface defect detection platform, and y is the user feedback result. Loss The () function is used to calculate the difference between the two.

4. A surface defect detection system for implementing the surface defect detection method according to any one of claims 1-3, characterized in that, include: The dataset acquisition module is used to acquire industrial surface defect datasets. The industrial surface defect dataset includes: surface defect image samples with labeled defect types; The MD network algorithm model construction module is used to construct an MD network algorithm model that integrates the MAML algorithm based on meta-learning methods and the DETR network algorithm; the MD network algorithm model is used for surface defect detection. The MD network algorithm model training module is used to train the MD network algorithm model using an industrial surface defect dataset. A general surface defect detection platform construction module is used to build a general surface defect detection platform based on a trained MD network algorithm model and a long short-term memory network. The surface defect detection module is used to acquire image samples of surface defects to be detected and to perform surface defect detection using a general surface defect detection platform. The dataset update module is used to update the industrial surface defect dataset with surface defect image samples and corresponding defect detection results when the defect detection is correct. The platform fine-tuning module is used to calculate the loss function through a human-computer interaction interface when defect detection errors occur, and to adjust the general surface defect detection platform accordingly.

5. An electronic device, characterized in that, The device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform a surface defect detection method according to any one of claims 1 to 3.

6. The electronic device according to claim 5, characterized in that, The memory is a computer-readable storage medium.

Citation Information

Patent Citations

  • Network model training method, image recognition method and related devices

    CN114329027A

  • Small sample panel defect detection method, system and equipment and storage medium

    CN116433651A