Defect detection method and apparatus, device, and storage medium
By introducing channel division, global convolutional network and fast convolutional network modules into the defect detection model, the problem of insufficient acquisition of global context information is solved, and the defect detection accuracy and model efficiency are improved.
Patent Information
- Application Number
- PCT/CN2024/097803
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-19
- Filing Date
- 2024-06-06
- Publication Date
- 2025-07-24
AI Technical Summary
The prior art cannot effectively obtain global context information, resulting in low defect detection accuracy.
The trained defect detection model is adopted, which includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier. By combining the global convolutional network module and a fast convolutional network module, the filter receptive field is expanded, the semantic correlation is enhanced, and the model parameter amount is reduced.
By obtaining complete global context information, the defect detection accuracy is improved, the model parameter amount and computing resource consumption are reduced, and the model convergence speed and spatial position information are enhanced.
Smart Images

Figure CN2024097803_24072025_PF_FP_ABST
Abstract
Description
Defect detection method, device, equipment and storage medium Technical Field
[0001] The present application relates to the technical field of defect detection and provides a defect detection method, apparatus, device and storage medium. Background Art
[0002] Existing object detection tasks often encounter significant scale differences between the target and the scene, high similarity between different target categories, and significant morphological variations between targets of the same category. These issues often lead to inconsistent results and inaccurate positioning of targets in different scenarios. Furthermore, due to the limited receptive field of the convolutional kernels in the feature extraction network, the feature extraction network is unable to effectively capture global contextual information. In recent years, to obtain greater local information, multiple different convolutional kernel sizes have been commonly designed in feature extraction networks, introducing additional parameters and increasing computational overhead.
[0003] Therefore, how to obtain global context information to improve defect detection accuracy is an urgent problem to be solved.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide a defect detection method, apparatus, device, and storage medium for solving the problem of low defect detection accuracy due to the inability to obtain global context information.
[0006] In one aspect, a defect detection method is provided, the method comprising:
[0007] Obtain the original defect image through the image acquisition device;
[0008] The original defect image is input into a trained defect detection model for defect detection, and a predicted defect detection result is output; wherein the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier.
[0009] The beneficial effects of the present application are: since the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier, in the present application, the combined global convolutional network module and the fast convolutional network module can be used to replace the standard convolution structure to expand the filter receptive field, enhance semantic relevance, and reduce the number of model parameters, thereby improving the defect detection accuracy by obtaining complete global context information.
[0010] In one implementation, the step of inputting the original defect image into a trained defect detection model for defect detection and outputting a predicted defect detection result includes:
[0011] According to the channel division module, the original defect image is divided into channels to obtain a first channel group and a second channel group; wherein the first channel group and the second channel group each correspond to multiple channels;
[0012] performing global convolution on multiple channels in the first channel group according to the global convolutional network module to obtain multiple first image features;
[0013] performing fast convolution on multiple channels in the second channel group according to the fast convolution network module to obtain multiple second image features;
[0014] performing splicing processing on the plurality of first image features and the plurality of second image features according to the residual module to obtain a feature splicing result;
[0015] According to the classifier, the feature splicing result is classified and predicted, and the predicted defect detection result is output.
[0016] The beneficial effects of the present application are: when performing defect detection, the input channels of the original defect image are specifically divided into a first channel group and a second channel group, and a global convolutional network module is used for the first channel group, and a fast convolutional network module is used for the second channel group. Finally, the two groups of convolution results are spliced to obtain complete global context information, thereby further improving the defect detection accuracy.
[0017] In one implementation, the step of performing channel division on the original defect image according to the channel division module to obtain a first channel group and a second channel group includes:
[0018] According to the channel division module, channel division is performed on the input feature matrix of the original defect image to obtain the first channel group and the second channel group.
[0019] The beneficial effect of the present application is that since the input feature matrix of the original defect image is divided into two groups, when performing subsequent convolution, not only the number of model parameters can be reduced, but also the stochastic gradient can be descended, thereby making the trained defect detection model more efficient.
[0020] In one implementation, the step of performing global convolution on multiple channels in the first channel group according to the global convolutional network module to obtain multiple first image features includes:
[0021] For any channel in the first channel group, moving the grid sampling sliding window to a corresponding coordinate position according to the global convolutional network module and the channel index corresponding to the any channel;
[0022] At the coordinate position, a filter is used to capture global context information to obtain the first image feature corresponding to any one of the channels.
[0023] The beneficial effects of the present application are: since the sampling position depends on the spatial coordinates and different channels when using the global convolutional network module, the global context information can be integrated into the original position information of each pixel in the present application, thereby enabling the trained defect detection model to obtain better dense prediction results.
[0024] In one implementation, the step of performing fast convolution on multiple channels in the second channel group according to the fast convolution network module to obtain multiple second image features includes:
[0025] Determining a target continuous channel from a plurality of channels in the second channel group according to the fast convolutional network module;
[0026] Perform fast convolution on the continuous channels to obtain the multiple second image features.
[0027] The beneficial effect of the present application is that: since a fast convolution network module is used to perform fast convolution on the target continuous channels in the second channel group, in the present application, in view of the large feature redundancy between different channels, the continuous channels can be regarded as representatives of the entire feature map for calculation, so as to greatly avoid the feature redundancy phenomenon, thereby further improving the defect detection accuracy.
[0028] In one implementation, the step of performing splicing processing on the plurality of first image features and the plurality of second image features according to the residual module to obtain a feature splicing result includes:
[0029] The plurality of convolutional layers, batch normalization layers, activation functions and residual connections included in the residual module are sequentially used to perform splicing processing on the plurality of first image features and the plurality of second image features to obtain the feature splicing result.
[0030] The beneficial effect of the present application is that since the image features of the two groups of channels are spliced through the residual module, in the present application, not only the convergence speed of the model can be improved, the training time and the consumption of computing resources can be reduced, but also the spatial position information can be enhanced.
[0031] In one implementation, the step of performing classification prediction on the feature splicing result according to the classifier and outputting the predicted defect detection result includes:
[0032] According to the K-nearest neighbor classifier, the feature splicing result is classified and predicted, and the predicted defect detection result is output.
[0033] The beneficial effect of the present application is that, since the K-nearest neighbor classifier is used for defect classification, the defects can be classified more simply and efficiently in the present application.
[0034] In one implementation, before inputting the original defect image into a trained defect detection model for defect detection and outputting a predicted defect detection result, the method further includes:
[0035] Obtain multiple real-time original defect images through image acquisition equipment;
[0036] The plurality of real-time original defect images are obtained according to a preset ratio to obtain a training set, a test set and a validation set;
[0037] The original defect detection model is trained using the training set, test set, and validation set to obtain a trained defect detection model.
[0038] The beneficial effect of the present application is that since the original defect detection model is trained using real-time original defect images, the trained defect detection model can be made more in line with the current actual situation and more real-time.
[0039] In one implementation, before obtaining a training set, a test set, and a validation set by processing the plurality of real-time original defect images in a preset ratio, the method further includes:
[0040] Performing geometric transformation and color transformation on the multiple real-time original defect images to obtain multiple pre-processed defect images; wherein the geometric transformation includes flipping, rotating, cropping, deformation and scaling; the color transformation includes blurring, erasing, filling and brightness enhancement;
[0041] Then, the step of obtaining a training set, a test set, and a validation set by using the plurality of real-time original defect images in a preset ratio includes:
[0042] The plurality of pre-processed defect images are processed according to a preset ratio to obtain a training set, a test set and a validation set.
[0043] The beneficial effect of the present application is that since various geometric transformations and color transformations are performed on the original defect image, in the present application, the noise in the original defect image can be greatly reduced by enhancing the quality of the original defect image, so as to further improve the defect detection accuracy of the trained defect detection model.
[0044] In one aspect, a defect detection device is provided, comprising:
[0045] A defect image obtaining unit, configured to obtain an original defect image through an image acquisition device;
[0046] The defect detection result output unit is used to input the original defect image into the trained defect detection model for defect detection and output the predicted defect detection result; wherein the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier.
[0047] On the one hand, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the above methods when executing the computer program.
[0048] In one aspect, a computer storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, any of the above methods is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0050] FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0051] FIG2 is a schematic diagram of a flow chart of a defect detection method provided in an embodiment of the present application;
[0052] FIG3 is a schematic diagram of a defect detection device provided in an embodiment of the present application.
[0053] Markings in the figure: 10-defect detection equipment, 101-processor, 102-memory, 103-I / O interface, 104-database, 30-defect detection device, 301-defect image acquisition unit, 302-defect detection result output unit, 303-model training unit, 304-image preprocessing unit. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions 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 only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other in any way. In addition, although a logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0055] Existing object detection tasks often encounter significant scale differences between the target and the scene, high similarity between different target categories, and significant morphological variations between targets of the same category. These issues often lead to inconsistent results and inaccurate positioning of targets in different scenarios. Furthermore, due to the limited receptive field of the convolutional kernels in the feature extraction network, the feature extraction network is unable to effectively capture global contextual information. In recent years, to obtain greater local information, multiple different convolutional kernel sizes have been commonly designed in feature extraction networks, introducing additional parameters and increasing computational overhead.
[0056] Based on this, an embodiment of the present application provides a defect detection method, in which an original defect image can be obtained through an image acquisition device; then, the original defect image can be input into a trained defect detection model for defect detection to output a predicted defect detection result; wherein the trained defect detection model can include a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier. Therefore, in an embodiment of the present application, since the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier, therefore, in the present application, by adopting a combined global convolutional network module and a fast convolutional network module to replace the standard convolution structure, the filter receptive field can be expanded, the semantic relevance can be enhanced, and the number of model parameters can be reduced, thereby improving the defect detection accuracy by obtaining complete global context information.
[0057] After introducing the design concepts of the embodiments of the present application, the following briefly introduces the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limiting. In the specific implementation process, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0058] As shown in FIG1 , a schematic diagram of an application scenario provided by an embodiment of the present application is shown, wherein the application scenario may include a defect detection device 10 .
[0059] The defect detection device 10 can be used to perform defect detection on an image, and can be, for example, an onboard computer, a personal computer (PC), a server, or a laptop. The defect detection device 10 may include one or more processors 101, a memory 102, an I / O interface 103, and a database 104. Specifically, the processor 101 may be a central processing unit (CPU), a digital processing unit, or the like. The memory 102 may be a volatile memory, such as a random-access memory (RAM); a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 102 may be a combination of the above memories. Memory 102 may store some program instructions for the defect detection method provided in the embodiments of the present application. When executed by processor 101, these program instructions can be used to implement the steps of the defect detection method provided in the embodiments of the present application, thereby resolving the problem of low defect detection accuracy due to the inability to obtain global context information. Database 104 may be used to store data such as the original defect image, defect detection results, first image features, second image features, and feature stitching results involved in the solutions provided in the embodiments of the present application.
[0060] In the embodiment of the present application, the defect detection device 10 can obtain the original defect image through the I / O interface 103. Then, the processor 101 of the defect detection device 10 will follow the program instructions of the defect detection method provided in the embodiment of the present application in the memory 102 to solve the problem of low defect detection accuracy caused by the inability to obtain global context information. In addition, data such as the original defect image, defect detection results, first image features, second image features, and feature splicing results can be stored in the database 104.
[0061] Of course, the method provided in the embodiment of the present application is not limited to the application scenario shown in Figure 1, and can also be used in other possible application scenarios, and the embodiment of the present application is not limited thereto. The functions that can be implemented by each device in the application scenario shown in Figure 1 will be described in the subsequent method embodiments, and will not be described in detail here. Below, the method of the embodiment of the present application will be introduced in conjunction with the accompanying drawings.
[0062] As shown in FIG2 , a flow chart of a defect detection method provided in an embodiment of the present application is shown. The method can be executed by the defect detection device 10 in FIG1 . Specifically, the flow of the method is described as follows.
[0063] Step 201: Obtain an original defect image through an image acquisition device.
[0064] To improve the accuracy of defect detection, in an embodiment of the present application, before defect detection is performed, an original defect image can be obtained using an image acquisition device. The image acquisition device can be constructed using an industrial camera, a fixed-focus lens, a light source system, a sensor, and a bracket.
[0065] Step 202: Input the original defect image into the trained defect detection model to perform defect detection, and output the predicted defect detection result.
[0066] In an embodiment of the present application, the trained defect detection model may include a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier.
[0067] Furthermore, after acquiring the original defect image, in order to obtain the predicted defect detection result, in an embodiment of the present application, the original defect image can be directly input into the trained defect detection model for defect detection to output the predicted defect detection result.
[0068] Based on this, since the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier, in this application, the combined global convolutional network module and the fast convolutional network module can be used to replace the standard convolution structure to expand the filter receptive field, enhance semantic relevance, and reduce the number of model parameters, thereby improving the defect detection accuracy by obtaining complete global context information.
[0069] In one possible implementation, in order to further improve the defect detection accuracy, in an embodiment of the present application, when the original defect image is input into a trained defect detection model for defect detection and the predicted defect detection result is output, specifically, first, the original defect image can be divided into channels according to the channel division module to obtain a first channel group and a second channel group; wherein the first channel group and the second channel group each correspond to multiple channels; then, the multiple channels in the first channel group can be globally convolved according to the global convolutional network module to obtain multiple first image features; next, the multiple channels in the second channel group can be fast convolved according to the fast convolutional network module to obtain multiple second image features; then, the multiple first image features and the multiple second image features can be spliced according to the residual module to obtain a feature splicing result; finally, the feature splicing result can be classified and predicted according to the classifier to output the predicted defect detection result.
[0070] Furthermore, when performing defect detection, the input channels of the original defect image are specifically divided into the first channel group and the second channel group, and the global convolutional network module is used for the first channel group, and the fast convolutional network module is used for the second channel group. Finally, the two groups of convolution results are spliced to obtain complete global context information, so as to further improve the defect detection accuracy.
[0071] In one possible implementation, in order to make the trained defect detection model more efficient, in an embodiment of the present application, when the original defect image is divided into channels according to the channel division module to obtain the first channel group and the second channel group, the input feature matrix of the original defect image can be divided into channels according to the channel division module to obtain the first channel group and the second channel group. In practical applications, multiple channels of the input feature matrix of the original defect image can be evenly divided to obtain the first channel group and the second channel group.
[0072] Furthermore, since the input feature matrix of the original defect image is divided into two groups, the subsequent convolution can not only reduce the number of model parameters, but also enable stochastic gradient descent, thereby making the trained defect detection model more efficient.
[0073] In one possible embodiment, when global convolution is performed on multiple channels in the first channel group according to the global convolution network module to obtain multiple first image features, for any channel in the first channel group, the grid sampling sliding window (for example, a 3×3 grid sampling sliding window) can be moved to the corresponding coordinate position according to the global convolution network module and the channel index corresponding to any channel, that is, the grid sampling position can be moved to a different coordinate position according to the channel index; then, at the coordinate position, a filter (the filter can use a 1×1 convolution kernel to obtain a global field of view) can be used to capture the global context information to obtain the first image feature corresponding to any channel.
[0074] Furthermore, since the sampling position depends on the spatial coordinates and different channels when using the global convolutional network module, in this application, the global context information can be integrated into the original position information of each pixel, so that the trained defect detection model can obtain better dense prediction results.
[0075] In one possible implementation, in order to further improve the defect detection accuracy, in an embodiment of the present application, when fast convolution is performed on multiple channels in the second channel group according to the fast convolution network module to obtain multiple second image features, the target continuous channel can be determined from the multiple channels in the second channel group according to the fast convolution network module; then, fast convolution can be performed on the continuous channel to obtain multiple second image features.
[0076] Furthermore, since a fast convolution network module is used to perform fast convolution on the target continuous channels in the second channel group, in this application, in view of the large feature redundancy between different channels, the continuous channels can be regarded as representatives of the entire feature map for calculation, so as to greatly avoid the feature redundancy phenomenon, thereby further improving the defect detection accuracy.
[0077] In a possible implementation, when performing splicing processing on multiple first image features and multiple second image features according to the residual module to obtain a feature splicing result, the multiple convolutional layers, batch normalization layers, activation functions and residual connections included in the residual module can be used in sequence to perform splicing processing on the multiple first image features and multiple second image features to obtain a feature splicing result. In practical applications, the splicing processing can be an "overlapping operation".
[0078] Furthermore, since the image features of the two groups of channels are spliced through the residual module, in this application, not only the convergence speed of the model can be improved, the training time and the consumption of computing resources can be reduced, but also the spatial position information can be enhanced.
[0079] In one possible implementation, in order to classify defects more simply and efficiently, in an embodiment of the present application, when classifying and predicting the feature splicing results according to the classifier and outputting the predicted defect detection results, the feature splicing results can be classified and predicted according to the K-nearest neighbor classifier to output the predicted defect detection results.
[0080] Furthermore, since the K-nearest neighbor classifier is used to classify defects, in the present application, defects can be classified more simply and efficiently.
[0081] In one possible implementation, in order to make the trained defect detection model more in line with the current actual situation and more real-time, in an embodiment of the present application, before the original defect image is input into the trained defect detection model for defect detection and the predicted defect detection result is output, the original defect detection model can also be trained using the defect image collected in real time to obtain a trained defect detection model.
[0082] Specifically, first, multiple real-time original defect images can be obtained through image acquisition equipment; then, multiple real-time original defect images can be used to obtain training sets, test sets and validation sets according to preset proportions; finally, the training set, test set and validation set can be used to train the original defect detection model to obtain a trained defect detection model.
[0083] Furthermore, since the original defect detection model is trained using real-time original defect images, in this application, the trained defect detection model can be made more consistent with the current actual situation and more real-time.
[0084] In one possible implementation, in order to further improve the defect detection accuracy of the trained defect detection model, in an embodiment of the present application, before obtaining the training set, test set and validation set according to a preset ratio, the multiple real-time original defect images can also be preprocessed.
[0085] Specifically, first, multiple real-time original defect images can be geometrically transformed and color transformed to obtain multiple pre-processed defect images; wherein the geometric transformation can include flipping, rotation, cropping, deformation and scaling; the color transformation can include blurring, erasing, filling, and brightness enhancement.
[0086] Based on this, when multiple real-time original defect images are used in a preset ratio to obtain the training set, test set and validation set, multiple preprocessed defect images can be used in a preset ratio to obtain the training set, test set and validation set.
[0087] Furthermore, since various geometric transformations and color transformations are performed on the original defect image, in this application, the noise in the original defect image can be greatly reduced by enhancing the quality of the original defect image, so as to further improve the defect detection accuracy of the trained defect detection model.
[0088] To sum up, in the embodiments of the present application, since the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier, in the present application, the combined global convolutional network module and the fast convolutional network module can be used to replace the standard convolution structure to expand the filter receptive field, enhance semantic relevance, and reduce the number of model parameters, thereby improving the defect detection accuracy by obtaining complete global context information.
[0089] Based on the same inventive concept, an embodiment of the present application provides a defect detection device 30, as shown in FIG3 , the defect detection device 30 includes:
[0090] The defect image obtaining unit 301 is used to obtain an original defect image through an image acquisition device;
[0091] The defect detection result output unit 302 is used to input the original defect image into the trained defect detection model for defect detection and output the predicted defect detection result; wherein the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module and a classifier.
[0092] In one implementation, the defect detection result output unit 302 is further configured to:
[0093] According to the channel division module, the original defect image is divided into channels to obtain a first channel group and a second channel group; wherein the first channel group and the second channel group each correspond to multiple channels;
[0094] performing global convolution on multiple channels in the first channel group according to the global convolutional network module to obtain multiple first image features;
[0095] performing fast convolution on multiple channels in the second channel group according to the fast convolution network module to obtain multiple second image features;
[0096] performing splicing processing on the plurality of first image features and the plurality of second image features according to the residual module to obtain a feature splicing result;
[0097] According to the classifier, the feature splicing results are classified and predicted, and the predicted defect detection results are output.
[0098] In one implementation, the defect detection result output unit 302 is further configured to:
[0099] According to the channel division module, the input feature matrix of the original defect image is divided into channels to obtain a first channel group and a second channel group.
[0100] In one implementation, the defect detection result output unit 302 is further configured to:
[0101] For any channel in the first channel group, according to the global convolutional network module and the channel index corresponding to any channel, the grid sampling sliding window is moved to the corresponding coordinate position;
[0102] At the coordinate position, a filter is used to capture the global context information and obtain the first image feature corresponding to any channel.
[0103] In one implementation, the defect detection result output unit 302 is further configured to:
[0104] determining a target continuous channel from a plurality of channels in the second channel group according to a fast convolutional network module;
[0105] Perform fast convolution on consecutive channels to obtain multiple second image features.
[0106] In one implementation, the defect detection result output unit 302 is further configured to:
[0107] Multiple convolutional layers, batch normalization layers, activation functions, and residual connections included in the residual module are sequentially used to perform splicing processing on the multiple first image features and the multiple second image features to obtain a feature splicing result.
[0108] In one implementation, the defect detection result output unit 302 is further configured to:
[0109] According to the K-nearest neighbor classifier, the feature splicing results are classified and predicted, and the predicted defect detection results are output.
[0110] In one implementation, the defect detection device 30 further includes a model training unit 303, which is configured to:
[0111] Obtain multiple real-time original defect images through image acquisition equipment;
[0112] Multiple real-time original defect images are converted into training sets, test sets, and validation sets according to preset ratios;
[0113] The original defect detection model is trained using the training set, test set, and validation set to obtain a trained defect detection model.
[0114] In one implementation, the defect detection device 30 further includes an image preprocessing unit 304, which is configured to:
[0115] Perform geometric transformation and color transformation on multiple real-time original defect images to obtain multiple pre-processed defect images; geometric transformation includes flipping, rotation, cropping, deformation and scaling; color transformation includes blurring, erasing, filling and brightness enhancement;
[0116] Then, the steps of obtaining a training set, a test set, and a validation set by using multiple real-time original defect images in a preset ratio include:
[0117] Multiple preprocessed defect images are used in a preset ratio to obtain training sets, test sets, and validation sets.
[0118] The defect detection device 30 can be used to execute the method executed in the embodiment shown in Figure 2. Therefore, for the functions that can be implemented by each functional module of the defect detection device 30, please refer to the description of the embodiment shown in Figure 2 and no further details will be given.
[0119] In some possible implementations, various aspects of the method provided in the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the method according to the various exemplary implementations of the present application described above in this specification. For example, the computer device may execute the method performed in the embodiment shown in Figure 2.
[0120] Those skilled in the art will understand that all or part of the steps of the above-mentioned method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above-mentioned method embodiments. The aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks or optical disks. Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0121] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0122] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A defect detection method, characterized in that, The method includes: Obtaining an original defect image through an image acquisition device; Inputting the original defect image into a trained defect detection model for defect detection and outputting a predicted defect detection result; wherein, the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module, and a classifier; the step of inputting the original defect image into the trained defect detection model for defect detection and outputting a predicted defect detection result includes: dividing the channels of the original defect image according to the channel division module to obtain a first channel group and a second channel group; wherein, both the first channel group and the second channel group correspond to multiple channels; performing global convolution on the multiple channels in the first channel group according to the global convolutional network module to obtain multiple first image features; performing fast convolution on the multiple channels in the second channel group according to the fast convolutional network module to obtain multiple second image features; performing splicing processing on the multiple first image features and the multiple second image features according to the residual module to obtain a feature splicing result; and performing classification prediction on the feature splicing result according to the classifier to output a predicted defect detection result.
2. The method according to claim 1, characterized in that The step of dividing the channels of the original defect image according to the channel division module to obtain a first channel group and a second channel group includes: Dividing the input feature matrix of the original defect image according to the channel division module to obtain the first channel group and the second channel group.
3. The method according to claim 1, characterized in that The step of performing global convolution on the multiple channels in the first channel group according to the global convolutional network module to obtain multiple first image features includes: For any one channel in the first channel group, moving the grid sampling sliding window to the corresponding coordinate position according to the global convolutional network module and the channel index corresponding to the any one channel; At the coordinate position, capturing global context information using a filter to obtain the first image feature corresponding to the any one channel.
4. The method according to claim 1, wherein The step of performing fast convolution on the multiple channels in the second channel group according to the fast convolutional network module to obtain multiple second image features includes: Determining target consecutive channels from the multiple channels in the second channel group according to the fast convolutional network module; Performing fast convolution on the consecutive channels to obtain the multiple second image features.
5. The method according to claim 1, wherein The step of performing splicing processing on the multiple first image features and the multiple second image features according to the residual module to obtain a feature splicing result includes: Successively using multiple convolutional layers, batch normalization layers, activation functions, and residual connections included in the residual module to perform splicing processing on the multiple first image features and the multiple second image features to obtain the feature splicing result.
6. The method according to claim 1, characterized in that, The step of performing classification prediction on the feature splicing result according to the classifier to output a predicted defect detection result includes: Performing classification prediction on the feature splicing result according to a K-nearest neighbor classifier to output a predicted defect detection result.
7. The method according to claim 1, characterized in that, Before inputting the original defect image into a trained defect detection model for defect detection and outputting a predicted defect detection result, the method further includes: Obtaining multiple real-time original defect images through an image acquisition device; Obtaining a training set, a test set, and a validation set from the multiple real-time original defect images according to a preset ratio; Training an original defect detection model using the training set, the test set, and the validation set to obtain a trained defect detection model.
8. The method according to claim 7, wherein Before obtaining a training set, a test set, and a validation set from the multiple real-time original defect images according to a preset ratio, the method further includes: Performing geometric transformation and color transformation on the multiple real-time original defect images to obtain multiple preprocessed defect images; wherein, the geometric transformation includes flipping, rotating, cropping, deforming, and scaling; the color transformation includes blurring, erasing, filling, and brightness enhancement; Then, the step of obtaining a training set, a test set, and a validation set from the multiple real-time original defect images according to a preset ratio includes: Obtaining a training set, a test set, and a validation set from the multiple preprocessed defect images according to a preset ratio.
9. A defect detection device, characterized in that, The apparatus includes: A defect image obtaining unit, configured to obtain an original defect image through an image acquisition device; A defect detection result output unit, configured to input the original defect image into a trained defect detection model for defect detection and output a predicted defect detection result; wherein, the trained defect detection model includes a channel division module, a global convolutional network module, a fast convolutional network module, a residual module, and a classifier; the step of inputting the original defect image into the trained defect detection model for defect detection and outputting a predicted defect detection result includes: dividing the channels of the original defect image according to the channel division module to obtain a first channel group and a second channel group; wherein, both the first channel group and the second channel group correspond to multiple channels; performing global convolution on the multiple channels in the first channel group according to the global convolutional network module to obtain multiple first image features; performing fast convolution on the multiple channels in the second channel group according to the fast convolutional network module to obtain multiple second image features; performing splicing processing on the multiple first image features and the multiple second image features according to the residual module to obtain a feature splicing result; performing classification prediction on the feature splicing result according to the classifier and outputting a predicted defect detection result.
10. An electronic device, characterized in that, The device includes: A memory, configured to store program instructions; A processor, configured to call the program instructions stored in the memory and execute the method according to any one of claims 1-8 according to the obtained program instructions.
11. A storage medium, characterized in that, The storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the method according to any one of claims 1-8.
Citation Information
Patent Citations
Fabric defect detection method based on deep convolution neural network and visual saliency
CN107833220A
Power transmission line image defect detection method and device, equipment and medium
CN112419268A
Solder defect detection method and system based on small target recognition
CN116824294A
Defect detection method, device and equipment and storage medium
CN117372424A
Defect detection method, device and equipment and storage medium
CN117576109A
Cited By
Defect graph file processing method and device, terminal equipment and storage medium
CN120670124A
Universal semiconductor defect detection method and system
CN121074035A