Defect detection classification method, device, electronic device and storage medium

By reconstructing images through autoencoders and using filtering small noise reconstruction errors and structural similarity judgment, automatic and efficient classification of industrial product defects is achieved.

CN114764768BActive Publication Date: 2025-09-26FU TAI HUA IND SHENZHEN +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011633792.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2025-09-26
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

Existing defect detection methods are unable to automatically and efficiently classify defects in industrial products.

Method used

An autoencoder is used to reconstruct the image to be inspected. The defect judgment criterion of filtering small noise reconstruction errors is used to judge whether the image has defects, and the defect category is determined by structural similarity calculation.

Benefits of technology

Improved efficiency and accuracy of defect detection and classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114764768B_ABST
    Figure CN114764768B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image detection and provides a defect detection and classification method, apparatus, electronic device, and storage medium. The method comprises: inputting an image to be detected into a trained autoencoder to obtain a reconstructed image corresponding to the image to be detected; judging whether the image to be detected has defects based on a defect judgment criterion that filters small noise reconstruction errors; and when it is determined that the image to be detected has defects, calculating the structural similarity values ​​between the image to be detected and multiple sample images labeled with defect categories, determining the defect category labeled by the sample image corresponding to the highest structural similarity value, and classifying the image to be detected into the determined defect category. The present invention can improve the efficiency of defect detection and classification of images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image detection, and in particular to a defect detection and classification method, device, electronic equipment and storage medium. Background Art

[0002] In order to improve the quality of industrial products, they are usually inspected for defects before packaging. However, current defect detection methods are unable to automatically and efficiently classify defects in industrial products. Summary of the Invention

[0003] In view of the above, it is necessary to propose a defect detection and classification method, device, electronic device and storage medium to improve the efficiency of defect detection and classification.

[0004] A first aspect of the present application provides a defect detection and classification method, the method comprising:

[0005] Inputting the image to be detected into the trained autoencoder to obtain a reconstructed image corresponding to the image to be detected;

[0006] Based on the defect judgment criterion of filtering small noise reconstruction error, it is judged whether the image to be inspected has defects. The expression of the defect judgment criterion is:

[0007]

[0008] Where ΔX is the reconstruction error image calculated from the reconstructed image and the image to be detected, δX is the binary image after filtering the small noise reconstruction error, i and j represent the pixel positions, and τ is the preset reconstruction error measurement threshold;

[0009] When it is determined that the image to be inspected has defects, the structural similarity values ​​of the image to be inspected and multiple template images marked with defect categories are calculated respectively, the defect category marked by the template image corresponding to the highest structural similarity value is determined, and the image to be inspected is classified into the determined defect category.

[0010] Preferably, the preset reconstruction error metric threshold is a statistical value of the training reconstruction error, which is adjusted based on a preset defect detection recall rate and precision rate, wherein the precision rate is the ratio of the number of images correctly detected as having defects to the total number of images detected as having defects, and the recall rate is the ratio of the number of images correctly detected as having defects to the total number of images that actually have defects.

[0011] Preferably, the binary image is defined as:

[0012]

[0013] Where ε is the small noise reconstruction error filtering threshold.

[0014] Preferably, during the training of the autoencoder, the optimization objective function expression used is:

[0015] |XX′|1+λ|XX′|2,

[0016] Where X is the input image, X′ is the reconstructed image, λ is a weight ranging from 0.1 to 10, |XX′|1 is the L1 norm of the reconstructed error image, and |XX′|2 is the L2 norm of the reconstructed error image.

[0017] Preferably, the structural similarity is an indicator for measuring the similarity between two digital images, and the calculation formula is:

[0018] SSIM(x,y)=[l(x,y)] α [c(x,y)] β [s(x,y)] γ

[0019]

[0020] Among them, x and y represent the image to be detected and the template image respectively, SSIM(x,y) represents the structural similarity of images x and y, l(x,y) compares the brightness of images x and y, μ x , μ y Represents the average value of images x and y respectively; c(x,y) compares the contrast of images x and y, σ x ,σ y Represents the standard deviation of images x and y respectively; σ xy is the covariance of images x and y, C1, C2, and C3 are constants used to maintain the stability of l(x,y), c(x,y), and s(x,y).

[0021] Preferably, the structural similarity value between the image to be detected and the template image is positively correlated with the similarity between the image to be detected and the template image.

[0022] Preferably, the method further comprises:

[0023] If the defect judgment criterion of filtering small noise reconstruction error is met, it is determined that the image to be detected has defects; or if the defect judgment criterion of filtering small noise is not met, it is determined that the image to be detected does not have defects.

[0024] A second aspect of the present application provides a defect detection and classification device, comprising:

[0025] An autoencoder module is used to input the image to be detected into a trained autoencoder to obtain a reconstructed image corresponding to the image to be detected;

[0026] A judgment module, configured to judge whether the image to be inspected has defects based on a defect judgment criterion for filtering small noise reconstruction errors;

[0027] The classification module is used to calculate the structural similarity value between the image to be detected that is determined to have defects and multiple sample images marked with defect categories when it is determined that the image to be detected has defects, determine the defect category marked by the sample image corresponding to the highest structural similarity value, and classify the image to be detected into the determined defect category.

[0028] A third aspect of the present application provides an electronic device, comprising a processor, wherein the processor is configured to implement the defect detection and classification method when executing a computer program stored in a memory.

[0029] A fourth aspect of the present application provides a computer storage medium having a computer program stored thereon, wherein the computer program implements the defect detection and classification method when executed by a processor.

[0030] In the present invention, by training the autoencoder, the autoencoder is used to reconstruct the image to be detected, and a reconstructed image corresponding to the image to be detected is obtained. Whether the image to be detected has defects is judged according to the defect judgment criterion of filtering small noise, and the image to be detected is classified according to structural similarity, thereby improving the efficiency and accuracy of defect detection and classification of images. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 Flowchart of a defect detection and classification method according to one embodiment of the present invention.

[0032] Figure 2 This is a structural diagram of a defect detection and classification device in one embodiment of the present invention.

[0033] Figure 3 FIG. 1 is a schematic diagram of an electronic device according to an embodiment of the present invention.

[0034] Description of main component symbols

[0035] Defect detection and classification device 40 Image reconstruction module 401 Judgment module 402 Classification Module 403 electronic devices 6 Memory 61 processor 62 computer program 63 DETAILED DESCRIPTION

[0036] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein may be combined with each other.

[0037] The following description sets forth numerous specific details to facilitate a thorough understanding of the present invention. The embodiments described are merely some, not all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.

[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0039] Preferably, the defect detection and classification method of the present invention is applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.

[0040] The electronic device may be a computing device such as a desktop computer, a laptop computer, a tablet computer, a cloud server, etc. The device may interact with the user through a keyboard, a mouse, a remote control, a touchpad, or a voice control device.

[0041] Example 1

[0042] Figure 1 The flowchart of the defect detection classification method in one embodiment of the present invention is shown in FIG. The order of the steps in the flowchart may be changed and some steps may be omitted according to different requirements.

[0043] See Figure 1 As shown, the defect detection and classification method specifically includes the following steps:

[0044] Step S11: input the image to be detected into the trained autoencoder to obtain a reconstructed image corresponding to the image to be detected.

[0045] In this embodiment, first, the autoencoder can be trained using training set images. Specifically, the training set images can be defect-free sample images. In this embodiment, the expression of the optimization objective function used in training the autoencoder is:

[0046] |X-X'|1+λ|X-X'|2,

[0047] Where X is the input image, X′ is the reconstructed image, λ is a weight ranging from 0.1 to 10, |XX′|1 is the L1 norm of the reconstructed error image, and |XX′|2 is the L2 norm of the reconstructed error image.

[0048] The above optimization objective function can ensure that the reconstructed error image is as sparse as possible while ensuring the smoothness of the reconstruction. λ is a weight, and different values ​​are used to achieve a balance between the smoothness and sparsity of the reconstructed error image of the autoencoder. The larger the value, the smoother the reconstructed error image obtained through training, and vice versa. The reconstructed error image is sparser. For example, the general value range of λ is 0.1 to 10.

[0049] In this embodiment, the preset reconstruction error metric threshold τ is a statistical value of the training reconstruction error, and is adjusted based on preset defect detection recall and precision. The precision is the ratio of the number of images correctly detected as having defects to the total number of images detected as having defects, and the recall is the ratio of the number of images correctly detected as having defects to the total number of images actually having defects. For example, assuming that the reconstruction error of the autoencoder for the training images follows a Gaussian distribution, the 85th percentile of the Gaussian distribution can be used as the threshold.

[0050] Step S12: judging whether the image to be inspected has defects based on a defect judgment criterion for filtering small noise reconstruction errors.

[0051] In this embodiment, step S12 may specifically include:

[0052] calculating a reconstructed error image based on the reconstructed image;

[0053] The binary image of the reconstruction error is obtained according to the binary image calculation formula of filtering the small noise reconstruction error. Specifically, the binary image calculation formula of filtering the small noise reconstruction error is:

[0054]

[0055] Among them, ε is the small noise reconstruction error filtering threshold, which is determined according to the reconstruction error of the training set image by the autoencoder and is used to filter out small reconstruction error pixels, ΔX i,j is the reconstructed error image obtained by calculating the reconstructed image and the image to be detected, i and j are pixel positions, δX i,j is the binary image of the reconstruction error, which is used to indicate the pixel locations with large reconstruction errors;

[0056] The average value of the pixels with larger reconstruction errors is calculated based on the reconstruction error image and the reconstruction error binary image, and the average value of the pixels with larger reconstruction errors is used as the judgment criterion measurement.

[0057] In this embodiment, a defect judgment criterion for filtering small noise reconstruction errors may be used to perform defect detection on the image to be detected. The expression of the defect judgment criterion is:

[0058]

[0059] In this embodiment, if the defect judgment criterion of filtering small noise reconstruction error is met, it is determined that the image to be detected has defects; or if the defect judgment criterion of filtering small noise is not met, it is determined that the image to be detected does not have defects.

[0060] In step S13, when it is determined that the image to be inspected has defects, the structural similarity values ​​of the image to be inspected and multiple template images marked with defect categories are calculated respectively, the defect category marked by the template image corresponding to the highest structural similarity value is determined, and the image to be inspected is classified into the determined defect category.

[0061] In this embodiment, the structural similarity value between the image to be detected and the template image is calculated according to the structural similarity calculation formula. In this embodiment, the structural similarity calculation formula is:

[0062] SSIM(x, y )=[l(x, y )] α [c(x, y )] β [s(x, y )] γ

[0063]

[0064] Among them, x and y represent the image to be detected and the template image respectively, SSIM(x,y) represents the structural similarity of images x and y, l(x,y) compares the brightness of images x and y, μ x , μ y Represents the average value of images x and y respectively; c(x,y) compares the contrast of images x and y, σ x ,σ y Represents the standard deviation of images x and y respectively; σ xy is the covariance of images x and y, C1, C2, and C3 are constants used to maintain the stability of l(x,y), c(x,y), and s(x,y).

[0065] The structural similarity value between the image to be detected and the template image is positively correlated with the similarity between the image to be detected and the template image.

[0066] In the present invention, by training the autoencoder, the autoencoder is used to reconstruct the image to be detected, and a reconstructed image corresponding to the image to be detected is obtained. Whether the image to be detected has defects is judged according to the defect judgment criterion based on filtering small noise, and the image to be detected is classified according to structural similarity, which can improve the efficiency of defect detection and classification of images.

[0067] Example 2

[0068] Figure 2 FIG. 4 is a structural diagram of a defect detection and classification device 40 according to an embodiment of the present invention.

[0069] In some embodiments, the defect detection and classification device 40 operates in an electronic device. The defect detection and classification device 40 may include multiple functional modules composed of program code segments. The program code of each program segment in the defect detection and classification device 40 may be stored in a memory and executed by at least one processor.

[0070] In this embodiment, the defect detection and classification device 40 can be divided into multiple functional modules according to the functions it performs. Figure 3 As shown, the defect detection and classification device 40 may include an image reconstruction module 401, a judgment module 402, and a classification module 403. As used herein, a module refers to a series of computer program segments that can be executed by at least one processor and perform fixed functions, and is stored in a memory. In some embodiments, the functions of each module will be described in detail in subsequent embodiments.

[0071] The image reconstruction module 401 inputs the image to be detected into a trained autoencoder to obtain a reconstructed image corresponding to the image to be detected.

[0072] In this embodiment, in order to obtain a reconstructed image, the defect detection and classification device 40 may further include a training module, and the training module may train the autoencoder.

[0073] For example, the training module uses the training set images to train the autoencoder. Specifically, the training set images can be defect-free sample images. In this embodiment, the expression of the optimization objective function used by the training module to train the autoencoder is:

[0074] |XX′|1+λ|XX′|2,

[0075] Where X is the input image, X′ is the reconstructed image, λ is a weight ranging from 0.1 to 10, |XX′|1 is the L1 norm of the reconstructed error image, and |XX′|2 is the L2 norm of the reconstructed error image.

[0076] The above optimization objective function can ensure that the reconstructed error image is as sparse as possible while ensuring the smoothness of the reconstruction. λ is a weight, and different values ​​are used to achieve a balance between the smoothness and sparsity of the reconstructed error image of the autoencoder. The larger the value, the smoother the reconstructed error image obtained through training, and vice versa. The reconstructed error image is sparser. For example, the general value range of λ is 0.1 to 10.

[0077] In this embodiment, the preset reconstruction error metric threshold τ is a statistical value of the training reconstruction error, and is adjusted based on preset defect detection recall and precision. The precision is the ratio of the number of images correctly detected as having defects to the total number of images detected as having defects, and the recall is the ratio of the number of images correctly detected as having defects to the total number of images actually having defects. For example, assuming that the reconstruction error of the autoencoder for the training images follows a Gaussian distribution, the 85th percentile of the Gaussian distribution can be used as the threshold.

[0078] The judgment module 402 judges whether the image to be inspected has defects based on a defect judgment criterion of filtering small noise reconstruction errors.

[0079] In this embodiment, the judgment module 402 judges whether the image to be inspected has defects based on a defect judgment criterion of filtering small noise reconstruction errors, which may specifically include:

[0080] The judgment module 402 calculates a reconstructed error image based on the reconstructed image;

[0081] The judgment module 402 obtains a binary image of the reconstruction error according to a binary image calculation formula for filtering the small noise reconstruction error. Specifically, the binary image calculation formula for filtering the small noise reconstruction error is:

[0082]

[0083] Among them, ε is the small noise reconstruction error filtering threshold, which is determined according to the reconstruction error of the training set image by the autoencoder and is used to filter out small reconstruction error pixels, ΔX i , j is the reconstructed error image obtained by calculating the reconstructed image and the image to be detected, i and j are pixel positions, δX i,j is the binary image of the reconstruction error, which is used to indicate the pixel locations with large reconstruction errors;

[0084] The judgment module 402 calculates the average value of the pixels with larger reconstruction errors based on the reconstruction error image and the reconstruction error binary image, and uses the average value of the pixels with larger reconstruction errors as a judgment criterion.

[0085] In this embodiment, a defect judgment criterion for filtering small noise reconstruction errors may be used to perform defect detection on the image to be detected. The expression of the defect judgment criterion is:

[0086]

[0087] In this embodiment, if the defect judgment criterion of filtering small noise reconstruction error is met, the judgment module 402 determines that the image to be detected has defects; or if the defect judgment criterion of filtering small noise is not met, the judgment module 402 determines that the image to be detected does not have defects.

[0088] When the classification module 403 determines that the image to be detected has defects, it calculates the structural similarity values ​​of the image to be detected and multiple sample images marked with defect categories, determines the defect category marked by the sample image corresponding to the highest structural similarity value, and classifies the image to be detected into the determined defect category.

[0089] In this embodiment, the classification module 403 calculates the structural similarity value between the image to be detected and the template image according to a structural similarity calculation formula. In this embodiment, the structural similarity calculation formula is:

[0090] SSIM(x, y )=[l(x, y )] α [c(x, y )] β [s(x, y )] γ

[0091]

[0092] Among them, x and y represent the image to be detected and the template image respectively, SSIM(x,y) represents the structural similarity of images x and y, l(x,y) compares the brightness of images x and y, μ x , μ y Represents the average value of images x and y respectively; c(x,y) compares the contrast of images x and y, σ x ,σ y Represents the standard deviation of images x and y respectively; σ xy is the covariance of images x and y, C1, C2, and C3 are constants used to maintain the stability of l(x,y), c(x,y), and s(x,y).

[0093] The structural similarity value between the image to be detected and the template image is positively correlated with the similarity between the image to be detected and the template image.

[0094] In the present invention, by training the autoencoder, the autoencoder is used to reconstruct the image to be detected, and a reconstructed image corresponding to the image to be detected is obtained. Whether the image to be detected has defects is judged according to the defect judgment criterion based on filtering small noise, and the image to be detected is classified according to structural similarity, which can improve the efficiency of defect detection and classification of images.

[0095] Example 3

[0096] Figure 3 FIG. 1 is a schematic diagram of an electronic device 6 according to an embodiment of the present invention.

[0097] The electronic device 6 includes a memory 61, a processor 62, and a computer program 63 stored in the memory 61 and executable on the processor 62. When the processor 62 executes the computer program 63, the steps in the above-mentioned defect detection and classification method embodiment are implemented, for example: Figure 1 Alternatively, when the processor 62 executes the computer program 63, the functions of each module / unit in the above-mentioned defect detection and classification device embodiment are realized, for example Figure 2 Modules 401 to 403 in .

[0098] Exemplarily, the computer program 63 may be divided into one or more modules / units, which are stored in the memory 61 and executed by the processor 62 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program 63 in the electronic device 6. For example, the computer program 63 may be divided into Figure 2 For the image reconstruction module 401, the judgment module 402 and the classification module 403, please refer to Example 2 for the specific functions of each module.

[0099] In this embodiment, the electronic device 6 may be a computing device such as a desktop computer, a notebook computer, a PDA, or a cloud terminal device. Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 6 and does not limit the electronic device 6 . The electronic device 6 may include more or fewer components than shown, or may combine certain components or different components. For example, the electronic device 6 may also include input and output devices, network access devices, buses, and the like.

[0100] The processor 62 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor 62 may be any conventional processor. The processor 62 is the control center of the electronic device 6, connecting the various parts of the entire electronic device 6 using various interfaces and lines. The memory 61 may be used to store the computer program 63 and / or modules / units. The processor 62 implements the various functions of the electronic device 6 by running or executing the computer program and / or modules / units stored in the memory 61 and calling data stored in the memory 61. The memory 61 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data generated based on the use of the electronic device 6 (such as audio data, a phone book, etc.). Furthermore, the memory 61 may include a high-speed random access memory and may also include a non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0101] If the module / unit integrated in the electronic device 6 is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0102] In the several embodiments provided by the present invention, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the electronic device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.

[0103] In addition, the functional modules in various embodiments of the present invention may be integrated into the same processing module, each module may exist physically separately, or two or more modules may be integrated into the same module. The above-mentioned integrated modules may be implemented in the form of hardware or hardware plus software functional modules.

[0104] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention may be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive. The scope of the invention is defined by the appended claims, not the foregoing description, and all variations that come within the meaning and range of equivalents of the claims are intended to be encompassed within the present invention. Any reference signs in the claims should not be construed as limiting the claim to which they relate. Furthermore, it should be understood that the word "comprising" does not exclude additional modules or steps, and the singular does not exclude the plural. Multiple modules or electronic devices recited in a claim for an electronic device may be implemented by the same module or electronic device through software or hardware. Terms such as "first" and "second" are used to designate names and do not imply any particular order. Finally, it should be noted that the above embodiments are intended to illustrate the technical solutions of the present invention only and are not limiting. While the invention has been described in detail with reference to preferred embodiments, those skilled in the art will appreciate that the technical solutions of the present invention may be modified or replaced with equivalents without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A defect detection and classification method, characterized in that: The method comprises: Inputting the image to be detected into the trained autoencoder to obtain a reconstructed image corresponding to the image to be detected; Based on the defect judgment criterion of filtering small noise reconstruction error, it is judged whether the image to be inspected has defects. The expression of the defect judgment criterion is: , in, The reconstructed error image is obtained by calculating the reconstructed image and the image to be detected. To filter the binary image with small noise reconstruction error, i and j represent the pixel positions, and τ is the preset reconstruction error measurement threshold; When it is determined that the image to be detected has defects, the structural similarity values ​​of the image to be detected and multiple template images marked with defect categories are calculated respectively, wherein the structural similarity values ​​of the image to be detected and the template image are positively correlated with the similarity between the image to be detected and the template image; the defect category marked by the template image corresponding to the highest structural similarity value is determined, and the image to be detected is classified into the determined defect category.

2. The defect detection and classification method according to claim 1, wherein: The preset reconstruction error metric threshold is a statistical value of the training reconstruction error, which is adjusted based on a preset defect detection recall rate and precision rate, wherein the precision rate is the ratio of the number of images correctly detected as having defects to the total number of images detected as having defects, and the recall rate is the ratio of the number of images correctly detected as having defects to the total number of images that actually have defects.

3. The defect detection and classification method according to claim 1, wherein: The binary image is defined as: , Where ε is the small noise reconstruction error filtering threshold.

4. The defect detection and classification method according to claim 1, wherein: During the training of the autoencoder, the optimization objective function expression used is: , in, is the input image, To reconstruct the image, λ is a weight ranging from 0.1 to 10. is the L1 norm of the reconstructed error image, is the L2 norm of the reconstructed error image.

5. The defect detection and classification method according to claim 1, wherein: The structural similarity is an indicator for measuring the similarity between two digital images, and the calculation formula is: , Among them, x and y represent the image to be detected and the template image respectively. Indicates the structural similarity between images x and y, Compare the brightness of images x and y, Represents the average value of image x and y respectively; Compare the contrast of images x and y, Represents the standard deviation of image x and y respectively; is the covariance of image x, y, is a constant to maintain stability.

6. The defect detection and classification method according to claim 1, wherein: The method further comprises: If the defect judgment criterion of filtering small noise reconstruction error is met, it is determined that the image to be detected has defects; or if the defect judgment criterion of filtering small noise is not met, it is determined that the image to be detected does not have defects.

7. A defect detection and classification device, characterized in that: The device comprises: An autoencoder module is used to input the image to be detected into a trained autoencoder to obtain a reconstructed image corresponding to the image to be detected; A judgment module, configured to judge whether the image to be inspected has defects based on a defect judgment criterion for filtering small noise reconstruction errors; A classification module is used to calculate, when it is determined that the image to be detected has defects, the structural similarity values ​​of the image to be detected and multiple template images marked with defect categories, wherein the structural similarity values ​​of the image to be detected and the template images are positively correlated with the similarity between the image to be detected and the template images; determine the defect category marked by the template image corresponding to the highest structural similarity value, and classify the image to be detected into the determined defect category.

8. An electronic device, characterized in that: The electronic device includes a processor, and the processor is configured to implement the defect detection and classification method according to any one of claims 1 to 6 when executing a computer program stored in a memory.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the defect detection and classification method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Unsupervised defect detection method based on an auto-encoder

    CN109584225A

  • Product defect detection data processing method, device, system and equipment

    CN110554047A

  • Classification method, classification device for defect detection, electronic device and storage media

    TW202227808A

  • Method of detecting and classifying defects and electronic device using the same

    US20220207687A1