WO2025007516A1 - 缺陷检测方法、装置、计算机设备和存储介质 - Google Patents

缺陷检测方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2025007516A1
WO2025007516A1 PCT/CN2023/138847 CN2023138847W WO2025007516A1 WO 2025007516 A1 WO2025007516 A1 WO 2025007516A1 CN 2023138847 W CN2023138847 W CN 2023138847W WO 2025007516 A1 WO2025007516 A1 WO 2025007516A1
Authority
WO
WIPO (PCT)
Prior art keywords
features
encoding
decoding
network
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2023/138847
Other languages
English (en)
French (fr)
Inventor
吴凯
江冠南
王智玉
束岸楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Contemporary Amperex Technology Co Ltd
Original Assignee
Contemporary Amperex Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Contemporary Amperex Technology Co Ltd filed Critical Contemporary Amperex Technology Co Ltd
Publication of WO2025007516A1 publication Critical patent/WO2025007516A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00—Image analysis
    • G06T7/0002—Inspection of images, e.g. flaw detection
    • G06T7/0004—Industrial image inspection
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00—Computing arrangements based on biological models
    • G06N3/02—Neural networks
    • G06N3/04—Architecture, e.g. interconnection topology
    • G06N3/045—Combinations of networks
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00—Computing arrangements based on biological models
    • G06N3/02—Neural networks
    • G06N3/04—Architecture, e.g. interconnection topology
    • G06N3/0464—Convolutional networks [CNN, ConvNet]
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00—Computing arrangements based on biological models
    • G06N3/02—Neural networks
    • G06N3/08—Learning methods
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00—Image coding
    • G06T9/002—Image coding using neural networks
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00—Arrangements for image or video recognition or understanding
    • G06V10/40—Extraction of image or video features
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00—Arrangements for image or video recognition or understanding
    • G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/806—Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00—Arrangements for image or video recognition or understanding
    • G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00—Indexing scheme for image analysis or image enhancement
    • G06T2207/20—Special algorithmic details
    • G06T2207/20081—Training; Learning
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00—Indexing scheme for image analysis or image enhancement
    • G06T2207/20—Special algorithmic details
    • G06T2207/20084—Artificial neural networks [ANN]
    • Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30—Computing systems specially adapted for manufacturing

Definitions

  • Sealing pin welding is an indispensable part of the power battery production process. Whether the sealing pin welding meets the standards directly affects the safety of the battery.
  • the sealing pin welding area is called the weld bead. Due to changes in temperature and environment during welding, there are often defects such as pinholes, burst points, burst lines (false welds), missing welds, and melt beads on the weld bead. Defects on the weld bead will directly affect the quality of the sealing pin welding. Therefore, defect detection for the weld bead is very important.
  • the present application provides a defect detection method.
  • the method comprises:
  • the defect detection method inputs the image to be detected into the teacher network for encoding to obtain multiple encoding features, and fuses the multiple encoding features and inputs them into the student network for decoding to obtain multiple decoding features, and determines the defect area in the image to be detected based on the multiple encoding features and the multiple decoding features.
  • the above defect detection method establishes an asymmetric student network on the output of the teacher network for unsupervised learning, which is different from the traditional teacher network and student network.
  • the detection algorithm in which the teacher network and the student network learn independently can enable the teacher network and the student network to reduce the sensitivity to noise to a certain extent during the learning process, thereby improving the accuracy of defect detection.
  • the teacher network includes: a first convolution module and a plurality of encoding modules, the plurality of encoding modules are cascaded, and the image to be detected is input into the teacher network for encoding to obtain a plurality of encoding features, including:
  • the convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features.
  • 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 later defect detection based on multiple encoding features, thereby improving the detection accuracy to a certain extent.
  • the convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features, including:
  • the convolutional features are input into multiple encoding modules for encoding to obtain multiple initial encoding features
  • each initial coding feature is adjusted to obtain multiple coding features.
  • 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 different sizes or the same size, which can provide rich feature information for subsequent defect detection based on multiple coding features, thereby improving the detection accuracy to a certain extent.
  • the encoding network includes multiple encoding modules, and the multiple encoding modules are cascaded.
  • the convolutional features are input into the encoding network for encoding to obtain multiple encoding features, including:
  • the convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features.
  • 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.
  • the convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features, including:
  • the convolutional features are input into multiple encoding modules for encoding to obtain multiple initial encoding features
  • each initial coding feature is adjusted to obtain multiple coding features.
  • 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.
  • 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 initial encoding feature is adjusted to obtain 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 multiple coding features; the size of each coding feature is consistent.
  • 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.
  • 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 initial encoding feature is adjusted to obtain 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 a plurality of coding features.
  • the coding network implemented in the embodiment of the present application implements M stages of coding through multiple cascaded 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, which can facilitate the subsequent fusion of the M+1 coding features, facilitate defect detection based on the fused coding features, and thus improve the detection accuracy to a certain extent.
  • the student network includes: a transformation module and multiple decoding modules, and multiple encoding features are fused and input into the student network for decoding to obtain multiple decoding features, including:
  • the abstract features are input into multiple decoding modules for decoding to obtain multiple decoding features.
  • 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 multiple encoding features and multiple decoding features, thereby realizing an accurate and efficient defect detection method.
  • multiple decoding modules are cascaded, and the abstract features are input into the multiple decoding modules for decoding to obtain multiple decoding features, including:
  • the abstract features are input into multiple decoding modules for decoding to obtain multiple decoding features.
  • 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 multiple encoding features and multiple decoding features, thereby realizing an accurate and efficient defect detection method.
  • the multiple decoding modules include K decoding modules, the first decoding module to the K-1th decoding module of the K decoding modules are cascaded, and the abstract features are input to the multiple decoding modules for decoding to obtain multiple decoding features, including:
  • 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;
  • the encoded 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 decoded features output by the Kth decoding module.
  • the student network provided in the embodiment of the present application realizes decoding at different stages through multiple decoding modules, obtains multiple decoding features, and makes these multiple decoding features correspond one-to-one with multiple encoding features, so that defect detection can be performed later by analyzing the similarity between multiple encoding features and multiple decoding features, thereby realizing an accurate and efficient defect detection method.
  • the input of the last decoding module is the encoding feature output by the encoding module in the teacher network, which can make up for the detail features lost in the image reconstruction during the decoding process to a certain extent, thereby improving the quality of the decoding features.
  • determining a defect area in an image to be detected based on a plurality of encoding features and a plurality of decoding features includes:
  • 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 of multiple scales, defect detection based on multi-scale features is achieved, which can improve the detection accuracy to a certain extent.
  • defect detection is performed on the target detection image to obtain a defect area, including:
  • the area formed by connecting target pixels is determined as the defect area.
  • the embodiment of the present application detects defective areas by connecting pixel points that are greater than a preset grayscale threshold. This method is simple and efficient and can improve detection accuracy to a certain extent.
  • the method further comprises:
  • each resized similar feature image is consistent with the size of the image to be detected
  • Multiple images with similar features are fused to obtain the target detection image, including:
  • 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 detection accuracy in the later stage.
  • the method further comprises:
  • 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.
  • the training method described in this embodiment can be trained 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.
  • the detection network is trained according to the sample image to obtain a teacher network and a student network, including:
  • the multiple sample encoding features are fused and input into the initial student network for decoding to obtain multiple sample decoding features;
  • a target loss is determined according to the target image and the sample image, and an initial teacher network and an initial student network are trained according to the target loss to obtain a teacher network and a student network.
  • the training method described in this embodiment simultaneously trains the teacher network and the student network so that the teacher network and the student network learn from each other to form a self-distillation structure, which 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.
  • the present application also provides a defect detection device.
  • 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 is used to fuse multiple encoding features and input them into the student network for decoding to obtain multiple decoding features
  • 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.
  • the present application further provides a computer device.
  • the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
  • the present application further provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
  • the present application further provides a computer program product.
  • the computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
  • FIG1 is a diagram showing the internal structure of a computer device in one embodiment
  • FIG2 is a schematic diagram of a defect detection method in one embodiment
  • FIG3 is a schematic flow chart of a defect detection method in another embodiment
  • FIG4 is a schematic diagram of a structure of an implementation method of a teacher network in one embodiment
  • FIG5 is a schematic diagram of a structure of an implementation of a coding network in an embodiment
  • FIG6 is a schematic flow chart of a defect detection method in another embodiment
  • FIG7 is a schematic diagram of a structure of an implementation of a coding network in one embodiment
  • FIG8 is a schematic diagram of the structure of another implementation of a coding network in one embodiment
  • FIG9 is a schematic flow chart of a defect detection method in another embodiment
  • FIG10 is a schematic flow chart of a defect detection method in another embodiment
  • FIG11 is a schematic diagram of a structure of an implementation of a student network in one embodiment
  • FIG12 is a schematic diagram of the structure of another implementation of a student network in one embodiment
  • FIG13 is a schematic flow chart of a defect detection method in another embodiment
  • FIG14 is a schematic flow chart of a defect detection method in another embodiment
  • FIG15 is a flow chart of a training method in another embodiment
  • FIG16 is a schematic diagram of the structure of a detection network in one embodiment
  • FIG. 17 is a block diagram of a defect detection device in one embodiment.
  • the methods for detecting weld defects are mainly based on artificial intelligence (AI), which can automatically detect whether there are defects on the weld or the type of defects.
  • AI artificial intelligence
  • the existing methods usually use a teacher-student structure of 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 final detected weld defect area is not accurate.
  • the application provides a defect detection method, which aims to solve the above technical problems. The following embodiments will describe the defect detection method described in the application in detail.
  • the defect detection method provided in the embodiment of the present application can be applied to the computer device shown in Figure 1.
  • the computer device can be a terminal, and its internal structure diagram can be shown in Figure 1.
  • the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, 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 the 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, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies.
  • WIFI wireless fidelity
  • NFC near field communication
  • the display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen
  • the input device of the computer device can be a touch layer covered on the display screen, or a key, a trackball or a touchpad set on the housing of the computer device, or an external keyboard, touchpad or mouse.
  • FIG. 1 is merely a block diagram of a partial 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.
  • a defect detection method is provided, which is described by taking the method applied to the computer device in FIG1 as an example, and includes the following steps:
  • the image to be detected 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, which can be used to perform multi-stage image encoding on the input image and output the encoding features of each stage, that is, multiple encoding features can be encoding features output by the teacher network at different encoding stages.
  • Each encoding feature can be represented by a feature map.
  • the teacher network can also be used to encode the input image once and directly obtain multiple encoding features, that is, multiple encoding features can be encoding features output by the teacher network at the same encoding stage.
  • the computer device may first obtain an image of the weld area during the battery production process, i.e., the image to be detected.
  • the image to be detected may or may not contain weld defects.
  • the computer device may also input the image to be detected into a pre-trained teacher network for encoding at different stages, and output encoding features of different sizes or the same size at each stage or at several stages to obtain multiple encoding features.
  • the computer device can also input the image to be detected into a pre-trained teacher network for encoding at the same stage, and obtain multiple encoding features of the same size or different sizes at one time.
  • the student network is a pre-trained neural network or decoder, which is used to perform multi-stage image decoding on the input feature image and output the decoding features of each stage, that is, 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.
  • the multiple coding features can be first fused in the channel dimension of the image to obtain fused features, and then the fused features are input into a pre-trained student network for decoding at different stages, and decoding features of different sizes or the same size are output at each stage or several stages to obtain multiple decoding features.
  • the computer device can also input the fused features into a pre-trained student network for decoding at the same stage, that is, to decompose the fused features into multiple decoding features of different sizes or the same size.
  • S203 Determine a defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.
  • the computer device after the computer device acquires multiple coding features and multiple decoding features based on the aforementioned steps, it can calculate a similarity feature map between each coding feature and the corresponding decoding feature, and then calculate a target similarity feature map based on the similarity feature maps 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 of the similarity feature maps from the multiple similarity feature maps according to a filtering condition, 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.
  • the screening condition can be: screen out the similarity feature map whose similarity value corresponding to each pixel point in the similarity feature map is 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 value corresponding to each pixel point in the similarity feature map is relatively small, it means that the image to be detected may not include defects.
  • the screening condition can be: screen out the similarity feature map whose similarity value corresponding to each pixel point in the similarity feature map is 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.
  • the defect detection method provided in the embodiment of the present application obtains multiple encoding features by inputting the image to be detected into the teacher network for encoding, and obtains multiple decoding features after fusing the multiple encoding features and inputting them into the student network for decoding, and determines the defect area in the image to be detected 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 the student network are independently learned, the teacher network and the student network can each reduce the sensitivity to noise to a certain extent during the learning process, thereby improving the accuracy of defect detection.
  • a structure of a teacher network is provided, as shown in FIG4 , the teacher network includes: a first convolution module and an encoding network.
  • the above S201 “inputting the image to be detected into the teacher network for encoding to obtain multiple encoding features”, as shown in FIG3 includes:
  • the first convolution module is used to perform convolution processing on the input image, that is, to perform size adjustment or dimension reduction convolution processing on the input image.
  • the image to be detected when the 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.
  • 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.
  • the convolutional feature when a computer device obtains a convolutional feature, the convolutional feature can be input into a pre-trained coding network for encoding at different stages, and coding features of different sizes or the same size can be output at each stage or at several stages to obtain multiple coding features.
  • multiple convolutional features when a computer device obtains multiple convolutional features, multiple convolutional features can also be simultaneously input into a pre-trained coding network for encoding at the same stage to obtain multiple coding features of the same size or different sizes at one time.
  • 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 later defect detection based on multiple encoding features, thereby improving the detection accuracy to a certain extent.
  • a structure of a coding network is further provided, as shown in FIG5 , the coding network includes a plurality of coding modules, and the plurality of coding modules are cascaded.
  • the computer device executes the above S302 When “the convolutional features are input into the encoding network for encoding to obtain multiple encoding features”, the specific execution steps are: the convolutional features are input into multiple encoding modules for encoding to obtain multiple encoding features.
  • the convolution feature when a computer device obtains a convolution feature, can be input into a plurality of cascade-connected encoding modules for encoding step by step, and each encoding module outputs an encoding feature to obtain a plurality of encoding features, or several of the encoding modules output an encoding feature to obtain a plurality of encoding features.
  • the plurality of convolution features when a computer device obtains a plurality of convolution features, can also be simultaneously input into a plurality of encoding modules for encoding step by step, and each encoding module outputs a plurality of encoding features, or several of the encoding modules output a plurality of encoding features.
  • 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 different sizes or the same size, which can provide rich feature information for subsequent defect detection based on multiple coding features, thereby improving the detection accuracy to a certain extent.
  • a method for encoding using multiple encoding modules is further provided, that is, when the computer device executes the above step of "inputting the convolutional features into multiple encoding modules for encoding to obtain multiple encoding features", as shown in FIG6, the specific execution steps are:
  • the convolution feature when a computer device obtains a convolution feature, can be input into a plurality of cascade-connected coding modules for step-by-step coding, and each coding module outputs an initial coding feature to obtain a plurality of initial coding features, or several of the coding modules output initial coding features to obtain a plurality of initial coding features.
  • the plurality of convolution features when a computer device obtains a plurality of convolution features, can also be simultaneously input into a plurality of coding modules for step-by-step coding, and each coding module outputs a plurality of initial coding features, or several of the coding modules output a plurality of initial coding features.
  • the size of each coding feature can be adjusted to a target size.
  • the target size can be determined based on actual detection requirements or coding requirements.
  • the target size can be consistent with the size of any initial coding feature among multiple initial coding features.
  • the target size can be consistent with the size of the initial coding feature output by the coding module of the last level.
  • 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.
  • 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.
  • the second convolution module is used to perform convolution processing on the input image, that is, to perform size adjustment or dimension reduction convolution processing on the input image.
  • the initial coding feature output by the first coding module 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, until 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 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.
  • 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.
  • the computer device executes the above S402 "resizing each initial encoding feature to obtain multiple encoding features"
  • the specific execution steps are:
  • the initial coding feature output by the first coding module 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.
  • S502 Determine the M coding features and the initial coding features output by the M+1th coding module as a plurality of coding features.
  • the computer device 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 together, 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.
  • the coding network implemented in the embodiment of the present application implements M stages of coding through multiple cascaded 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, which can facilitate the subsequent fusion of the M+1 coding features, facilitate defect detection based on the fused coding features, and thus improve the detection accuracy to a certain extent.
  • a structure of a teacher network is provided, as shown in FIG11 , and the student network includes: a transformation module and multiple decoding modules.
  • the above S201 “inputting multiple encoding features into the student network for decoding to obtain multiple decoding features after fusing them”, as shown in FIG10 includes:
  • the transformation module is used to extract abstract features from the input image.
  • the transformation module can be a neural network model.
  • the multiple coding features can be first fused in the channel dimension of the image to obtain fused features, and then the fused features are input into the transformation module for feature extraction to obtain abstract features, where the abstract features can be represented by abstract feature graphs.
  • a pre-trained fusion network can be used, or a corresponding fusion algorithm can be used.
  • the decoding module is a pre-trained neural network or decoder, which is used to perform image decoding on the input feature image.
  • the abstract feature when a computer device obtains an abstract feature, can be input into a plurality of decoding modules for decoding, and each decoding module outputs a decoding feature to obtain a plurality of decoding features, or several of the decoding modules output a decoding feature to obtain a plurality of decoding features.
  • the abstract feature when a computer device obtains an abstract feature, can also be input into a plurality of decoding modules for encoding, and each decoding module outputs a decoding feature, or several of the decoding modules output a decoding feature.
  • 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 multiple encoding features and multiple decoding features, thereby realizing an accurate and efficient defect detection method.
  • the above-mentioned multiple decoding modules can be connected in cascade or in non-cascade connection.
  • the computer device executes the above-mentioned S602 "inputting the abstract features into the multiple decoding modules for decoding to obtain multiple decoding features"
  • the specific execution steps are: inputting the abstract features into the multiple decoding modules for decoding to obtain multiple decoding features.
  • the abstract feature when a computer device acquires 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.
  • 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 multiple encoding features and multiple decoding features, thereby realizing an accurate and efficient defect detection method.
  • the present application also provides a specific connection method of multiple decoding modules, as shown in FIG12, the multiple decoding modules include: K decoding modules, the 1st to the K-1th decoding modules of the K decoding modules Block cascade connection.
  • the specific execution steps are:
  • S701 input the abstract feature to the 1st decoding module to the K-1th decoding module for decoding, and obtain the decoding feature output by each decoding module in the 1st decoding module to the K-1th decoding module.
  • the computer device 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 first decoding module to the K-1th decoding module, that is, obtains K-1 decoding features.
  • the encoding features output by the second encoding module in the previous teacher network are input to the Kth decoding module for decoding (feature image reconstruction), and the decoding features output by the Kth decoding module are obtained. 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.
  • the student network provided in the embodiment of the present application realizes decoding at different stages through multiple decoding modules, obtains multiple decoding features, and makes these multiple decoding features correspond one-to-one with multiple encoding features, so that defect detection can be performed later by analyzing the similarity between multiple encoding features and multiple decoding features, thereby realizing an accurate and efficient defect detection method.
  • the input of the last decoding module is the encoding feature output by the encoding module in the teacher network, which can make up for the detail features lost in the image reconstruction during the decoding process to a certain extent, thereby improving the quality of the decoding features.
  • the present application also provides a defect detection method, as shown in FIG14, the method comprising:
  • the similarity between each decoding feature and its corresponding coding feature is calculated. Specifically, the similarity between each pixel point on the feature map corresponding to the decoding feature and each pixel point on the feature map corresponding to the coding feature can be calculated. Similarity is then calculated, and a similar feature image is determined according to the similarity of each pixel point, and finally a similar feature image corresponding to each encoding feature and each decoding feature is obtained.
  • the computer device 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 the filtering conditions, and then fuse some similar feature images to obtain the target detection image.
  • the similarity value corresponding to each pixel in the similar feature image is relatively large, it means that the image to be detected may include defects.
  • 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 the first preset similarity threshold, which can enhance the intensity of the pixel points corresponding to the defect area in the final target detection image, which is convenient for later detection based on the target detection image; when the similarity value corresponding to each pixel in the similar feature image is relatively small, it means that the image to be detected may not include defects.
  • 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 the second preset similarity threshold, which can enhance the intensity of the pixel points corresponding to the non-defect area in the target detection image, which is convenient for later detection based on the target detection image.
  • a step needs to be performed: 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 specific execution step is: fusing multiple resized similar feature images to obtain a target detection image.
  • 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 according to the grayscale value of each pixel.
  • the pixel points corresponding to the non-zero grayscale value in the target detection image can be connected, and the formed area is the defect area; in some embodiments, the pixel points corresponding to the grayscale value greater than the preset grayscale threshold in the target detection image can also be determined as the target pixel points, and then the area formed by connecting the target pixel points is determined as the defect area.
  • 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 of multiple scales, defect detection based on multi-scale features is achieved, which can improve the detection accuracy to a certain extent.
  • 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:
  • the detection network is trained according to the sample images 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.
  • the embodiment of the present application relates to a training method, that is, firstly constructing a detection network according to 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 a trained teacher network and a 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.
  • the training method includes:
  • S901 input the sample image into the initial teacher network for encoding to obtain multiple sample encoding features.
  • 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.
  • 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.
  • the computer device may first obtain a sample image, and then input the sample image into the constructed initial teacher network for encoding at different stages, and output sample encoding features of different sizes or the same size at each stage or at several stages to obtain multiple sample encoding features.
  • the computer device may also input the sample image into the constructed initial teacher network for encoding at the same stage to obtain multiple sample encoding features of the same size or different sizes at one time.
  • the sample images before inputting the sample images into the detection network for training, may be preprocessed, such as downsampling, for example, downsampling the sample images to a size of 1024*1024 as the input of the detection network.
  • downsampling for example, downsampling the sample images to a size of 1024*1024 as the input of the detection network.
  • 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.
  • the initial student network is a neural network or decoder, which is used to perform multi-stage image decoding on the input feature image and output sample decoding features of each stage, that is, multiple sample decoding features can be the initial student network in different The sample decoding features output in the same decoding stage.
  • Each sample decoding feature can be represented by a feature graph. Multiple sample encoding features correspond to multiple sample decoding features in a one-to-one relationship.
  • the multiple sample encoding features can be first fused in the channel dimension of the image to obtain sample fusion features, and then the sample fusion features are input into the initial student network for decoding at different stages, and sample decoding features of different sizes or the same size are output at each stage or several stages to obtain multiple sample decoding features.
  • the computer device can also input the sample fusion features into the initial student network for decoding at the same stage, that is, to decompose the sample fusion features into multiple sample decoding features of different sizes or the same size.
  • multiple sample similar feature images can be obtained according to the similarity between each sample coding feature and each sample decoding feature, and then the multiple sample similar feature images are fused to obtain the target image.
  • a target loss can be determined based on the target image and the sample image.
  • 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 to obtain the trained teacher network and student network.
  • the training method described in this embodiment simultaneously trains the teacher network and the student network so that the teacher network and the student network learn from each other to form a self-distillation structure, which 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.
  • 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, and the output
  • the working principle of the above detection network is as follows: the image I to be detected 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 input the third encoding feature F3t, the second convolution feature J2t and the third convolution feature J3t into the fusion module for channel dimension fusion to obtain the fusion feature R
  • the similarity between the feature map corresponding to the first decoding feature FS1 and the feature map corresponding to the first coding feature F1t is calculated to determine the first similar feature image corresponding to the first decoding feature FS1 and the first coding feature F1t;
  • the similarity between the feature map corresponding to the second decoding feature F2S and the feature map corresponding to the second coding feature F2t is calculated to determine the second similar feature image corresponding to the second decoding feature F2S and the second coding feature F2t;
  • the similarity between the feature map corresponding to the third decoding feature F3S and the feature map corresponding to the third coding feature F3t is calculated to determine the third similar feature image corresponding to the third decoding feature F3S and the third coding feature F3t, and finally the first similar feature image, the second similar feature image and the third similar feature image are fused to obtain the 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.
  • 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.
  • the accuracy of weld area positioning can be improved by about 20%, and the accuracy of weld area positioning can be improved by about 10% to 15% in terms of noise suppression.
  • the images of the detected defect areas can then be used to assist relevant personnel in marking defects on real weld images, and the time consumption of manual marking can be reduced by about 50%.
  • the defect detection method provided in the embodiment of the present application is to input the image to be detected into multiple encoding modules connected in stages for encoding to obtain multiple encoding features, and then fuse the multiple encoding features and input them into multiple decoding modules connected in stages for decoding to obtain multiple decoding features, and determine the defect area in the image to be detected based on the multiple encoding features and the multiple decoding features.
  • the above defect detection method is to establish an asymmetric decoding module on the output of the encoding module for unsupervised detection. Supervised learning can enable the encoding module and the decoding module to reduce the sensitivity of noise to a certain extent during the learning process, thereby improving the accuracy of defect detection.
  • steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed 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 part of the steps or stages in other steps.
  • the embodiment of the present application also provides a defect detection device for implementing the defect detection method involved above.
  • the implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more defect detection device embodiments provided below can refer to the limitations on the defect detection method above, and will not be repeated here.
  • a defect detection device comprising:
  • the encoding module 10 is used to input the image to be detected into the teacher network for encoding to obtain multiple encoding features;
  • 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;
  • the detection module 12 is used to determine the defect area in the image to be detected according to the multiple encoding features and the multiple decoding features.
  • Each module in the above defect detection device can be implemented in whole or in part by software, hardware, or a combination thereof.
  • Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
  • a computer device 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:
  • the plurality of encoding features are fused and input into the student network for decoding to obtain a plurality of decoding features
  • the above embodiment provides a computer device, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.
  • a computer readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
  • the plurality of encoding features are fused and input into the student network for decoding to obtain a plurality of decoding features
  • the above embodiment provides a computer-readable storage medium, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.
  • a computer program product comprising a computer program, which, when executed by a processor, implements the following steps:
  • the plurality of encoding features are fused and input into the student network for decoding to obtain a plurality of decoding features
  • the above embodiment provides a computer program product, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.
  • any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory.
  • Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc.
  • Volatile memory can include random access memory (RAM) or external cache memory, etc.
  • RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • the database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database.
  • Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this.
  • the processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Mathematical Physics (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

本申请涉及一种缺陷检测方法、装置、计算机设备和存储介质。所述方法通过将待检测图像输入至教师网络进行编码,得到多个编码特征,以及将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征,并根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。上述缺陷检测方法通过将非对称的学生网络建立在教师网络的输出上进行无监督学习,相比于传统教师网络和学生网络独立进行学习的检测算法,可以使教师网络和学生网络各自在学习过程中能够在一定程度上降低噪声的敏感性,从而提高缺陷检测的准确性。

Description

缺陷检测方法、装置、计算机设备和存储介质
交叉引用
本申请引用于2023年7月4日递交的名称为“缺陷检测方法、装置、计算机设备和存储介质”的第202310806554X号中国专利申请,其通过引用被全部并入本申请。
技术领域
本申请涉及电池检测技术领域,特别是涉及一种缺陷检测方法、装置、计算机设备和存储介质。
背景技术
密封钉焊接是动力电池生产过程中不可或缺的环节,密封钉焊接是否达标直接影响电池的安全。密封钉焊接区域称为焊道,由于焊接时候的温度、环境等变化,焊道上常常存在针孔、爆点、爆线(虚焊)、缺焊、融珠等缺陷。而焊道上的缺陷会直接影响密封钉焊接的质量,因此,针对焊道的缺陷检测是十分重要的。
然而,现有的焊道的缺陷检测方法存在检测不准确的问题。
发明内容
基于此,有必要针对上述技术问题,提供一种能够提高检测准确性的缺陷检测方法、装置、计算机设备和存储介质。
第一方面,本申请提供了一种缺陷检测方法。该方法包括:
将待检测图像输入至教师网络进行编码,得到多个编码特征;
将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。
本申请实施例提供的缺陷检测方法,通过将待检测图像输入至教师网络进行编码,得到多个编码特征,以及将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征,并根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。上述缺陷检测方法通过将非对称的学生网络建立在教师网络的输出上进行无监督学习,相比于传统教师网络和学 生网络独立进行学习的检测算法,可以使教师网络和学生网络各自在学习过程中能够在一定程度上降低噪声的敏感性,从而提高缺陷检测的准确性。
在其中一个实施例中,教师网络包括:第一卷积模块和多个编码模块,多个编码模块级联连接,将待检测图像输入至教师网络进行编码,得到多个编码特征,包括:
将待检测图像输入至所述第一卷积模块,得到卷积特征;
将卷积特征输入至多个编码模块进行编码,得到多个编码特征。
本申请实施例提供的教师网络,通过编码网络实现不同阶段或同一阶段的编码,得到多个不同尺寸或相同尺寸的编码特征,可以为后期基于多个编码特征进行缺陷检测提供丰富的特征信息,进而在一定程度上可以提高检测准确度。
在其中一个实施例中,将卷积特征输入至多个编码模块进行编码,得到多个编码特征,包括:
将卷积特征输入至多个编码模块进行编码,得到多个初始编码特征;
对各初始编码特征进行尺寸调整,得到多个编码特征。
本申请实施例提供的编码网络,通过多个级联连接的编码模块实现不同阶段的编码,得到多个不同尺寸或相同尺寸的编码特征,可以为后期基于多个编码特征进行缺陷检测提供丰富的特征信息,进而在一定程度上可以提高检测准确度。
在其中一个实施例中,编码网络包括多个编码模块,多个编码模块级联连接,将卷积特征输入至编码网络进行编码,得到多个编码特征,包括:
将卷积特征输入至多个编码模块进行编码,得到多个编码特征。
本申请实施例提供的编码网络,通过多个级联连接的编码模块实现不同阶段的编码,得到多个相同尺寸的编码特征,可以为后期对多个编码特征进行融合提供便利,便于之后基于融合后的编码特征进行缺陷检测,进而在一定程度上可以提高检测准确度。
在其中一个实施例中,将卷积特征输入至多个编码模块进行编码,得到多个编码特征,包括:
将卷积特征输入至多个编码模块进行编码,得到多个初始编码特征;
对各初始编码特征进行尺寸调整,得到多个编码特征。
本申请实施例提供的编码网络,通过多个级联连接的N个编码模块实现N个阶段的编码,得到N个相同尺寸的编码特征,可以为后期对N个编码特征进行融合提供便利,便于之后基于融合后的编码特征进行缺陷检测,进而在一定程度上可以提高检测准确度。
在其中一个实施例中,编码网络包括:N个编码模块和N个第二卷积模块,第N个编码模块的输出端与第N个第二卷积模块的输入端连接,对各初始编码特征进行尺寸调整,得到多个编码特征,包括:
将每个编码模块输出的初始编码特征输入至对应的第二卷积模块进行尺寸调整,得到多个编码特征;每个编码特征的尺寸一致。
本申请实施例提供的编码网络,通过多个级联连接的N个编码模块实现N个阶段的编码,得到N个相同尺寸的编码特征,可以为后期对N个编码特征进行融合提供便利,便于之后基于融合后的编码特征进行缺陷检测,进而在一定程度上可以提高检测准确度。
在其中一个实施例中,编码网络包括:M+1个编码模块和M个第二卷积模块,第M个编码模块的输出端与第M个第二卷积模块的输入端连接,对各初始编码特征进行尺寸调整,得到多个编码特征,包括:
将M个编码模块输出的初始编码特征分别输入至对应的第二卷积模块进行尺寸调整,得到M个编码特征;
将M个编码特征和第M+1个编码模块输出的初始编码特征,确定为多个编码特征。
本申请实施例提供的编码网络,通过多个级联连接的M个编码模块实现M个阶段的编码,得到M个相同尺寸的编码特征,且使M个编码特征的尺寸与第M+1个编码模块输出的编码特征的尺寸一致,可以为后期对M+1个编码特征进行融合提供便利,便于之后基于融合后的编码特征进行缺陷检测,进而在一定程度上可以提高检测准确度。
在其中一个实施例中,学生网络包括:变换模块和多个解码模块,将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征,包括:
将多个编码特征融合后输入至变换模块,得到抽象特征;
将抽象特征输入至多个解码模块进行解码,得到多个解码特征。
本申请实施例提供的学生网络,通过多个解码模块实现不同阶段的解码,得到多个解码特征,使这多个解码特征可以与多个编码特征一一对应,以便后期能够通过分析多个编码特征和多个解码特征之间的相似程度进行缺陷检测,实现了一种准确且效率高的缺陷检测方法。
在其中一个实施例中,多个解码模块进行级联连接,将抽象特征输入至多个解码模块进行解码,得到多个解码特征,包括:
将抽象特征输入至多个解码模块进行解码,得到多个解码特征。
本申请实施例提供的学生网络,通过多个级联的解码模块实现不同阶段的解码,得到多个解码特征,使这多个解码特征可以与多个编码特征一一对应,以便后期能够通过分析多个编码特征和多个解码特征之间的相似程度进行缺陷检测,实现了一种准确且效率高的缺陷检测方法。
在其中一个实施例中,多个解码模块包括K个解码模块,K个解码模块中第1个解码模块至第K-1个解码模块级联连接,将抽象特征输入至多个解码模块进行解码,得到多个解码特征,包括:
将抽象特征输入至第1个解码模块至第K-1个解码模块进行解码,得到第1个解码模块至第K-1个解码模块中每一个解码模块输出的解码特征;
将教师网络中第二个编码模块输出的编码特征输入至K个解码模块中第K个解码模块中进行解码,得到第K个解码模块输出的解码特征。
本申请实施例提供的学生网络,通过多个解码模块实现不同阶段的解码,得到多个解码特征,使这多个解码特征可以与多个编码特征一一对应,以便后期能够通过分析多个编码特征和多个解码特征之间的相似程度进行缺陷检测,实现了一种准确且效率高的缺陷检测方法。另一方面,其中最后一个解码模块的输入是教师网络中的编码模块输出的编码特征,可以在一定程度上弥补解码过程中图像重建丢失的细节特征,进而提高解码特征的质量。
在其中一个实施例中,根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域,包括:
根据每个编码特征和每个解码特征之间的相似度值,得到多个相似特征图像;
对多个相似特征图像进行融合,得到目标检测图像;
对目标检测图像进行缺陷检测,得到缺陷区域。
本申请实施例通过融合多个相似特征图像后,基于融合后的相似特征图像进行缺陷检测,由于多个相似特征图像反应教师网络和学生网络多个阶段的学习过程,即反应多种尺度的特征,实现了基于多尺度特征的缺陷检测,在一定程度上可以提高检测的准确性。
在其中一个实施例中,对目标检测图像进行缺陷检测,得到缺陷区域,包括:
将大于预设灰度阈值的灰度值对应的像素点确定为目标像素点;
将连通目标像素点形成的区域确定为缺陷区域。
本申请实施例通过连通大于预设灰度阈值的像素点来检测缺陷区域,此方法简单高效,可以在一定程度上提高检测准确性。
在其中一个实施例中,所述方法还包括:
对多个相似特征图像进行尺寸调整,得到多个调整尺寸后的相似特征图像;每个调整尺寸后的相似特征图像的尺寸与待检测图像的尺寸一致;
对多个相似特征图像进行融合,得到目标检测图像,包括:
对多个调整尺寸后的相似特征图像进行融合,得到目标检测图像。
本申请实施例通过调整各相似特征图像的尺寸,使多个相似特征图像的尺寸一致,可以在一定程度上提高后期对多个相似特征图像进行融合的融合质量,从而提高后期的检测准确性。
在其中一个实施例中,所述方法还包括:
根据样本图像对检测网络进行训练,得到多级的教师网络和多级的学生网络;样本图像为不存在缺陷区域的图像;检测网络包括多级的初始教师网络和多级的初始学生网络。
本实施例所述的训练方法可以基于不包含缺陷的样本图像进行训练,该类型的样本图像比较好获取,可以在一定程度上通过获取大量样本图像提高训练效果。
在其中一个实施例中,根据样本图像对检测网络进行训练,得到教师网络和学生网络,包括:
将样本图像输入至初始教师网络进行编码,得到多个样本编码特征;
将多个样本编码特征融合后输入至初始学生网络进行解码,得到多个样本解码特征;
根据多个样本编码特征和多个样本解码特征,确定目标图像;
根据目标图像和样本图像确定目标损失,并根据目标损失对初始教师网络和初始学生网络进行训练,得到教师网络和学生网络。
本实施例所述的训练方法通过同时训练教师网络和学生网络,使教师网络和学生网络相互学习,形成一种自蒸馏结构,可以在一定程度上有效抑制学生网络对噪声的敏感性,从而提高训练效果,进而提升训练好的教师网路和学生网络组成的检测网络的检测准确性。
第二方面,本申请还提供了一种缺陷检测装置。所述装置包括:
编码模块,用于将待检测图像输入至教师网络进行编码,得到多个编码特征;
解码模块,用于将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
检测模块,用于根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。
第三方面,本申请还提供了一种计算机设备。所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
将待检测图像输入至教师网络进行编码,得到多个编码特征;
将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。
第四方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:
将待检测图像输入至教师网络进行编码,得到多个编码特征;
将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。
第五方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:
将待检测图像输入至教师网络进行编码,得到多个编码特征;
将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。
上述说明仅是本申请技术方案的概述,为了能够更清楚了解本申请的技术手段,而可依照说明书的内容予以实施,并且为了让本申请的上述和其它目的、特征和优点能够更明显易懂,以下特举本申请的具体实施方式。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例中所需要使用的附图作简单地介绍,显而易见地,下面所描述的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据附图获得其他的附图。在附图中:
图1为一个实施例中计算机设备的内部结构图;
图2为一个实施例中缺陷检测方法的流程示意图;
图3为另一个实施例中缺陷检测方法的流程示意图;
图4为一个实施例中教师网络的一种实现方式的结构示意图;
图5为一个实施例中编码网络的一种实现方式的结构示意图;
图6为另一个实施例中缺陷检测方法的流程示意图;
图7为一个实施例中编码网络的一种实现方式的结构示意图;
图8为一个实施例中编码网络的另一种实现方式的结构示意图;
图9为另一个实施例中缺陷检测方法的流程示意图;
图10为另一个实施例中缺陷检测方法的流程示意图;
图11为一个实施例中学生网络的一种实现方式的结构示意图;
图12为一个实施例中学生网络的另一种实现方式的结构示意图;
图13为另一个实施例中缺陷检测方法的流程示意图;
图14为另一个实施例中缺陷检测方法的流程示意图;
图15为另一个实施例中训练方法的流程示意图;
图16为一个实施例中检测网络的结构示意图;
图17为一个实施例中缺陷检测装置的结构框图。
具体实施方式
下面将结合附图对本申请技术方案的实施例进行详细的描述。以下实施例仅用于更加清楚地说明本申请的技术方案,因此只作为示例,而不能以此来限制本申请的保护范围。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同;本文中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请;本申请的说明书和权利要求书及上述附图说明中的术语“包括”以及它的任何变形,意图在于覆盖不排他的包含。
在本申请实施例的描述中,技术术语“第一”“第二”等仅用于区别不同对象,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量、特定顺序或主次关系。在本申请实施例的描述中,“多个”的含义是两个以上(包括两个),除非另有明确具体的限定。
目前,针对焊道缺陷进行检测的方法,主要基于人工智能(Artificial Intelligent,AI),可以自动化的检测焊道上是否存在缺陷或缺陷的类型。而现有的方法通常使用同向传播的教师-学生结构,即,将待检测图像分别输入至教师网络和学生网络进行图像处理,并利用教师网络和学生网络各自输出的图像之间的相似度进行待检测图像中焊道缺陷区域的检测。该教师网络和学生网络在结构上通常是相似的,这样的相似性会损害整个网络无法覆盖全部的焊道缺陷区域或焊道缺陷区域的位置预估错误,导致最终检测出的焊道缺陷区域并不准确。本 申请提供了一种缺陷检测方法,旨在解决上述技术问题。下面实施例将详细说明本申请所述的缺陷检测方法。
本申请实施例提供的缺陷检测方法,可以应用于如图1所示的计算机设备中。该计算机设备可以是终端,其内部结构图可以如图1所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种缺陷检测方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。
本领域技术人员可以理解,图1中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,如图2所示,提供了一种缺陷检测方法,以该方法应用于图1中的计算机设备为例进行说明,包括以下步骤:
S201,将待检测图像输入至教师网络进行编码,得到多个编码特征。
其中,待检测图像为焊道区域的图像,其中可能包含了焊道上的缺陷。教师网络为一种预先训练好的神经网络或编码器,其可以用于对输入的图像进行多阶段的图像编码,输出每一阶段的编码特征,即多个编码特征可以是教师网络在不同编码阶段输出的编码特征。每个编码特征可以使用特征图表示。在一些实施例中,教师网络也可以用于对输入的图像进行一次编码,直接得到多个编码特征,即多个编码特征可以是教师网络在同一编码阶段输出的编码特征。
本申请实施例中,计算机设备可以先获取电池生产过程中,焊道区域的图像,即待检测图像。该待检测图像中可能包含了焊道缺陷,也可能未包含焊道缺陷。之后,计算机设备也可以将待检测图像输入至预先训练好的教师网络中进行不同阶段的编码,且在每个阶段或其中几个阶段输出不同尺寸或相同尺寸的编码特征,得到多个编码特征。在一些实施例中, 计算机设备还可以将待检测图像输入至预训练好的教师网络进行同一阶段的编码,一次得到多个相同尺寸或不同尺寸的编码特征。
S202,将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征。
其中,学生网络为一种预先训练好的神经网络或解码器,其用于对输入的特征图像进行多阶段的图像解码,输出每一阶段的解码特征,即多个解码特征可以是学生网络在不同解码阶段输出的解码特征。每个解码特征可以使用特征图表示。多个编码特征与多个解码特征为一一对应的关系。
本申请实施例中,当计算机设备获取到教师网络输出的多个编码特征后,可以先将该多个编码特征在图像的通道维度进行融合,得到融合特征,再将融合特征输入至预先训练好的学生网络中进行不同阶段的解码,且在每个阶段或其中几个阶段输出不同尺寸或相同尺寸的解码特征,得到多个解码特征。在一些实施例中,计算机设备还可以将融合特征输入至预训练好的学生网络进行同一阶段的解码,即将融合特征拆解为多个不同尺寸或相同尺寸的解码特征。
S203,根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。
本申请实施例中,当计算机设备基于前述步骤获取到多个编码特征和多个解码特征后,即可计算得到各编码特征与对应解码特征之间的相似特征图,然后根据所有编码特征和所有解码特征之间的相似特征图计算得到目标相似特征图,最后根据目标相似特征图确定待检测图像中的缺陷区域;在一些实施例中,计算机设备在得到各编码特征与对应解码特征之间的相似特征图,即多个相似特征图时,也可以先从多个相似特征图中根据筛选条件筛选出部分的相似特征图,然后根据部分的相似特征图得到目标相似特征图,最后根据目标相似特征图确定待检测图像中的缺陷区域。其中,当相似特征图中各像素点对应的相似度值比较大时,说明待检测图像中可能包括缺陷,此种场景中,筛选条件可以为:将相似特征图中各像素点对应的相似度值大于第一预设相似度阈值的相似特征图筛选出来,此种可以增强最后目标相似特征图中缺陷区域对应像素点的强度,便于后期基于该目标相似特征图进行检测;当相似特征图中各像素点对应的相似度值比较小时,说明待检测图像中可能不包括缺陷,此种场景中,筛选条件可以为:将相似特征图中各像素点对应的相似度值均小于第二预设相似度阈值的相似特征图筛选出来,此种可以增强目标相似特征图中非缺陷区域对应像素点的强度,便于后期基于该目标相似特征图进行检测。
本申请实施例提供的缺陷检测方法,通过将待检测图像输入至教师网络进行编码,得到多个编码特征,以及将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征,并根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。上述缺陷检测方法通过将非对称的学生网络建立在教师网络的输出上进行无监督学习,相比于传统教师网络和学生网络独立进行学习的检测算法,可以使教师网络和学生网络各自在学习过程中能够在一定程度上降低噪声的敏感性,从而提高缺陷检测的准确性。
在一个实施例中,提供了一种教师网络的结构,如图4所示,该教师网络包括:第一卷积模块和编码网络,基于该教师网络,上述S201“将待检测图像输入至教师网络进行编码,得到多个编码特征”,如图3所示,包括:
S301,将待检测图像输入至第一卷积模块,得到卷积特征。
其中,第一卷积模块用于对输入的图像进行卷积处理,即对输入的图像进行尺寸调整或降维卷积处理。
本申请实施例中,当计算机设备获取到待检测图像时,可以将待检测图像输入至教师网络中的第一卷积模块进行卷积处理,得到卷积处理后的卷积特征,此处的卷积特征可以使用卷积特征图表示。在一些实施例中,计算机设备还可以将待检测图像输入至教师网络中的第一卷积模块进行卷积处理,得到卷积处理后的多个卷积特征,此处多个卷积特征可以使用多个卷积特征图表示。
S302,将卷积特征输入至编码网络进行编码,得到多个编码特征。
本申请实施例中,当计算机设备获取到卷积特征时,可以将该卷积特征输入至预训练好的编码网络进行不同阶段的编码,且在每个阶段或其中几个阶段输出不同尺寸或相同尺寸的编码特征,得到多个编码特征。在一些实施例中,当计算机设备获取到多个卷积特征时,还可以将多个卷积特征同时输入至预训练好的编码网络进行同一阶段的编码,一次得到多个相同尺寸或不同尺寸的编码特征。
本申请实施例提供的教师网络,通过编码网络实现不同阶段或同一阶段的编码,得到多个不同尺寸或相同尺寸的编码特征,可以为后期基于多个编码特征进行缺陷检测提供丰富的特征信息,进而在一定程度上可以提高检测准确度。
在一些实施例中,在一个实施例中,还提供了一种编码网络的结构,如图5所示,该编码网络包括多个编码模块,多个编码模块级联连接,在此场景下,计算机设备执行上述S302 “将卷积特征输入至编码网络进行编码,得到多个编码特征”时,具体执行步骤:将卷积特征输入至多个编码模块进行编码,得到多个编码特征。
本申请实施例中,当计算机设备获取到卷积特征时,可以将该卷积特征输入至多个级联连接的编码模块进行逐级编码,且每个编码模块均输出编码特征,得到多个编码特征,或者其中几个编码模块输出编码特征,得到多个编码特征。在一些实施例中,当计算机设备获取到多个卷积特征时,还可以将多个卷积特征同时输入至多个编码模块进行逐级编码,且每个编码模块均输出多个编码特征,或者其中几个编码模块输出多个编码特征。
本申请实施例提供的编码网络,通过多个级联连接的编码模块实现不同阶段的编码,得到多个不同尺寸或相同尺寸的编码特征,可以为后期基于多个编码特征进行缺陷检测提供丰富的特征信息,进而在一定程度上可以提高检测准确度。
在一些实施例中,在一个实施例中,还提供了一种利用多个编码模块进行编码的方法,即计算机设备在执行上述步骤“将卷积特征输入至多个编码模块进行编码,得到多个编码特征”时,如图6所示,具体执行步骤:
S401,将卷积特征输入至多个编码模块进行编码,得到多个初始编码特征。
本申请实施例中,当计算机设备获取到卷积特征时,可以将该卷积特征输入至多个级联连接的编码模块进行逐级编码,且每个编码模块均输出初始编码特征,得到多个初始编码特征,或者其中几个编码模块输出初始编码特征,得到多个初始编码特征。在一些实施例中,当计算机设备获取到多个卷积特征时,还可以将多个卷积特征同时输入至多个编码模块进行逐级编码,且每个编码模块均输出多个初始编码特征,或者其中几个编码模块输出多个初始编码特征。
S402,对各初始编码特征进行尺寸调整,得到多个编码特征。
其中,多个编码特征的尺寸一致。
计算机设备在获取到每个编码模块输出的初始编码特征,或者几个编码模块输出的初始编码特征时,可以将各编码特征的尺寸调整至目标尺寸,该目标尺寸可以根据实际检测需求或编码需求确定,在一些实施例中,该目标尺寸可以与多个初始编码特征中任一初始编码特征的尺寸一致,根据本申请的一个方面,目标尺寸可以与最后一级的编码模块输出的初始编码特征的尺寸一致。
本申请实施例提供的编码网络,通过多个级联连接的编码模块实现不同阶段的编码,得到多个相同尺寸的编码特征,可以为后期对多个编码特征进行融合提供便利,便于之后基于融合后的编码特征进行缺陷检测,进而在一定程度上可以提高检测准确度。
基于上述实施例所述的编码方法,本申请还提供了一种编码网络的结构,如图7所示,该编码网络包括:N个编码模块和N个第二卷积模块,第1个编码模块的输出端与第1个第二卷积模块的输入端连接,第2个编码模块的输出端与第2个第二卷积模块的输入端连接,....,第N-1个编码模块的输出端与第N-1个第二卷积模块的输入端连接,第N个编码模块的输出端与第N个第二卷积模块的输入端连接,在此场景下,计算机设备执行上述S402“对各初始编码特征进行尺寸调整,得到多个编码特征”时,具体执行步骤:将每个编码模块输出的初始编码特征输入至对应的第二卷积模块进行尺寸调整,得到多个编码特征;每个编码特征的尺寸一致。
其中,第二卷积模块用于对输入的图像进行卷积处理,即对输入的图像进行尺寸调整或降维卷积处理。
本申请实施例中,计算机设备在获取到第1个编码模块输出的初始编码特征时,将第1个编码模块输出的初始编码特征输入至对应的第1个第二卷积模块进行尺寸调整,得到第1个尺寸调整后的编码特征;计算机设备在获取到第2个编码模块输出的初始编码特征时,将第2个编码模块输出的初始编码特征输入至对应的第2个第二卷积模块进行尺寸调整,得到第2个尺寸调整后的编码特征,如此执行,直到计算机设备在获取到第N-1个编码模块输出的初始编码特征时,将第N-1个编码模块输出的初始编码特征输入至对应的第N-1个第二卷积模块进行尺寸调整,得到第N-1个尺寸调整后的编码特征;计算机设备在获取到第N个编码模块输出的初始编码特征时,将第N个编码模块输出的初始编码特征输入至对应的第N个第二卷积模块进行尺寸调整,得到第N个尺寸调整后的编码特征,调整尺寸后的第1个编码特征至调整尺寸后的第N个编码特征的尺寸一致。
本申请实施例提供的编码网络,通过多个级联连接的N个编码模块实现N个阶段的编码,得到N个相同尺寸的编码特征,可以为后期对N个编码特征进行融合提供便利,便于之后基于融合后的编码特征进行缺陷检测,进而在一定程度上可以提高检测准确度。
基于上述实施例所述的编码方法,本申请还提供了另一种编码网络的结构,如图8所示,该编码网络包括:M+1个编码模块和M个第二卷积模块,第1个编码模块的输出端与第1个第二卷积模块的输入端连接,第2个编码模块的输出端与第2个第二卷积模块的输入端 连接,....,第M个编码模块的输出端与第M个第二卷积模块的输入端连接,第M+1个编码模块并无对应的第二卷积模块,在此场景下,计算机设备执行上述S402“对各初始编码特征进行尺寸调整,得到多个编码特征”时,如图9所示,具体执行步骤:
S501,将M个编码模块输出的初始编码特征分别输入至对应的第二卷积模块进行尺寸调整,得到M个编码特征。
本申请实施例中,计算机设备在获取到第1个编码模块输出的初始编码特征时,将第1个编码模块输出的初始编码特征输入至对应的第1个第二卷积模块进行尺寸调整,得到第1个尺寸调整后的编码特征;计算机设备在获取到第2个编码模块输出的初始编码特征时,将第2个编码模块输出的初始编码特征输入至对应的第2个第二卷积模块进行尺寸调整,得到第2个尺寸调整后的编码特征,如此执行,直到计算机设备在获取到第M个编码模块输出的初始编码特征时,将第M个编码模块输出的初始编码特征输入至对应的第M个第二卷积模块进行尺寸调整,得到第M个尺寸调整后的编码特征,调整尺寸后的第1个编码特征至第M个编码特征的尺寸一致。
S502,将M个编码特征和第M+1个编码模块输出的初始编码特征,确定为多个编码特征。
当计算机设备获取到M个编码特征时,再加上第M+1个编码模块输出的初始编码特征,可以一起作为多个编码特征,且M个编码特征的尺寸与第M+1个编码模块输出的初始编码特征的尺寸一致。
本申请实施例提供的编码网络,通过多个级联连接的M个编码模块实现M个阶段的编码,得到M个相同尺寸的编码特征,且使M个编码特征的尺寸与第M+1个编码模块输出的编码特征的尺寸一致,可以为后期对M+1个编码特征进行融合提供便利,便于之后基于融合后的编码特征进行缺陷检测,进而在一定程度上可以提高检测准确度。
在一个实施例中,提供了一种教师网络的结构,如图11所示,该学生网络包括:变换模块和多个解码模块,基于该学生网络,上述S201“将多个编码特征融合后输入至学生网络进行解码,得到多个解码特征”,如图10所示,包括:
S601,将多个编码特征融合后输入至变换模块,得到抽象特征。
其中,变换模块用于对输入的图像进行抽象特征提取。变换模块可以为一种神经网络模型。
本申请实施例中,当计算机设备获取到多个编码特征后,可以先将该多个编码特征在图像的通道维度进行融合,得到融合特征,再将融合特征输入至变换模块中进行特征提取,得到抽象特征,此处抽象特征可以使用抽象特征图表示。具体在融合多个编码特征时,可以采用预先训练好的融合网络实现,也可以采用相应的融合算法实现。
S602,将抽象特征输入至多个解码模块进行解码,得到多个解码特征。
其中,解码模块为一种预先训练好的神经网络或解码器,其用于对输入的特征图像进行图像解码。
本申请实施例中,当计算机设备获取到抽象特征时,可以将该抽象特征输入至多个解码模块进行解码,且每个解码模块均输出解码特征,得到多个解码特征,或者其中几个解码模块输出解码特征,得到多个解码特征。在一些实施例中,当计算机设备获取到抽象特征时,还可以将抽象特征分别输入至多个解码模块进行编码,且每个解码模块输出解码特征,或者其中几个解码模块输出解码特征。
本申请实施例提供的学生网络,通过多个解码模块实现不同阶段的解码,得到多个解码特征,使这多个解码特征可以与多个编码特征一一对应,以便后期能够通过分析多个编码特征和多个解码特征之间的相似程度进行缺陷检测,实现了一种准确且效率高的缺陷检测方法。
在一些实施例中,上述多个解码模块可以级联连接,也可以非级联连接。当多个解码模块级联连接时,计算机设备执行上述S602“将抽象特征输入至多个解码模块进行解码,得到多个解码特征”时,具体执行步骤:将抽象特征输入至多个解码模块进行解码,得到多个解码特征。
本申请实施例中,当计算机设备获取到抽象特征时,可以将该抽象特征输入至多个级联连接的解码模块进行逐级解码,且每个解码模块均输出解码特征,得到多个解码特征,或者其中几个解码模块输出解码特征,得到多个解码特征。
本申请实施例提供的学生网络,通过多个级联的解码模块实现不同阶段的解码,得到多个解码特征,使这多个解码特征可以与多个编码特征一一对应,以便后期能够通过分析多个编码特征和多个解码特征之间的相似程度进行缺陷检测,实现了一种准确且效率高的缺陷检测方法。
基于上述实施例所述的编码方法,本申请还提供了多个解码模块的具体连接方式,如图12所示,该多个解码模块包括:K个解码模块,K个解码模块中第1个至第K-1个解码模 块级联连接,在此场景下,计算机设备执行上述S602“将抽象特征输入至多个解码模块进行解码,得到多个解码特征”时,如图13所示,具体执行步骤:
S701,将抽象特征输入至第1个解码模块至第K-1个解码模块进行解码,得到第1个解码模块至第K-1个解码模块中每一个解码模块输出的解码特征。
本申请实施例中,计算机设备在获取到变换模块输出的抽象特征时,可以将该抽象特征输入至第1个解码模块进行解码(特征图像重建),得到第1个解码模块输出的解码特征;再继续将到第1个解码模块输出的解码特征输入至第2个解码模块进行解码(特征图像重建),得到第2个解码模块输出的解码特征,如此执行,直到计算机设备将第K-2个解码模块输出的解码特征输入至第K-1个解码模块进行解码(特征图像重建),得到第K-1个解码模块输出的解码特征,最终得到第1个解码模块至第K-1个解码模块中每一个解码模块输出的解码特征,即得到K-1个解码特征。
S702,将教师网络中第二个编码模块输出的编码特征输入至K个解码模块中的第K个解码模块进行解码,得到所述第K个解码模块输出的解码特征。
上述K个解码模块中第K个解码模块在工作时,将之前教师网络中第2个编码模块输出的编码特征输入至第K个解码模块进行解码(特征图像重建),得到第K个解码模块输出的解码特征。需要说明的是,该步骤可以在之前S701的步骤之前执行,也可以与S701的步骤同时执行,还可以在S702的步骤之后执行。
本申请实施例提供的学生网络,通过多个解码模块实现不同阶段的解码,得到多个解码特征,使这多个解码特征可以与多个编码特征一一对应,以便后期能够通过分析多个编码特征和多个解码特征之间的相似程度进行缺陷检测,实现了一种准确且效率高的缺陷检测方法。另一方面,其中最后一个解码模块的输入是教师网络中的编码模块输出的编码特征,可以在一定程度上弥补解码过程中图像重建丢失的细节特征,进而提高解码特征的质量。
在一个实施例中,当计算机设备基于前述任一实施例得到多个编码特征和多个解码特征后,可以在一些实施例中使用多个编码特征和多个解码特征对待检测图像进行缺陷检测,因此,本申请还提供了一种缺陷检测方法,如图14所示,该方法包括:
S801,根据每个编码特征和每个解码特征之间的相似度,得到多个相似特征图像。
当计算机设备获取到多个编码特征和多个解码特征时,由于多个编码特征和多个解码特征是一一对应的关系,因此将各解码特征与其对应的编码特征进行相似度计算,具体的,可以计算解码特征对应的特征图上各像素点与编码特征对应特征图上对应各像素点之间的相 似度,然后根据计算得到的各像素点的相似度确定相似特征图像,最后得到每个编码特征和每个解码特征对应的相似特征图像。
S802,对多个相似特征图像进行融合,得到目标检测图像。
计算机设备获取到多个相似特征图像后,可以采用相应的融合算法,将多个相似特征图像进行融合,得到融合后的目标检测图像;在一些实施例中,计算机设备也可以先从多个相似特征图像中根据筛选条件筛选出部分的相似特征图像,然后将部分的相似特征图像进行融合,得到目标检测图像。当相似特征图像中各像素点对应的相似度值比较大时,说明待检测图像中可能包括缺陷,此种场景中,筛选条件可以为:将相似特征图像中各像素点对应的相似度值均大于第一预设相似度阈值的相似特征图像筛选出来,此种可以增强最后目标检测图像中缺陷区域对应像素点的强度,便于后期基于该目标检测图像进行检测;当相似特征图像中各像素点对应的相似度值比较小时,说明待检测图像中可能不包括缺陷,此种场景中,筛选条件可以为:将相似特征图像中各像素点对应的相似度值均小于第二预设相似度阈值的相似特征图像筛选出来,此种可以增强目标检测图像中非缺陷区域对应像素点的强度,便于后期基于目标检测图像进行检测。
在一些实施例中,对上述多个相似特征图像进行融合之前,还需要执行步骤:对多个相似特征图像进行尺寸调整,得到多个调整尺寸后的相似特征图像;每个调整尺寸后的相似特征图的尺寸与待检测图像的尺寸一致。
对应的,计算机设备执行步骤“对多个相似特征图像进行融合,得到目标检测图像”的步骤时,具体执行步骤:对多个调整尺寸后的相似特征图像进行融合,得到目标检测图像。
S803,对目标检测图像进行缺陷检测,得到缺陷区域。
当计算机设备得到目标检测图像时,可以在一些实施例中确定该目标检测图像中各像素点的灰度值,再根据各像素点的灰度值确定目标检测图像中的缺陷区域。具体的,可以将目标检测图像中非0的灰度值对应的像素点连通起来,形成的区域即为缺陷区域;在一些实施例中,也可以将目标检测图像中大于预设灰度阈值的灰度值对应的像素点确定为目标像素点,再将连通目标像素点形成的区域确定为缺陷区域。
本申请实施例通过融合多个相似特征图像后,基于融合后的相似特征图像进行缺陷检测,由于多个相似特征图像反应教师网络和学生网络多个阶段的学习过程,即反应多种尺度的特征,实现了基于多尺度特征的缺陷检测,在一定程度上可以提高检测的准确性。
基于上述缺陷检测方法,本申请还提供了一种训练上述教师网络和学生网络的方法,即图2实施例所述的方法还包括步骤:
根据样本图像对检测网络进行训练,得到教师网络和学生网络。
其中,样本图像为不存在缺陷区域的图像;检测网络包括初始教师网络和初始学生网络。本申请实施例涉及训练方法,即先根据初始教师网络和初始学生网络构建检测网络,再获取不包含缺陷区域的样本图像,然后将样本图像输入至检测网络进行训练,得到训练好的教师网络和学生网络。本实施例所述的训练方法可以基于不包含缺陷的样本图像进行训练,该类型的样本图像比较好获取,可以在一定程度上通过获取大量样本图像提高训练效果。
在一些实施例中,上述训练方法,如图15所示,包括:
S901,将样本图像输入至初始教师网络进行编码,得到多个样本编码特征。
其中,样本图像为焊道区域的图像,其中不包含焊道上的缺陷。初始教师网络为一种预先训练好的神经网络或编码器,其可以用于对输入的图像进行多阶段的图像编码,输出每一阶段的样本编码特征,即多个样本编码特征可以是初始教师网络在不同编码阶段输出的样本编码特征。每个样本编码特征可以使用特征图表示。在一些实施例中,初始教师网络也可以用于对输入的图像进行一次编码,直接得到多个样本编码特征,即多个样本编码特征可以是初始教师网络在同一编码阶段输出的样本编码特征。
本申请实施例中,计算机设备可以先获取样本图像,再样本图像输入至构建好的初始教师网络中进行不同阶段的编码,且在每个阶段或其中几个阶段输出不同尺寸或相同尺寸的样本编码特征,得到多个样本编码特征。在一些实施例中,计算机设备还可以将样本图像输入至构建好的初始教师网络进行同一阶段的编码,一次得到多个相同尺寸或不同尺寸的样本编码特征。
在一些实施例中,在将样本图像输入至检测网络进行训练之前,还可以对样本图像进行预处理,比如进行下采样等处理,比如,将样本图像下采样到1024*1024大小作为检测网络输入。在训练时,也可以随机选取32张样本图像的数量作为一批次的样本图像进行训练,初始学习率可以设置为10-4。
S902,将多个样本编码特征融合后输入至初始学生网络进行解码,得到多个样本解码特征。
其中,初始学生网络为一种神经网络或解码器,其用于对输入的特征图像进行多阶段的图像解码,输出每一阶段的样本解码特征,即多个样本解码特征可以是初始学生网络在不 同解码阶段输出的样本解码特征。每个样本解码特征可以使用特征图表示。多个样本编码特征与多个样本解码特征为一一对应的关系。
本申请实施例中,当计算机设备获取到初始教师网络输出的多个样本编码特征后,可以先将该多个样本编码特征在图像的通道维度进行融合,得到样本融合特征,再将样本融合特征输入至初始学生网络中进行不同阶段的解码,且在每个阶段或其中几个阶段输出不同尺寸或相同尺寸的样本解码特征,得到多个样本解码特征。在一些实施例中,计算机设备还可以将样本融合特征输入至初始学生网络进行同一阶段的解码,即将样本融合特征拆解为多个不同尺寸或相同尺寸的样本解码特征。
S903,根据多个样本编码特征和多个样本解码特征,确定目标图像。
计算机设备获取到多个样本编码特征和多个样本解码特征时,可以根据每个样本编码特征和每个样本解码特征之间的相似度,得到多个样本相似特征图像。再对多个样本相似特征图像进行融合,得到目标图像。
S904,根据目标图像和样本图像确定目标损失,并根据目标损失对初始教师网络和初始学生网络进行训练,得到教师网络和学生网络。
当确定了目标图像后,即可根据该目标图像和样本图像确定一个目标损失,具体确定目标损失时,可以通过计算目标图像和样本图像之间的相似度来确定目标损失,然后即可开始根据目标损失调整初始教师网络和初始学生网络各自的模型参数,直到完成训练,得到训练好的教师网络和学生网络。
本实施例所述的训练方法通过同时训练教师网络和学生网络,使教师网络和学生网络相互学习,形成一种自蒸馏结构,可以在一定程度上有效抑制学生网络对噪声的敏感性,从而提高训练效果,进而提升训练好的教师网路和学生网络组成的检测网络的检测准确性。
综合上述所有实施例,本申请还提供了一种检测网络,如图16所示,该检测网络包括第一卷积模块、第二卷积模块、第三卷积模块、第一编码模块、第二编码模块、第三编码模块、融合模块、转换模块、第一解码模块、第二解码模块、第三解码模块,其中,第一卷积模块的输出端与第一编码模块连接,第一编码模块的输出端分别与第二编码模块和第二卷积模块连接,第二编码模块的输出端分别与第三编码模块和第三卷积模块连接,第二卷积模块的输出端、第三卷积模块的输出端与第三编码模块的输出端均与融合模块连接,融合模块的输出端与变换模块连接,变换模块的输出端与第一解码模块连接,第一解码模块的输出端 与第二解码模块连接,第二解码模块的输出端,第二编码模块的输出端还与第三解码模块的输入端连接。
上述检测网络的工作原理为:将待检测图像I输入至第一卷积模块中进行卷积,得到第一卷积特征J1t,将第一卷积特征J1t输入至第一编码模块进行编码,得到第一编码特征F1t,将第一编码特征F1t分别输入至第二编码模块进行编码,得到第二编码特征F2t,以及将第一编码特征F1t输入至第二卷积模块进行卷积,得到第二卷积特征J2t,再将第二编码特征F2t输入至第三编码模块进行编码,得到第三编码特征F3t,以及将第二编码特征F2t输入至第三卷积模块进行卷积,得到第三卷积特征J3t,然后将第三编码特征F3t、第二卷积特征J2t和第三卷积特征J3t输入至融合模块进行通道维度融合,得到融合特征R,然后将融合特征R输入至转换模块进行抽象特征提取,得到抽象特征C,最后将抽象特征C输入至第一解码模块进行解码,得到第一解码特征FS1,并将第一解码特征FS1输入至第二解码模块进行解码,得到第二解码特征F2S;在一些实施例中,将第二编码模块输出的第二编码特征F2t输入至第三解码模块进行解码,得到第三解码特征F3S。然后,计算第一解码特征FS1对应特征图与第一编码特征F1t对应特征图之间的相似度,以确定第一解码特征FS1和第一编码特征F1t对应的第一相似特征图像;计算第二解码特征F2S对应特征图与第二编码特征F2t对应特征图之间的相似度,以确定第二解码特征F2S和第二编码特征F2t对应的第二相似特征图像;计算第三解码特征F3S对应特征图与第三编码特征F3t对应特征图之间的相似度,以确定第三解码特征F3S和第三编码特征F3t对应的第三相似特征图像,最后将第一相似特征图像、第二相似特征图像和第三相似特征图像进行融合,得到目标检测图像,并基于目标检测图像进行缺陷检测,确定待检测图像中的缺陷区域。需要说明的是,上述计算各特征图之间的相似度时,可以逐点计算余弦相似度,比如,计算FiS与征Fit之间的逐点余弦相似度Cos(FiS,Fit),再基于逐点余弦相似度确定对应的相似特征图像。利用上述方法进行缺陷图像检测,在焊道区域定位方面的准确率可以提升约20%左右,在抑制噪声方面,也可以将焊道区域定位的准确性提升约10%~15%。之后利用检测出的缺陷区域的图像可以辅助相关人员对真实焊道图像进行缺陷标注,且可以将人工的标注耗时降低约50%左右。
本申请实施例提供的缺陷检测方法,通过将待检测图像输入至逐级连接的多个编码模块进行编码,得到多个编码特征,以及将多个编码特征融合后输入至逐级连接的多个解码模块进行解码,得到多个解码特征,并根据多个编码特征和多个解码特征,确定待检测图像中的缺陷区域。上述缺陷检测方法通过将非对称的解码模块建立在编码模块的输出上进行无监 督学习,可以使编码模块和解码模块各自在学习过程中能够在一定程度上降低噪声的敏感性,从而提高缺陷检测的准确性。
应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的缺陷检测方法的缺陷检测装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个缺陷检测装置实施例中的具体限定可以参见上文中对于缺陷检测方法的限定,在此不再赘述。
在一个实施例中,如图17所示,提供了一种缺陷检测装置,包括:
编码模块10,用于将将待检测图像输入至教师网络进行编码,得到多个编码特征;
解码模块11,用于将所述多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
检测模块12,用于根据所述多个编码特征和所述多个解码特征,确定所述待检测图像中的缺陷区域。
上述缺陷检测装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现以下步骤:
将待检测图像输入至教师网络进行编码,得到多个编码特征;
将所述多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
根据所述多个编码特征和所述多个解码特征,确定所述待检测图像中的缺陷区域。
上述实施例提供的一种计算机设备,其实现原理和技术效果与上述方法实施例类似,在此不再赘述。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
将待检测图像输入至教师网络进行编码,得到多个编码特征;
将所述多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
根据所述多个编码特征和所述多个解码特征,确定所述待检测图像中的缺陷区域。
上述实施例提供的一种计算机可读存储介质,其实现原理和技术效果与上述方法实施例类似,在此不再赘述。
在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:
将待检测图像输入至教师网络进行编码,得到多个编码特征;
将所述多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
根据所述多个编码特征和所述多个解码特征,确定所述待检测图像中的缺陷区域。
上述实施例提供的一种计算机程序产品,其实现原理和技术效果与上述方法实施例类似,在此不再赘述。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive RandomAccess Memory,MRAM)、铁电存储器(Ferroelectric RandomAccess Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(RandomAccess Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static RandomAccess Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。

Claims (17)

  1. 一种缺陷检测方法,其中,所述方法包括:
    将待检测图像输入至教师网络进行编码,得到多个编码特征;
    将所述多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
    根据所述多个编码特征和所述多个解码特征,确定所述待检测图像中的缺陷区域。
  2. 根据权利要求1所述的方法,其中,所述教师网络包括:第一卷积模块和编码网络,所述将待检测图像输入至教师网络进行编码,得到多个编码特征,包括:
    将所述待检测图像输入至所述第一卷积模块,得到卷积特征;
    将所述卷积特征输入至所述编码网络进行编码,得到所述多个编码特征。
  3. 根据权利要求2所述的方法,其中,所述编码网络包括多个编码模块,所述多个编码模块级联连接,所述将所述卷积特征输入至所述编码网络进行编码,得到所述多个编码特征,包括:
    将所述卷积特征输入至所述多个编码模块进行编码,得到所述多个编码特征。
  4. 根据权利要求3所述的方法,其中,所述将所述卷积特征输入至所述多个编码模块进行编码,得到所述多个编码特征,包括:
    将所述卷积特征输入至所述多个编码模块进行编码,得到多个初始编码特征;
    对各所述初始编码特征进行尺寸调整,得到所述多个编码特征。
  5. 根据权利要求4所述的方法,其中,所述编码网络包括:N个编码模块和N个第二卷积模块,第N个编码模块的输出端与第N个第二卷积模块的输入端连接,所述对各所述初始编码特征进行尺寸调整,得到所述多个编码特征,包括:
    将每个编码模块输出的初始编码特征输入至对应的第二卷积模块进行尺寸调整,得到所述多个编码特征;每个所述编码特征的尺寸一致。
  6. 根据权利要求4所述的方法,其中,所述编码网络包括:M+1个编码模块和M个第二卷积模块,第M个编码模块的输出端与第M个第二卷积模块的输入端连接,所述对各所述初始编码特征进行尺寸调整,得到所述多个编码特征,包括:
    将M个编码模块输出的初始编码特征分别输入至对应的第二卷积模块进行尺寸调整,得到M个编码特征;
    将所述M个编码特征和第M+1个编码模块输出的初始编码特征,确定为所述多个编码特征。
  7. 根据权利要求1所述的方法,其中,所述学生网络包括:变换模块和多个解码模块,所述将所述多个编码特征融合后输入至学生网络进行解码,得到多个解码特征,包括:
    将所述多个编码特征融合后输入至所述变换模块,得到抽象特征;
    将所述抽象特征输入至所述多个解码模块进行解码,得到所述多个解码特征。
  8. 根据权利要求7所述的方法,其中,所述多个解码模块级联连接,所述将所述抽象特征输入至所述多个解码模块进行解码,得到所述多个解码特征,包括:
    将所述抽象特征输入至所述多个解码模块进行解码,得到所述多个解码特征。
  9. 根据权利要求7所述的方法,其中,所述多个解码模块包括K个解码模块,所述K个解码模块中第1个解码模块至第K-1个解码模块级联连接,所述将所述抽象特征输入至所述多个解码模块进行解码,得到所述多个解码特征,包括:
    将所述抽象特征输入至所述第1个解码模块至第K-1个解码模块进行解码,得到所述第1个解码模块至第K-1个解码模块中每一个解码模块输出的解码特征;
    将所述教师网络中第二个编码模块输出的编码特征输入至所述K个解码模块中的第K个解码模块进行解码,得到所述第K个解码模块输出的解码特征。
  10. 根据权利要求1-9任一项所述的方法,其中,所述根据所述多个编码特征和所述多个解码特征,确定所述待检测图像中的缺陷区域,包括:
    根据每个所述编码特征和每个所述解码特征之间的相似度,得到多个相似特征图像;
    对所述多个相似特征图像进行融合,得到目标检测图像;
    对所述目标检测图像进行缺陷检测,得到所述缺陷区域。
  11. 根据权利要求10所述的方法,其中,所述对所述目标检测图像进行缺陷检测,得到所述缺陷区域,包括:
    将大于预设灰度阈值的灰度值对应的像素点确定为目标像素点;
    将连通所述目标像素点形成的区域确定为所述缺陷区域。
  12. 根据权利要求10所述的方法,其中,所述方法还包括:
    对所述多个相似特征图像进行尺寸调整,得到多个调整尺寸后的相似特征图像;每个所述调整尺寸后的相似特征图像的尺寸与所述待检测图像的尺寸一致;
    所述对所述多个相似特征图像进行融合,得到目标检测图像,包括:
    对所述多个调整尺寸后的相似特征图像进行融合,得到所述目标检测图像。
  13. 根据权利要求1所述的方法,其中,所述方法还包括:
    根据样本图像对检测网络进行训练,得到所述教师网络和所述学生网络;所述样本图像为不存在缺陷区域的图像;所述检测网络包括初始教师网络和初始学生网络。
  14. 根据权利要求13所述的方法,其中,所述根据样本图像对检测网络进行训练,得到所述教师网络和所述学生网络,包括:
    将所述样本图像输入至所述初始教师网络进行编码,得到多个样本编码特征;
    将所述多个样本编码特征融合后输入至初始学生网络进行解码,得到多个样本解码特征;
    根据所述多个样本编码特征和所述多个样本解码特征,确定目标图像;
    根据所述目标图像和所述样本图像确定目标损失,并根据所述目标损失对所述初始教师网络和所述初始学生网络进行训练,得到所述教师网络和所述学生网络。
  15. 一种缺陷检测装置,其中,所述装置包括:
    编码模块,用于将待检测图像输入至教师网络进行编码,得到多个编码特征;
    解码模块,用于将所述多个编码特征融合后输入至学生网络进行解码,得到多个解码特征;
    检测模块,用于根据所述多个编码特征和所述多个解码特征,确定所述待检测图像中的缺陷区域。
  16. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其中,所述处理器执行所述计算机程序时实现权利要求1至14中任一项所述的方法的步骤。
  17. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现权利要求1至14中任一项所述的方法的步骤。
PCT/CN2023/138847 2023-07-04 2023-12-14 缺陷检测方法、装置、计算机设备和存储介质 Ceased WO2025007516A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310806554.XA CN116523917B (zh) 2023-07-04 2023-07-04 缺陷检测方法、装置、计算机设备和存储介质
CN202310806554.X 2023-07-04

Publications (1)

Publication Number Publication Date
WO2025007516A1 true WO2025007516A1 (zh) 2025-01-09

Family

ID=87399797

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/138847 Ceased WO2025007516A1 (zh) 2023-07-04 2023-12-14 缺陷检测方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN116523917B (zh)
WO (1) WO2025007516A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119559182A (zh) * 2025-02-05 2025-03-04 浙江大学 一种可转位刀片缺陷检测方法、电子设备、介质
CN120510154A (zh) * 2025-07-22 2025-08-19 西安邮电大学 缺陷检测模型的训练方法、缺陷检测方法、装置及设备
CN121527502A (zh) * 2025-11-11 2026-02-13 渤海大学 基于区域异常生成和多层级反向蒸馏的缺陷检测与定位方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116523917B (zh) * 2023-07-04 2023-10-13 宁德时代新能源科技股份有限公司 缺陷检测方法、装置、计算机设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200034702A1 (en) * 2018-07-27 2020-01-30 International Business Machines Corporation Training of student neural network with switched teacher neural networks
CN113689383A (zh) * 2021-07-27 2021-11-23 南京旭锐软件科技有限公司 一种图像处理方法、装置、设备及存储介质
CN115375618A (zh) * 2022-06-28 2022-11-22 鲁班嫡系机器人(深圳)有限公司 一种缺陷检测、训练方法、装置、存储介质及设备
CN115471645A (zh) * 2022-11-15 2022-12-13 南京信息工程大学 一种基于u型学生网络的知识蒸馏异常检测方法
CN116228654A (zh) * 2022-12-26 2023-06-06 浙江华睿科技股份有限公司 一种缺陷检测方法、装置、设备及存储介质
CN116523917A (zh) * 2023-07-04 2023-08-01 宁德时代新能源科技股份有限公司 缺陷检测方法、装置、计算机设备和存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111443096B (zh) * 2020-04-03 2023-05-30 联觉(深圳)科技有限公司 印刷电路板的缺陷检测方法、系统、电子装置及存储介质
CN114943672B (zh) * 2021-02-09 2025-09-23 富泰华工业(深圳)有限公司 图像瑕疵检测方法、装置、电子设备及存储介质
CN114332007B (zh) * 2021-12-28 2024-06-28 福州大学 一种基于Transformer的工业缺陷检测和识别方法
CN115439483B (zh) * 2022-11-09 2023-03-24 四川川锅环保工程有限公司 一种高质量的焊缝及焊缝缺陷识别系统、方法、存储介质
CN115861256A (zh) * 2022-12-15 2023-03-28 南京信息工程大学 基于知识蒸馏结合图像重构的异常检测方法
CN116227582B (zh) * 2023-01-31 2026-04-14 国网智能电网研究院有限公司 掩码自编码器的知识蒸馏方法、装置、设备及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200034702A1 (en) * 2018-07-27 2020-01-30 International Business Machines Corporation Training of student neural network with switched teacher neural networks
CN113689383A (zh) * 2021-07-27 2021-11-23 南京旭锐软件科技有限公司 一种图像处理方法、装置、设备及存储介质
CN115375618A (zh) * 2022-06-28 2022-11-22 鲁班嫡系机器人(深圳)有限公司 一种缺陷检测、训练方法、装置、存储介质及设备
CN115471645A (zh) * 2022-11-15 2022-12-13 南京信息工程大学 一种基于u型学生网络的知识蒸馏异常检测方法
CN116228654A (zh) * 2022-12-26 2023-06-06 浙江华睿科技股份有限公司 一种缺陷检测方法、装置、设备及存储介质
CN116523917A (zh) * 2023-07-04 2023-08-01 宁德时代新能源科技股份有限公司 缺陷检测方法、装置、计算机设备和存储介质

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119559182A (zh) * 2025-02-05 2025-03-04 浙江大学 一种可转位刀片缺陷检测方法、电子设备、介质
CN120510154A (zh) * 2025-07-22 2025-08-19 西安邮电大学 缺陷检测模型的训练方法、缺陷检测方法、装置及设备
CN121527502A (zh) * 2025-11-11 2026-02-13 渤海大学 基于区域异常生成和多层级反向蒸馏的缺陷检测与定位方法

Also Published As

Publication number Publication date
CN116523917A (zh) 2023-08-01
CN116523917B (zh) 2023-10-13

Similar Documents

Publication Publication Date Title
CN116523917B (zh) 缺陷检测方法、装置、计算机设备和存储介质
CN110490082B (zh) 一种有效融合神经网络特征的道路场景语义分割方法
CN107808389B (zh) 基于深度学习的无监督视频分割方法
CN113344826B (zh) 图像处理方法、装置、电子设备及存储介质
US10672115B2 (en) Weakly supervised anomaly detection and segmentation in images
CN106022237B (zh) 一种端到端的卷积神经网络的行人检测方法
CN115239638A (zh) 一种工业缺陷检测方法、装置、设备及可读存储介质
CN110490205B (zh) 基于全残差空洞卷积神经网络的道路场景语义分割方法
CN109859163A (zh) 一种基于特征金字塔卷积神经网络的lcd缺陷检测方法
CN114913599B (zh) 基于自动编码器的视频异常行为检测方法及系统
CN114897738A (zh) 一种基于语义不一致性检测的图像盲修复方法
JP2020060879A (ja) 学習装置、画像生成装置、学習方法、及び学習プログラム
CN109740563B (zh) 一种面向视频监控的运动目标检测方法
CN116228654B (zh) 一种缺陷检测方法、装置、设备及存储介质
CN115719416B (zh) 刀闸状态识别方法、装置、计算机设备和存储介质
CN116385404B (zh) 一种自监督下基于图像分割的表面缺陷异常定位和检测方法
CN113724128A (zh) 一种训练样本的扩充方法
CN115423798A (zh) 缺陷识别方法、装置、计算机设备、存储介质和计算机程序产品
CN115861284A (zh) 印刷制品线状缺陷检测方法、装置、电子设备和存储介质
CN110781980A (zh) 目标检测模型的训练方法、目标检测方法及装置
Wen et al. An ensemble approach to short-form video quality assessment using multimodal llm
CN116569216A (zh) 用于生成包含特定特征的图像样本的方法和系统
CN117973940A (zh) 城市系统电力应急能力预测方法、装置和计算机设备
CN113936135A (zh) 一种检测图像生成方法及系统
CN117351197A (zh) 图像分割方法、装置、计算机设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23944237

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 23944237

Country of ref document: EP

Kind code of ref document: A1