Defect detection method and apparatus, computer device, and storage medium

Through unsupervised learning of asymmetric teacher networks and student networks, combined with encoding and decoding features, the accuracy of existing bead defect detection methods is solved, and the accuracy and efficiency of bead defect detection are improved.

WO2025007516A1PCT designated stage expired Publication Date: 2025-01-09CONTEMPORARY AMPEREX TECHNOLOGY CO LTD

Patent Information

Application Number
PCT/CN2023/138847
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-07-04
Filing Date
2023-12-14
Publication Date
2025-01-09

AI Technical Summary

Technical Problem

The existing bead defect detection methods are inaccurate and cannot effectively cover all bead defect areas or locations, resulting in incorrect estimates of bead defect areas.

Method used

Unsupervised learning is used for asymmetric teacher networks and student networks. By inputting the images to be detected to the teacher network for encoding and decoding, and combining multiple coded features and decoding features for defect detection, reducing noise sensitivity to improve detection accuracy .

Benefits of technology

It improves the accuracy and efficiency of bead defect detection, enhances the accuracy of coverage and position estimates of bead defect areas, and reduces noise sensitivity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023138847_09012025_PF_FP_ABST
    Figure CN2023138847_09012025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to a defect detection method and apparatus, a computer device, and a storage medium. According to the method, an image to be detected is inputted into a teacher network for encoding to obtain a plurality of encoded features, the plurality of encoded features are fused and then inputted into a student network for decoding to obtain a plurality of decoded features, and a defect area in said image is determined on the basis of the plurality of encoded features and the plurality of decoded features. According to the defect detection method, unsupervised learning is carried out by establishing an asymmetric student network based on the output of a teacher network, and thus, compared with conventional detection algorithms where teacher networks and student networks carry out learning independently, the defect detection method can reduce sensitivity to noise to a certain extent in respective learning processes of the teacher network and the student network, thereby improving the accuracy of defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Defect detection method, device, computer equipment and storage medium

[0001] Cross-references

[0002] This application refers to Chinese patent application No. 202310806554X, filed on July 4, 2023, entitled “Defect Detection Method, Device, Computer Equipment and Storage Medium”, which is incorporated into this application in its entirety by reference. Technical Field

[0003] The present application relates to the field of battery detection technology, and in particular to a defect detection method, apparatus, computer equipment, and storage medium. Background Art

[0004] Sealing pin welding is an essential step in the power battery production process, and whether or not the sealant welding meets standards directly impacts battery safety. The sealant welding area is called the weld bead. Due to temperature and environmental fluctuations during welding, defects such as pinholes, cracks, crack lines (cold welds), missing welds, and melt beads often occur on the weld bead. These defects directly impact the quality of the sealant welding, making weld bead defect detection crucial.

[0005] However, existing weld defect detection methods have the problem of inaccurate detection.

[0006] Summary of the Invention

[0007] Based on this, it is necessary to provide a defect detection method, device, computer equipment and storage medium that can improve detection accuracy in response to the above technical problems.

[0008] In a first aspect, the present application provides a defect detection method. The method comprises:

[0009] Input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0010] After fusing multiple encoding features, input them into the student network for decoding to obtain multiple decoding features;

[0011] Determine a defect area in an image to be detected based on the plurality of encoding features and the plurality of decoding features.

[0012] The defect detection method provided in the embodiment of the present application is to input the image to be detected into a teacher network for encoding to obtain multiple encoding features, and then fuse the multiple encoding features and input them into a student network for decoding to obtain multiple decoding features. The defect area in the image to be detected is determined based on the multiple encoding features and the multiple decoding features. The above-mentioned defect detection method performs unsupervised learning by establishing an asymmetric student network on the output of the teacher network. Compared with the detection algorithm in which the traditional teacher network and student network learn independently, the teacher network and the student network can each reduce the noise sensitivity to a certain extent during the learning process, thereby improving the accuracy of defect detection.

[0013] In one embodiment, the teacher network includes: a first convolution module and multiple encoding modules, the multiple encoding modules are cascaded, and the image to be detected is input into the teacher network for encoding to obtain multiple encoding features, including:

[0014] Inputting the image to be detected into the first convolution module to obtain convolution features;

[0015] The convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features.

[0016] The teacher network provided in the embodiment of the present application realizes encoding at different stages or the same stage through the encoding network, and obtains multiple encoding features of different sizes or the same size, which can provide rich feature information for subsequent defect detection based on multiple encoding features, thereby improving the detection accuracy to a certain extent.

[0017] In one embodiment, the convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features, including:

[0018] The convolutional features are input into multiple encoding modules for encoding to obtain multiple initial encoding features;

[0019] The size of each initial coding feature is adjusted to obtain multiple coding features.

[0020] The coding network provided in the embodiment of the present application realizes coding at different stages through multiple cascade-connected coding modules, and obtains multiple coding features of different sizes or the same size, which can provide rich feature information for subsequent defect detection based on multiple coding features, thereby improving detection accuracy to a certain extent.

[0021] In one embodiment, the encoding network includes multiple encoding modules, which are cascaded and input the convolutional features into the encoding network for encoding to obtain multiple encoding features, including:

[0022] The convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features.

[0023] The coding network provided in the embodiment of the present application realizes coding at different stages through multiple cascade-connected coding modules to obtain multiple coding features of the same size, which can facilitate the subsequent fusion of multiple coding features, facilitate defect detection based on the fused coding features, and thus improve the detection accuracy to a certain extent.

[0024] In one embodiment, the convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features, including:

[0025] The convolutional features are input into multiple encoding modules for encoding to obtain multiple initial encoding features;

[0026] The size of each initial coding feature is adjusted to obtain multiple coding features.

[0027] The coding network provided in the embodiment of the present application implements N stages of coding through multiple cascaded N coding modules to obtain N coding features of the same size, which can facilitate the subsequent fusion of the N coding features, facilitate defect detection based on the fused coding features, and thus improve the detection accuracy to a certain extent.

[0028] In one embodiment, the encoding network includes: N encoding modules and N second convolution modules, the output end of the Nth encoding module is connected to the input end of the Nth second convolution module, and each initial encoding feature is resized to obtain multiple encoding features, including:

[0029] The initial coding features output by each coding module are input into the corresponding second convolution module for size adjustment to obtain multiple coding features; the size of each coding feature is consistent.

[0030] The coding network provided in the embodiment of the present application implements N stages of coding through multiple cascaded N coding modules to obtain N coding features of the same size, which can facilitate the subsequent fusion of the N coding features, facilitate defect detection based on the fused coding features, and thus improve the detection accuracy to a certain extent.

[0031] In one embodiment, the encoding network includes: M+1 encoding modules and M second convolution modules, the output end of the Mth encoding module is connected to the input end of the Mth second convolution module, and each initial encoding feature is resized to obtain multiple encoding features, including:

[0032] The initial coding features output by the M coding modules are respectively input into the corresponding second convolution modules for size adjustment to obtain M coding features;

[0033] The M coding features and the initial coding features output by the M+1th coding module are determined as a plurality of coding features.

[0034] The coding network provided in the embodiment of the present application implements M stages of coding through multiple cascade-connected M coding modules, obtains M coding features of the same size, and makes the size of the M coding features consistent with the size of the coding features output by the M+1th coding module. This can facilitate the subsequent fusion of the M+1 coding features, facilitate defect detection based on the fused coding features, and thus improve detection accuracy to a certain extent.

[0035] In one embodiment, the student network includes: a transformation module and multiple decoding modules, which fuse multiple encoding features and input them into the student network for decoding to obtain multiple decoding features, including:

[0036] Multiple encoding features are fused and input into the transformation module to obtain abstract features;

[0037] The abstract features are input into multiple decoding modules for decoding to obtain multiple decoding features.

[0038] The student network provided in the embodiment of the present application implements decoding at different stages through multiple decoding modules to obtain multiple decoding features, so that these multiple decoding features can correspond one-to-one with multiple encoding features, so that defect detection can be performed later by analyzing the similarity between the multiple encoding features and the multiple decoding features, thereby realizing an accurate and efficient defect detection method.

[0039] In one embodiment, multiple decoding modules are cascaded and connected, and the abstract features are input into the multiple decoding modules for decoding to obtain multiple decoding features, including:

[0040] The abstract features are input into multiple decoding modules for decoding to obtain multiple decoding features.

[0041] The student network provided in the embodiment of the present application implements decoding at different stages through multiple cascaded decoding modules to obtain multiple decoding features, so that these multiple decoding features can correspond one-to-one with multiple encoding features, so that defect detection can be performed later by analyzing the similarity between the multiple encoding features and the multiple decoding features, thereby realizing an accurate and efficient defect detection method.

[0042] In one embodiment, the multiple decoding modules include K decoding modules, wherein the first decoding module to the K-1th decoding module are cascade-connected, and the abstract features are input to the multiple decoding modules for decoding to obtain multiple decoding features, including:

[0043] The abstract features are input into the 1st decoding module to the K-1th decoding module for decoding, and the decoding features output by each decoding module from the 1st decoding module to the K-1th decoding module are obtained;

[0044] The encoding features output by the second encoding module in the teacher network are input into the Kth decoding module among the K decoding modules for decoding to obtain the decoding features output by the Kth decoding module.

[0045] The student network provided in the embodiments of the present application implements decoding at different stages through multiple decoding modules, obtaining multiple decoding features. These multiple decoding features can be mapped one-to-one to multiple encoding features, allowing for subsequent defect detection by analyzing the similarity between multiple encoding features and multiple decoding features, thereby achieving an accurate and efficient defect detection method. Furthermore, the input of the last decoding module is the encoding features output by the encoding module in the teacher network, which can, to a certain extent, compensate for the detailed features lost in image reconstruction during the decoding process, thereby improving the quality of the decoding features.

[0046] In one embodiment, determining a defect area in an image to be inspected based on a plurality of encoding features and a plurality of decoding features includes:

[0047] According to the similarity value between each encoding feature and each decoding feature, a plurality of similar feature images are obtained;

[0048] Fuse multiple similar feature images to obtain the target detection image;

[0049] Perform defect detection on the target detection image to obtain the defect area.

[0050] The embodiment of the present application fuses multiple similar feature images and then performs defect detection based on the fused similar feature images. Since the multiple similar feature images reflect the learning process of the teacher network and the student network at multiple stages, that is, reflect features at multiple scales, defect detection based on multi-scale features is achieved, which can improve the accuracy of detection to a certain extent.

[0051] In one embodiment, performing defect detection on a target detection image to obtain a defect area includes:

[0052] Determine the pixel corresponding to the grayscale value greater than the preset grayscale threshold as the target pixel;

[0053] The area formed by connecting target pixels is determined as the defect area.

[0054] The embodiment of the present application detects defective areas by connecting pixel points with a grayscale value greater than a preset threshold. This method is simple and efficient and can improve detection accuracy to a certain extent.

[0055] In one embodiment, the method further comprises:

[0056] resizing the plurality of similar feature images to obtain a plurality of resized similar feature images; the size of each resized similar feature image is consistent with the size of the image to be detected;

[0057] Multiple similar feature images are fused to obtain the target detection image, including:

[0058] Multiple resized images with similar features are fused to obtain the target detection image.

[0059] The embodiment of the present application adjusts the size of each similar feature image to make the sizes of multiple similar feature images consistent, which can improve the fusion quality of multiple similar feature images in the later stage to a certain extent, thereby improving the accuracy of later detection.

[0060] In one embodiment, the method further comprises:

[0061] The detection network is trained according to the sample image to obtain a multi-level teacher network and a multi-level student network; the sample image is an image without defect areas; the detection network includes a multi-level initial teacher network and a multi-level initial student network.

[0062] The training method described in this embodiment can be based on sample images that do not contain defects. This type of sample images is relatively easy to obtain, and the training effect can be improved to a certain extent by obtaining a large number of sample images.

[0063] In one embodiment, the detection network is trained based on sample images to obtain a teacher network and a student network, including:

[0064] Input the sample image into the initial teacher network for encoding to obtain multiple sample encoding features;

[0065] The encoding features of multiple samples are fused and input into the initial student network for decoding to obtain multiple sample decoding features;

[0066] determining a target image according to a plurality of sample encoding features and a plurality of sample decoding features;

[0067] A target loss is determined according to the target image and the sample image, and the initial teacher network and the initial student network are trained according to the target loss to obtain a teacher network and a student network.

[0068] The training method described in this embodiment simultaneously trains the teacher network and the student network, allowing the teacher network and the student network to learn from each other, forming a self-distillation structure. This can effectively suppress the student network's sensitivity to noise to a certain extent, thereby improving the training effect and further improving the detection accuracy of the detection network composed of the trained teacher network and student network.

[0069] In a second aspect, the present application also provides a defect detection device. The device comprises:

[0070] The encoding module is used to input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0071] The decoding module is used to fuse multiple encoding features and input them into the student network for decoding to obtain multiple decoding features;

[0072] The detection module is used to determine the defect area in the image to be detected based on multiple encoding features and multiple decoding features.

[0073] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:

[0074] Input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0075] After fusing multiple encoding features, input them into the student network for decoding to obtain multiple decoding features;

[0076] Determine a defect area in an image to be detected based on the plurality of encoding features and the plurality of decoding features.

[0077] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:

[0078] Input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0079] After fusing multiple encoding features, input them into the student network for decoding to obtain multiple decoding features;

[0080] Determine a defect area in an image to be detected based on the plurality of encoding features and the plurality of decoding features.

[0081] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:

[0082] Input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0083] After fusing multiple encoding features, input them into the student network for decoding to obtain multiple decoding features;

[0084] Determine a defect area in an image to be detected based on the plurality of encoding features and the plurality of decoding features.

[0085] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on the drawings without inventive work. In the drawings:

[0087] FIG1 is a diagram showing the internal structure of a computer device according to an embodiment;

[0088] FIG2 is a schematic diagram of a defect detection method according to an embodiment;

[0089] FIG3 is a schematic flow chart of a defect detection method in another embodiment;

[0090] FIG4 is a schematic diagram of a structure of an implementation of a teacher network in one embodiment;

[0091] FIG5 is a schematic structural diagram of an implementation of a coding network in one embodiment;

[0092] FIG6 is a schematic flow chart of a defect detection method according to another embodiment;

[0093] FIG7 is a schematic structural diagram of an implementation of a coding network in one embodiment;

[0094] FIG8 is a schematic structural diagram of another implementation of a coding network in one embodiment;

[0095] FIG9 is a schematic flow chart of a defect detection method according to another embodiment;

[0096] FIG10 is a schematic flow chart of a defect detection method according to another embodiment;

[0097] FIG11 is a schematic structural diagram of an implementation of a student network in one embodiment;

[0098] FIG12 is a schematic structural diagram of another implementation of a student network in one embodiment;

[0099] FIG13 is a schematic flow chart of a defect detection method according to another embodiment;

[0100] FIG14 is a schematic flow chart of a defect detection method according to another embodiment;

[0101] FIG15 is a schematic flow chart of a training method in another embodiment;

[0102] FIG16 is a schematic diagram of the structure of a detection network in one embodiment;

[0103] FIG17 is a block diagram of the structure of a defect detection device in one embodiment. DETAILED DESCRIPTION

[0104] The following embodiments of the technical solution of the present application will be described in detail with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application and are therefore only examples and are not intended to limit the scope of protection of the present application.

[0105] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the term "include" and any variations thereof in the specification and claims of this application and the above-mentioned figure descriptions are intended to cover non-exclusive inclusions.

[0106] In the description of the embodiments of this application, the technical terms "first" and "second" are used only to distinguish different objects and should not be understood as indicating or implying relative importance or implicitly indicating the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, the meaning of "plurality" is two or more (including two), unless otherwise clearly and specifically defined.

[0107] At present, the method for detecting weld defects is mainly based on artificial intelligence (AI), which can automatically detect whether there are defects on the weld or the type of defects. The existing method usually uses a teacher-student structure with co-propagation, that is, the image to be detected is input into the teacher network and the student network respectively for image processing, and the similarity between the images output by the teacher network and the student network is used to detect the weld defect area in the image to be detected. The teacher network and the student network are usually similar in structure. Such similarity will damage the entire network and fail to cover all weld defect areas or the position estimation of the weld defect area will be wrong, resulting in the weld defect area finally detected being inaccurate. The present application provides a defect detection method, which aims to solve the above technical problems. The following examples will describe the defect detection method described in the present application in detail.

[0108] The defect detection method provided in the embodiments of the present application can be applied to a computer device as shown in FIG1 . The computer device can be a terminal, and its internal structure diagram can be shown in FIG1 . The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication), or other technologies. When the computer program is executed by the processor, a defect detection method is implemented. The display screen of the computer device can be a liquid crystal display or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a key, trackball, or touchpad provided on the computer device housing, or an external keyboard, touchpad, or mouse.

[0109] Those skilled in the art will understand that the structure shown in FIG1 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0110] In one embodiment, as shown in FIG2 , a defect detection method is provided. The method is described by taking the computer device in FIG1 as an example, and includes the following steps:

[0111] S201: Input the image to be detected into the teacher network for encoding to obtain multiple encoding features.

[0112] The image to be inspected is an image of the weld area, which may contain defects on the weld. The teacher network is a pre-trained neural network or encoder that can be used to perform multi-stage image encoding on the input image and output the encoding features of each stage, that is, the multiple encoding features can be the encoding features output by the teacher network at different encoding stages. Each encoding feature can be represented by a feature map. In some embodiments, the teacher network can also be used to encode the input image once to directly obtain multiple encoding features, that is, the multiple encoding features can be the encoding features output by the teacher network at the same encoding stage.

[0113] In an embodiment of the present application, a computer device may first acquire an image of a weld area during battery production, i.e., the image to be inspected. This image to be inspected may or may not contain weld defects. The computer device may then input the image to be inspected into a pre-trained teacher network for encoding at different stages, outputting encoding features of varying or uniform sizes at each stage or at several stages, thereby obtaining multiple encoding features. In some embodiments, the computer device may also input the image to be inspected into a pre-trained teacher network for encoding at the same stage, thereby obtaining multiple encoding features of varying or uniform sizes.

[0114] S202: Multiple encoding features are fused and input into the student network for decoding to obtain multiple decoding features.

[0115] The student network is a pre-trained neural network or decoder that performs multi-stage image decoding on the input feature image and outputs decoding features for each stage. In other words, the multiple decoding features can be the decoding features output by the student network at different decoding stages. Each decoding feature can be represented by a feature graph. There is a one-to-one correspondence between the multiple encoding features and the multiple decoding features.

[0116] In an embodiment of the present application, after the computer device obtains multiple coding features output by the teacher network, it can first fuse the multiple coding features in the channel dimension of the image to obtain a fused feature, and then input the fused feature into a pre-trained student network for decoding at different stages, and output decoding features of different sizes or the same size at each stage or several stages to obtain multiple decoding features. In some embodiments, the computer device can also input the fused feature into a pre-trained student network for decoding at the same stage, that is, decomposing the fused feature into multiple decoding features of different sizes or the same size.

[0117] S203: Determine a defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.

[0118] In an embodiment of the present application, after the computer device obtains multiple coding features and multiple decoding features based on the aforementioned steps, it can calculate the similarity feature map between each coding feature and the corresponding decoding feature, and then calculate the target similarity feature map based on the similarity feature map between all coding features and all decoding features, and finally determine the defect area in the image to be detected based on the target similarity feature map; in some embodiments, when the computer device obtains the similarity feature map between each coding feature and the corresponding decoding feature, that is, multiple similarity feature maps, it can also first filter out some similarity feature maps from the multiple similarity feature maps according to the filtering conditions, and then obtain the target similarity feature map based on the partial similarity feature map, and finally determine the defect area in the image to be detected based on the target similarity feature map. Among them, when the similarity values ​​corresponding to each pixel point in the similarity feature map are relatively large, it means that the image to be detected may include defects. In this scenario, the screening condition can be: screen out the similarity feature maps whose similarity values ​​corresponding to each pixel point in the similarity feature map are greater than the first preset similarity threshold. This can enhance the intensity of the pixel points corresponding to the defective area in the final target similarity feature map, which is convenient for later detection based on the target similarity feature map; when the similarity values ​​corresponding to each pixel point in the similarity feature map are relatively small, it means that the image to be detected may not include defects. In this scenario, the screening condition can be: screen out the similarity feature maps whose similarity values ​​corresponding to each pixel point in the similarity feature map are all less than the second preset similarity threshold. This can enhance the intensity of the pixel points corresponding to the non-defective area in the target similarity feature map, which is convenient for later detection based on the target similarity feature map.

[0119] The defect detection method provided in the embodiment of the present application is to input the image to be detected into a teacher network for encoding to obtain multiple encoding features, and then fuse the multiple encoding features and input them into a student network for decoding to obtain multiple decoding features. The defect area in the image to be detected is determined based on the multiple encoding features and the multiple decoding features. The above-mentioned defect detection method performs unsupervised learning by establishing an asymmetric student network on the output of the teacher network. Compared with the detection algorithm in which the traditional teacher network and student network learn independently, the teacher network and the student network can each reduce the noise sensitivity to a certain extent during the learning process, thereby improving the accuracy of defect detection.

[0120] In one embodiment, a structure of a teacher network is provided, as shown in FIG4 . The teacher network includes: a first convolutional module and an encoding network. Based on the teacher network, the above-mentioned S201 “inputting the image to be detected into the teacher network for encoding to obtain multiple encoding features”, as shown in FIG3 , includes:

[0121] S301: Input the image to be detected into the first convolution module to obtain convolution features.

[0122] The first convolution module is used to perform convolution processing on the input image, that is, to perform size adjustment or dimensionality reduction convolution processing on the input image.

[0123] In an embodiment of the present application, when a computer device acquires an image to be detected, the image to be detected can be input into the first convolution module in the teacher network for convolution processing to obtain convolution features after convolution processing, and the convolution features here can be represented by a convolution feature map. In some embodiments, the computer device can also input the image to be detected into the first convolution module in the teacher network for convolution processing to obtain multiple convolution features after convolution processing, and the multiple convolution features here can be represented by multiple convolution feature maps.

[0124] S302: Input the convolutional features into the encoding network for encoding to obtain multiple encoding features.

[0125] In an embodiment of the present application, when a computer device obtains a convolutional feature, the convolutional feature can be input into a pre-trained encoding network for encoding at different stages, and encoding features of different sizes or the same size can be output at each stage or at several stages to obtain multiple encoding features. In some embodiments, when a computer device obtains multiple convolutional features, the multiple convolutional features can also be simultaneously input into a pre-trained encoding network for encoding at the same stage, thereby obtaining multiple encoding features of the same size or different sizes at one time.

[0126] The teacher network provided in the embodiment of the present application realizes encoding at different stages or the same stage through the encoding network, and obtains multiple encoding features of different sizes or the same size, which can provide rich feature information for subsequent defect detection based on multiple encoding features, thereby improving the detection accuracy to a certain extent.

[0127] In some embodiments, in one embodiment, a structure of a coding network is further provided, as shown in Figure 5. The coding network includes multiple coding modules, and the multiple coding modules are cascaded. In this scenario, when the computer device executes the above S302 "inputting the convolution feature into the coding network for encoding to obtain multiple coding features", the specific execution steps are: inputting the convolution feature into multiple coding modules for encoding to obtain multiple coding features.

[0128] In an embodiment of the present application, when a computer device obtains a convolution feature, the convolution feature can be input into multiple cascade-connected encoding modules for step-by-step encoding, and each encoding module outputs an encoding feature to obtain multiple encoding features, or several of the encoding modules output an encoding feature to obtain multiple encoding features. In some embodiments, when a computer device obtains multiple convolution features, the multiple convolution features can also be simultaneously input into multiple encoding modules for step-by-step encoding, and each encoding module outputs multiple encoding features, or several of the encoding modules output multiple encoding features.

[0129] The coding network provided in the embodiment of the present application realizes coding at different stages through multiple cascade-connected coding modules, and obtains multiple coding features of different sizes or the same size, which can provide rich feature information for subsequent defect detection based on multiple coding features, thereby improving detection accuracy to a certain extent.

[0130] In some embodiments, in one embodiment, a method for encoding using multiple encoding modules is further provided, that is, when the computer device performs the above step of "inputting the convolutional features into multiple encoding modules for encoding to obtain multiple encoding features", as shown in Figure 6, the specific steps are as follows:

[0131] S401: Input the convolutional features into multiple encoding modules for encoding to obtain multiple initial encoding features.

[0132] In an embodiment of the present application, when a computer device obtains a convolution feature, the convolution feature can be input into multiple cascade-connected encoding modules for step-by-step encoding, and each encoding module outputs an initial encoding feature to obtain multiple initial encoding features, or several of the encoding modules output initial encoding features to obtain multiple initial encoding features. In some embodiments, when a computer device obtains multiple convolution features, the multiple convolution features can also be simultaneously input into multiple encoding modules for step-by-step encoding, and each encoding module outputs multiple initial encoding features, or several of the encoding modules output multiple initial encoding features.

[0133] S402: resize each initial coding feature to obtain multiple coding features.

[0134] The sizes of the multiple coding features are consistent.

[0135] When the computer device obtains the initial coding features output by each coding module, or the initial coding features output by several coding modules, it can adjust the size of each coding feature to a target size. The target size can be determined based on actual detection requirements or coding requirements. In some embodiments, the target size can be consistent with the size of any initial coding feature among the multiple initial coding features. According to one aspect of the present application, the target size can be consistent with the size of the initial coding feature output by the coding module of the last level.

[0136] The coding network provided in the embodiment of the present application realizes coding at different stages through multiple cascade-connected coding modules to obtain multiple coding features of the same size, which can facilitate the subsequent fusion of multiple coding features, facilitate defect detection based on the fused coding features, and thus improve the detection accuracy to a certain extent.

[0137] Based on the encoding method described in the above embodiment, the present application also provides a structure of an encoding network, as shown in Figure 7, the encoding network includes: N encoding modules and N second convolution modules, the output end of the first encoding module is connected to the input end of the first second convolution module, the output end of the second encoding module is connected to the input end of the second second convolution module, ...., the output end of the N-1th encoding module is connected to the input end of the N-1th second convolution module, and the output end of the Nth encoding module is connected to the input end of the Nth second convolution module. In this scenario, when the computer device executes the above S402 "adjusting the size of each initial encoding feature to obtain multiple encoding features", the specific execution steps are: inputting the initial encoding features output by each encoding module into the corresponding second convolution module for size adjustment to obtain multiple encoding features; the size of each encoding feature is consistent.

[0138] The second convolution module is used to perform convolution processing on the input image, that is, to perform size adjustment or dimensionality reduction convolution processing on the input image.

[0139] In an embodiment of the present application, when the computer device obtains the initial coding feature output by the first coding module, the initial coding feature output by the first coding module is input into the corresponding first second convolution module for size adjustment to obtain the first size-adjusted coding feature; when the computer device obtains the initial coding feature output by the second coding module, the initial coding feature output by the second coding module is input into the corresponding second second convolution module for size adjustment to obtain the second size-adjusted coding feature, and so on. When the computer device obtains the initial coding feature output by the N-1th coding module, the initial coding feature output by the N-1th coding module is input into the corresponding N-1th second convolution module for size adjustment to obtain the N-1th size-adjusted coding feature; when the computer device obtains the initial coding feature output by the Nth coding module, the initial coding feature output by the Nth coding module is input into the corresponding Nth second convolution module for size adjustment to obtain the Nth size-adjusted coding feature, and the sizes of the resized first coding feature and the resized Nth coding feature are consistent.

[0140] The coding network provided in the embodiment of the present application implements N stages of coding through multiple cascaded N coding modules to obtain N coding features of the same size, which can facilitate the subsequent fusion of the N coding features, facilitate defect detection based on the fused coding features, and thus improve the detection accuracy to a certain extent.

[0141] Based on the encoding method described in the above embodiment, the present application also provides another encoding network structure, as shown in Figure 8, the encoding network includes: M+1 encoding modules and M second convolution modules, the output end of the first encoding module is connected to the input end of the first second convolution module, the output end of the second encoding module is connected to the input end of the second second convolution module, ...., the output end of the Mth encoding module is connected to the input end of the Mth second convolution module, and the M+1th encoding module has no corresponding second convolution module. In this scenario, when the computer device executes the above S402 "resize each initial encoding feature to obtain multiple encoding features", as shown in Figure 9, the specific execution steps are:

[0142] S501: Input the initial coding features output by the M coding modules into the corresponding second convolution modules for resizing to obtain M coding features.

[0143] In an embodiment of the present application, when the computer device obtains the initial coding feature output by the first coding module, the initial coding feature output by the first coding module is input into the corresponding first second convolution module for size adjustment to obtain the first size-adjusted coding feature; when the computer device obtains the initial coding feature output by the second coding module, the initial coding feature output by the second coding module is input into the corresponding second second convolution module for size adjustment to obtain the second size-adjusted coding feature, and this is performed until the computer device obtains the initial coding feature output by the Mth coding module, inputs the initial coding feature output by the Mth coding module into the corresponding Mth second convolution module for size adjustment to obtain the Mth size-adjusted coding feature, and the sizes of the resized first coding feature and the Mth coding feature are consistent.

[0144] S502: Determine the M coding features and the initial coding features output by the M+1th coding module as a plurality of coding features.

[0145] When the computer device obtains M coding features, together with the initial coding features output by the M+1th coding module, they can be used as multiple coding features, and the size of the M coding features is consistent with the size of the initial coding features output by the M+1th coding module.

[0146] The coding network provided in the embodiment of the present application implements M stages of coding through multiple cascade-connected M coding modules, obtains M coding features of the same size, and makes the size of the M coding features consistent with the size of the coding features output by the M+1th coding module. This can facilitate the subsequent fusion of the M+1 coding features, facilitate defect detection based on the fused coding features, and thus improve detection accuracy to a certain extent.

[0147] In one embodiment, a structure of a teacher network is provided, as shown in FIG11 . The student network includes: a transformation module and multiple decoding modules. Based on the student network, the above-mentioned S201 “fusing multiple encoding features and inputting them into the student network for decoding to obtain multiple decoding features”, as shown in FIG10 , includes:

[0148] S601: Multiple coding features are fused and input into a transformation module to obtain abstract features.

[0149] The transformation module is used to extract abstract features from the input image and can be a neural network model.

[0150] In an embodiment of the present application, after a computer device acquires multiple coding features, it can first fuse the multiple coding features in the channel dimension of the image to obtain a fused feature, and then input the fused feature into a transformation module for feature extraction to obtain an abstract feature, where the abstract feature can be represented by an abstract feature graph. Specifically, when fusing multiple coding features, a pre-trained fusion network can be used, or a corresponding fusion algorithm can be used.

[0151] S602: Input the abstract features into multiple decoding modules for decoding to obtain multiple decoding features.

[0152] The decoding module is a pre-trained neural network or decoder, which is used to perform image decoding on the input feature image.

[0153] In an embodiment of the present application, when a computer device obtains an abstract feature, the abstract feature can be input into multiple decoding modules for decoding, and each decoding module outputs a decoding feature to obtain multiple decoding features, or several decoding modules output a decoding feature to obtain multiple decoding features. In some embodiments, when a computer device obtains an abstract feature, the abstract feature can also be input into multiple decoding modules for encoding, and each decoding module outputs a decoding feature, or several decoding modules output a decoding feature.

[0154] The student network provided in the embodiment of the present application implements decoding at different stages through multiple decoding modules to obtain multiple decoding features, so that these multiple decoding features can correspond one-to-one with multiple encoding features, so that defect detection can be performed later by analyzing the similarity between the multiple encoding features and the multiple decoding features, thereby realizing an accurate and efficient defect detection method.

[0155] In some embodiments, the multiple decoding modules may be connected in cascade or in a non-cascaded manner. When the multiple decoding modules are connected in cascade, when the computer device executes the above-mentioned S602 "inputting the abstract feature into the multiple decoding modules for decoding to obtain multiple decoding features", the specific steps are: inputting the abstract feature into the multiple decoding modules for decoding to obtain multiple decoding features.

[0156] In an embodiment of the present application, when a computer device obtains an abstract feature, the abstract feature can be input into multiple cascade-connected decoding modules for decoding step by step, and each decoding module outputs a decoding feature to obtain multiple decoding features, or several of the decoding modules output a decoding feature to obtain multiple decoding features.

[0157] The student network provided in the embodiment of the present application implements decoding at different stages through multiple cascaded decoding modules to obtain multiple decoding features, so that these multiple decoding features can correspond one-to-one with multiple encoding features, so that defect detection can be performed later by analyzing the similarity between the multiple encoding features and the multiple decoding features, thereby realizing an accurate and efficient defect detection method.

[0158] Based on the encoding method described in the above embodiment, the present application also provides a specific connection method for multiple decoding modules, as shown in Figure 12, the multiple decoding modules include: K decoding modules, and the 1st to K-1th decoding modules of the K decoding modules are cascaded. In this scenario, when the computer device executes the above S602 "inputting the abstract features into multiple decoding modules for decoding to obtain multiple decoding features", as shown in Figure 13, the specific execution steps are:

[0159] S701: Input the abstract features into the 1st to K-1th decoding modules for decoding, and obtain decoding features output by each of the 1st to K-1th decoding modules.

[0160] In an embodiment of the present application, when the computer device obtains the abstract features output by the transformation module, it can input the abstract features into the first decoding module for decoding (feature image reconstruction) to obtain the decoded features output by the first decoding module; then continue to input the decoded features output by the first decoding module into the second decoding module for decoding (feature image reconstruction) to obtain the decoded features output by the second decoding module, and so on until the computer device inputs the decoded features output by the K-2th decoding module into the K-1th decoding module for decoding (feature image reconstruction) to obtain the decoded features output by the K-1th decoding module, and finally obtains the decoded features output by each decoding module from the 1st decoding module to the K-1th decoding module, that is, obtains K-1 decoding features.

[0161] S702: Input the encoding features output by the second encoding module in the teacher network to the Kth decoding module among the K decoding modules for decoding, to obtain the decoding features output by the Kth decoding module.

[0162] When the Kth decoding module among the K decoding modules is operating, it inputs the encoded features output by the second encoding module in the teacher network into the Kth decoding module for decoding (feature image reconstruction), thereby obtaining the decoded features output by the Kth decoding module. It should be noted that this step can be performed before the previous step S701, can be performed simultaneously with the step S701, or can be performed after the step S702.

[0163] The student network provided in the embodiments of the present application implements decoding at different stages through multiple decoding modules, obtaining multiple decoding features. These multiple decoding features can be mapped one-to-one to multiple encoding features, allowing for subsequent defect detection by analyzing the similarity between multiple encoding features and multiple decoding features, thereby achieving an accurate and efficient defect detection method. Furthermore, the input of the last decoding module is the encoding features output by the encoding module in the teacher network, which can, to a certain extent, compensate for the detailed features lost in image reconstruction during the decoding process, thereby improving the quality of the decoding features.

[0164] In one embodiment, after a computer device obtains multiple encoding features and multiple decoding features based on any of the aforementioned embodiments, the multiple encoding features and multiple decoding features may be used in some embodiments to perform defect detection on an image to be inspected. Therefore, the present application also provides a defect detection method, as shown in FIG14 , which includes:

[0165] S801: Obtain multiple similar feature images based on the similarity between each encoding feature and each decoding feature.

[0166] When a computer device obtains multiple encoding features and multiple decoding features, since the multiple encoding features and the multiple decoding features are in a one-to-one correspondence, the similarity between each decoding feature and its corresponding encoding feature is calculated. Specifically, the similarity between each pixel point on the feature map corresponding to the decoding feature and the corresponding pixel point on the feature map corresponding to the encoding feature can be calculated, and then the similar feature image is determined based on the calculated similarity of each pixel point, and finally the similar feature image corresponding to each encoding feature and each decoding feature is obtained.

[0167] S802: Fusing multiple images with similar features to obtain a target detection image.

[0168] After the computer device acquires multiple similar feature images, it can use a corresponding fusion algorithm to fuse the multiple similar feature images to obtain a fused target detection image. In some embodiments, the computer device can also first filter out some similar feature images from the multiple similar feature images according to a filtering condition, and then fuse the partial similar feature images to obtain a target detection image. When the similarity values ​​corresponding to each pixel in the similar feature image are relatively large, it indicates that the image to be detected may include defects. In this scenario, the filtering condition can be: filter out similar feature images whose similarity values ​​corresponding to each pixel in the similar feature image are all greater than a first preset similarity threshold. This can enhance the intensity of pixels corresponding to defect areas in the final target detection image, facilitating subsequent detection based on the target detection image. When the similarity values ​​corresponding to each pixel in the similar feature image are relatively small, it indicates that the image to be detected may not include defects. In this scenario, the filtering condition can be: filter out similar feature images whose similarity values ​​corresponding to each pixel in the similar feature image are all less than a second preset similarity threshold. This can enhance the intensity of pixels corresponding to non-defect areas in the target detection image, facilitating subsequent detection based on the target detection image.

[0169] In some embodiments, before fusing the above-mentioned multiple similar feature images, a step is required: resizing the multiple similar feature images to obtain multiple resized similar feature images; the size of each resized similar feature image is consistent with the size of the image to be detected.

[0170] Correspondingly, when the computer device executes the step of "fusing multiple similar feature images to obtain a target detection image", the specific execution step is: fusing multiple resized similar feature images to obtain a target detection image.

[0171] S803: Perform defect detection on the target detection image to obtain a defect area.

[0172] When a computer device obtains a target detection image, in some embodiments, the grayscale value of each pixel in the target detection image can be determined, and then the defect area in the target detection image can be determined based on the grayscale value of each pixel. Specifically, the pixels corresponding to non-zero grayscale values ​​in the target detection image can be connected, and the area formed is the defect area. In some embodiments, the pixels corresponding to grayscale values ​​greater than a preset grayscale threshold in the target detection image can also be determined as target pixels, and the area formed by connecting the target pixels can be determined as the defect area.

[0173] The embodiment of the present application fuses multiple similar feature images and then performs defect detection based on the fused similar feature images. Since the multiple similar feature images reflect the learning process of the teacher network and the student network at multiple stages, that is, reflect features at multiple scales, defect detection based on multi-scale features is achieved, which can improve the accuracy of detection to a certain extent.

[0174] Based on the above defect detection method, the present application also provides a method for training the above teacher network and student network, that is, the method described in the embodiment of FIG2 further includes the steps of:

[0175] The detection network is trained according to the sample images to obtain the teacher network and the student network.

[0176] Among them, the sample image is an image without defect areas; the detection network includes an initial teacher network and an initial student network. The embodiment of the present application relates to a training method, that is, first constructing a detection network based on the initial teacher network and the initial student network, then obtaining a sample image that does not contain defect areas, and then inputting the sample image into the detection network for training to obtain trained teacher network and student network. The training method described in this embodiment can be based on sample images that do not contain defects for training. This type of sample image is relatively easy to obtain, and the training effect can be improved to a certain extent by obtaining a large number of sample images.

[0177] In some embodiments, the training method, as shown in FIG15 , includes:

[0178] S901: Input the sample image into the initial teacher network for encoding to obtain multiple sample encoding features.

[0179] The sample image is an image of the weld area, which does not contain defects on the weld. The initial teacher network is a pre-trained neural network or encoder, which can be used to perform multi-stage image encoding on the input image and output sample coding features of each stage, that is, multiple sample coding features can be sample coding features output by the initial teacher network at different encoding stages. Each sample coding feature can be represented by a feature map. In some embodiments, the initial teacher network can also be used to encode the input image once to directly obtain multiple sample coding features, that is, multiple sample coding features can be sample coding features output by the initial teacher network at the same encoding stage.

[0180] In an embodiment of the present application, a computer device may first acquire a sample image, then input the sample image into a constructed initial teacher network for encoding at different stages, and output sample encoding features of different or same sizes at each stage or at several stages, thereby obtaining multiple sample encoding features. In some embodiments, the computer device may also input the sample image into the constructed initial teacher network for encoding at the same stage, thereby obtaining multiple sample encoding features of the same or different sizes at once.

[0181] In some embodiments, before inputting the sample images into the detection network for training, the sample images may be preprocessed, such as by downsampling. For example, the sample images may be downsampled to 1024*1024 pixels as input to the detection network. During training, 32 sample images may be randomly selected as a batch of sample images for training, and the initial learning rate may be set to 10-4.

[0182] S902: Multiple sample encoding features are fused and input into the initial student network for decoding to obtain multiple sample decoding features.

[0183] The initial student network is a neural network or decoder that performs multi-stage image decoding on the input feature image and outputs sample decoding features at each stage. In other words, the multiple sample decoding features can be sample decoding features output by the initial student network at different decoding stages. Each sample decoding feature can be represented by a feature graph. There is a one-to-one correspondence between the multiple sample encoding features and the multiple sample decoding features.

[0184] In an embodiment of the present application, after the computer device obtains multiple sample encoding features output by the initial teacher network, it can first fuse the multiple sample encoding features in the channel dimension of the image to obtain sample fusion features, and then input the sample fusion features into the initial student network for decoding at different stages, and output sample decoding features of different sizes or the same size at each stage or several stages to obtain multiple sample decoding features. In some embodiments, the computer device can also input the sample fusion features into the initial student network for decoding at the same stage, that is, disassemble the sample fusion features into multiple sample decoding features of different sizes or the same size.

[0185] S903: Determine a target image according to the plurality of sample encoding features and the plurality of sample decoding features.

[0186] When the computer device obtains multiple sample encoding features and multiple sample decoding features, it can obtain multiple sample similar feature images based on the similarity between each sample encoding feature and each sample decoding feature. Then, the multiple sample similar feature images are fused to obtain the target image.

[0187] S904: Determine a target loss based on the target image and the sample image, and train the initial teacher network and the initial student network based on the target loss to obtain a teacher network and a student network.

[0188] Once the target image is determined, a target loss can be determined based on the target image and the sample image. Specifically, the target loss can be determined by calculating the similarity between the target image and the sample image. Then, the model parameters of the initial teacher network and the initial student network can be adjusted according to the target loss until the training is completed and the trained teacher network and student network are obtained.

[0189] The training method described in this embodiment simultaneously trains the teacher network and the student network, allowing the teacher network and the student network to learn from each other, forming a self-distillation structure. This can effectively suppress the student network's sensitivity to noise to a certain extent, thereby improving the training effect and further improving the detection accuracy of the detection network composed of the trained teacher network and student network.

[0190] In summary, all the above embodiments, the present application also provides a detection network, as shown in Figure 16, the detection network includes a first convolution module, a second convolution module, a third convolution module, a first encoding module, a second encoding module, a third encoding module, a fusion module, a conversion module, a first decoding module, a second decoding module, and a third decoding module, wherein the output end of the first convolution module is connected to the first encoding module, the output end of the first encoding module is respectively connected to the second encoding module and the second convolution module, the output end of the second encoding module is respectively connected to the third encoding module and the third convolution module, the output end of the second convolution module, the output end of the third convolution module and the output end of the third encoding module are all connected to the fusion module, the output end of the fusion module is connected to the transformation module, the output end of the transformation module is connected to the first decoding module, the output end of the first decoding module is connected to the second decoding module, the output end of the second decoding module, and the output end of the second encoding module are also connected to the input end of the third decoding module.

[0191] The working principle of the above detection network is as follows: the image to be detected I is input into the first convolution module for convolution to obtain the first convolution feature J1t, the first convolution feature J1t is input into the first encoding module for encoding to obtain the first encoding feature F1t, the first encoding feature F1t is input into the second encoding module for encoding to obtain the second encoding feature F2t, and the first encoding feature F1t is input into the second convolution module for convolution to obtain the second convolution feature J2t, and the second encoding feature F2t is input into the third encoding module for encoding to obtain the third encoding feature F3t, and the second encoding feature F2t is input into the third convolution module for convolution to obtain to the third convolution feature J3t, and then the third encoding feature F3t, the second convolution feature J2t and the third convolution feature J3t are input into the fusion module for channel dimension fusion to obtain the fusion feature R, and then the fusion feature R is input into the conversion module for abstract feature extraction to obtain the abstract feature C, and finally the abstract feature C is input into the first decoding module for decoding to obtain the first decoding feature FS1, and the first decoding feature FS1 is input into the second decoding module for decoding to obtain the second decoding feature F2S; in some embodiments, the second encoding feature F2t output by the second encoding module is input into the third decoding module for decoding to obtain the third decoding feature F3S. Then, the similarity between the feature map corresponding to the first decoding feature FS1 and the feature map corresponding to the first encoding feature F1t is calculated to determine the first similar feature image corresponding to the first decoding feature FS1 and the first encoding feature F1t; the similarity between the feature map corresponding to the second decoding feature F2S and the feature map corresponding to the second encoding feature F2t is calculated to determine the second similar feature image corresponding to the second decoding feature F2S and the second encoding feature F2t; the similarity between the feature map corresponding to the third decoding feature F3S and the feature map corresponding to the third encoding feature F3t is calculated to determine the third similar feature image corresponding to the third decoding feature F3S and the third encoding feature F3t. Finally, the first similar feature image, the second similar feature image, and the third similar feature image are fused to obtain a target detection image, and defect detection is performed based on the target detection image to determine the defect area in the image to be detected. It should be noted that when calculating the similarity between the feature maps mentioned above, the cosine similarity can be calculated point by point. For example, the point-by-point cosine similarity Cos(FiS, Fit) between FiS and the feature Fit is calculated, and then the corresponding similar feature image is determined based on the point-by-point cosine similarity. Using this method for defect image detection can improve weld bead location accuracy by approximately 20%, and noise suppression accuracy by approximately 10% to 15%. The images of the detected defect areas can then be used to assist personnel in labeling defects in real weld bead images, reducing manual labeling time by approximately 50%.

[0192] The defect detection method provided in an embodiment of the present application comprises inputting an image to be detected into a plurality of encoding modules connected in a tiered manner for encoding, thereby obtaining a plurality of encoding features, fusing the plurality of encoding features and inputting the plurality of decoding modules connected in a tiered manner for decoding, thereby obtaining a plurality of decoding features, and determining the defect region in the image to be detected based on the plurality of encoding features and the plurality of decoding features. The above-mentioned defect detection method performs unsupervised learning by establishing an asymmetric decoding module based on the output of the encoding module. This allows the encoding module and the decoding module to reduce noise sensitivity to a certain extent during the learning process, thereby improving the accuracy of defect detection.

[0193] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0194] Based on the same inventive concept, the present application also provides a defect detection device for implementing the aforementioned defect detection method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more defect detection device embodiments provided below can be found in the above-mentioned limitations of the defect detection method and will not be repeated here.

[0195] In one embodiment, as shown in FIG17 , a defect detection device is provided, comprising:

[0196] The encoding module 10 is used to input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0197] A decoding module 11 is used to fuse the multiple encoding features and input them into the student network for decoding to obtain multiple decoding features;

[0198] The detection module 12 is configured to determine a defective area in the image to be detected based on the multiple encoding features and the multiple decoding features.

[0199] Each module in the aforementioned defect detection device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a computer device memory in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0200] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0201] Input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0202] The plurality of encoding features are fused and input into the student network for decoding to obtain a plurality of decoding features;

[0203] Determine a defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.

[0204] The computer device provided in the above embodiment has an implementation principle and technical effects similar to those of the above method embodiment, and will not be described in detail here.

[0205] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0206] Input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0207] The plurality of encoding features are fused and input into the student network for decoding to obtain a plurality of decoding features;

[0208] Determine a defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.

[0209] The above embodiment provides a computer-readable storage medium, whose implementation principle and technical effects are similar to those of the above method embodiment, and will not be repeated here.

[0210] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0211] Input the image to be detected into the teacher network for encoding to obtain multiple encoding features;

[0212] The plurality of encoding features are fused and input into the student network for decoding to obtain a plurality of decoding features;

[0213] Determine a defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.

[0214] The above embodiment provides a computer program product, whose implementation principle and technical effects are similar to those of the above method embodiment, and will not be repeated here.

[0215] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited to these.

[0216] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0217] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A defect detection method, wherein: The method comprises: Input the image to be detected into the teacher network for encoding to obtain multiple encoding features; The plurality of encoding features are fused and input into the student network for decoding to obtain a plurality of decoding features; Determine a defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.

2. The method according to claim 1, wherein: The teacher network includes: a first convolution module and an encoding network. The image to be detected is input into the teacher network for encoding to obtain multiple encoding features, including: Inputting the image to be detected into the first convolution module to obtain convolution features; The convolutional features are input into the encoding network for encoding to obtain the multiple encoding features.

3. The method according to claim 2, wherein: The encoding network includes a plurality of encoding modules, the plurality of encoding modules are cascaded, and the convolutional features are input into the encoding network for encoding to obtain the plurality of encoding features, including: The convolutional features are input into the multiple encoding modules for encoding to obtain the multiple encoding features.

4. The method according to claim 3, wherein: The step of inputting the convolutional features into the multiple encoding modules for encoding to obtain the multiple encoding features includes: Inputting the convolutional features into the multiple encoding modules for encoding to obtain multiple initial encoding features; The size of each of the initial coding features is adjusted to obtain the multiple coding features.

5. The method according to claim 4, wherein: The encoding network includes: N encoding modules and N second convolution modules, the output end of the Nth encoding module is connected to the input end of the Nth second convolution module, and the size of each of the initial encoding features is adjusted to obtain the multiple encoding features, including: The initial coding features output by each coding module are input into the corresponding second convolution module for size adjustment to obtain the plurality of coding features; the size of each coding feature is consistent.

6. The method according to claim 4, wherein: The encoding network includes: M+1 encoding modules and M second convolution modules, the output end of the Mth encoding module is connected to the input end of the Mth second convolution module, and the size of each of the initial encoding features is adjusted to obtain the multiple encoding features, including: The initial coding features output by the M coding modules are respectively input into the corresponding second convolution modules for size adjustment to obtain M coding features; The M coding features and the initial coding features output by the M+1th coding module are determined as the multiple coding features.

7. The method according to claim 1, wherein: The student network includes: a transformation module and multiple decoding modules. The multiple encoding features are fused and input into the student network for decoding to obtain multiple decoding features, including: The plurality of coded features are fused and input into the transformation module to obtain an abstract feature; The abstract features are input into the multiple decoding modules for decoding to obtain the multiple decoding features.

8. The method according to claim 7, wherein: The multiple decoding modules are cascade-connected, and the abstract features are input into the multiple decoding modules for decoding to obtain the multiple decoding features, including: The abstract features are input into the multiple decoding modules for decoding to obtain the multiple decoding features.

9. The method according to claim 7, wherein: The multiple decoding modules include K decoding modules, the first decoding module to the K-1th decoding module of the K decoding modules are cascade-connected, and the abstract features are input into the multiple decoding modules for decoding to obtain the multiple decoding features, including: Inputting the abstract features into the first decoding module to the K-1th decoding module for decoding, and obtaining decoding features output by each decoding module in the first decoding module to the K-1th decoding module; The encoding features output by the second encoding module in the teacher network are input into the Kth decoding module among the K decoding modules for decoding, so as to obtain the decoding features output by the Kth decoding module.

10. The method according to any one of claims 1 to 9, wherein: The step of determining the defect area in the image to be detected according to the plurality of encoding features and the plurality of decoding features comprises: According to the similarity between each of the encoding features and each of the decoding features, a plurality of similar feature images are obtained; Fusing the multiple similar feature images to obtain a target detection image; Defect detection is performed on the target detection image to obtain the defect area.

11. The method according to claim 10, wherein: The performing defect detection on the target detection image to obtain the defect area includes: Determine the pixel point corresponding to the gray value greater than the preset gray value threshold as the target pixel point; An area formed by connecting the target pixels is determined as the defect area.

12. The method according to claim 10, wherein: The method further comprises: resizing the multiple similar feature images to obtain multiple resized similar feature images; the size of each resized similar feature image is consistent with the size of the image to be detected; The fusing the multiple similar feature images to obtain the target detection image includes: The multiple resized similar feature images are fused to obtain the target detection image.

13. The method according to claim 1, wherein: The method further comprises: The detection network is trained according to a sample image to obtain the teacher network and the student network; the sample image is an image without defect areas; the detection network includes an initial teacher network and an initial student network.

14. The method according to claim 13, wherein: The step of training the detection network according to the sample image to obtain the teacher network and the student network includes: Inputting the sample image into the initial teacher network for encoding to obtain a plurality of sample encoding features; The plurality of sample encoding features are fused and input into the initial student network for decoding to obtain a plurality of sample decoding features; Determine a target image according to the plurality of sample encoding features and the plurality of sample decoding features; A target loss is determined according to the target image and the sample image, and the initial teacher network and the initial student network are trained according to the target loss to obtain the teacher network and the student network.

15. A defect detection device, wherein: The device comprises: The encoding module is used to input the image to be detected into the teacher network for encoding to obtain multiple encoding features; A decoding module, used for fusing the plurality of encoding features and inputting them into the student network for decoding to obtain a plurality of decoding features; A detection module is used to determine the defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.

16. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 14 are implemented.

17. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

Citation Information

Patent Citations

  • Image processing method and device, equipment and storage medium

    CN113689383A

  • Defect detection method and device, defect training method and device, storage medium and equipment

    CN115375618A

  • Knowledge distillation anomaly detection method based on U-shaped student network

    CN115471645A

  • Defect detection method, device and equipment and storage medium

    CN116228654A

  • Defect detection method and device, computer equipment and storage medium

    CN116523917A

Cited By

  • Indexable blade defect detection method, electronic equipment and medium

    CN119559182A

  • Defect detection model training method, defect detection method, device and equipment

    CN120510154A

  • Defect detecting and positioning method based on regional anomaly generation and multi-level reverse distillation

    CN121527502A