Defect detection method, device, electronic device and computer-readable storage medium
The image is processed through the autoencoder and feature extraction function, and the error threshold comparison is used to achieve high-precision defect detection, which solves the problem of time-consuming, labor-intensive and low accuracy in traditional manual detection.
Patent Information
- Application Number
- CN202110062706.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-18
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2041-01-18
AI Technical Summary
Traditional artificial defect detection methods are time-consuming and labor-intensive, with low detection accuracy and rely heavily on the visual and experience of the inspector.
The image feature extraction and reconstruction is performed using the autoencoder, the image texture features are processed using the Gabor function and the grayscale symbiosis matrix function, and the defects are determined through mean square error comparison, and the error threshold is set for defect detection.
It improves the accuracy of defect detection, reduces image redundancy information, and enhances the accuracy of texture feature information comparison.
Smart Images

Figure CN114862740B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a defect detection method and device, an electronic device, and a computer-readable storage medium. Background Art
[0002] Defect detection has become a critical component of modern industrial production processes, such as fabric defect detection in the textile industry and printed circuit board (PCB) defect detection in the electronics industry. Traditional manual inspection methods are time-consuming and labor-intensive, and inspection quality relies heavily on the inspector's vision and experience, resulting in low accuracy. Summary of the Invention
[0003] In view of this, it is necessary to provide a defect detection method and device, an electronic device and a computer-readable storage medium to improve the detection accuracy of defective images.
[0004] A first aspect of the present application provides a defect detection method, the defect detection method comprising:
[0005] (a) Multiple flawless images are fed into an autoencoder for model training to obtain multiple reconstructed images;
[0006] (b) processing the plurality of flawless images to obtain a plurality of target images;
[0007] (c) comparing the reconstructed image with a corresponding target image to obtain multiple sets of test errors;
[0008] (d) selecting an error threshold from multiple groups of test errors according to a preset rule;
[0009] (e) obtaining an image to be tested, and repeating steps (a) to (c) to obtain a reconstructed image to be tested, a target image to be tested, and a measured error between the reconstructed image to be tested and the target image to be tested;
[0010] (f) Determining a detection result of the image to be tested based on the error to be tested and an error threshold.
[0011] Furthermore, the autoencoder includes an encoder and a decoder, and step (a) includes the following sub-steps:
[0012] extracting image features of the flawless image using the encoder and outputting corresponding latent representations;
[0013] The latent representation is decoded using the decoder to obtain a corresponding reconstructed image.
[0014] Furthermore, step (b) includes the following sub-steps:
[0015] Processing the plurality of flawless images using a feature extraction function to obtain texture features of each flawless image;
[0016] The texture features of each acquired flawless image are converted to obtain a target image corresponding to each flawless image.
[0017] Furthermore, the feature extraction function includes a Gabor function and a gray level co-occurrence matrix function, and the texture feature includes a gray level co-occurrence matrix.
[0018] Furthermore, the test error is a mean square error between the reconstructed image and the target image, and the error to be tested is a mean square error between the reconstructed image to be tested and the target image to be tested.
[0019] Furthermore, the preset rule is: selecting the maximum value among the multiple groups of test errors as the error threshold.
[0020] Further, step (f) comprises:
[0021] When the error to be measured is less than the error threshold, determining the detection result as that the image to be measured is flawless; or
[0022] When the error to be measured is greater than or equal to the error threshold, the detection result is determined as the image to be measured having a defect.
[0023] A second aspect of the present application provides a defect detection device, comprising:
[0024] A training module, configured to feed a plurality of flawless images into an autoencoder for model training to obtain a plurality of reconstructed images;
[0025] An image processing module, configured to process the plurality of flawless images to obtain a plurality of target images;
[0026] a comparison module, configured to compare the reconstructed image with a corresponding target image to obtain multiple sets of test errors;
[0027] a determination module, configured to select an error threshold from a plurality of groups of test errors according to a preset rule;
[0028] An acquisition module, configured to obtain an image to be tested, and import the image to be tested into the training module, thereby obtaining a reconstructed image to be tested through the training module;
[0029] The image processing module is further used to process the image to be tested to obtain a target image to be tested. The comparison module is further used to compare the reconstructed image to be tested with the target image to be tested to obtain an error to be tested. The determination module is further used to determine the detection result of the image to be tested based on the error to be tested and the error threshold.
[0030] A third aspect of the present application provides an electronic device, comprising:
[0031] a memory storing at least one instruction; and
[0032] A processor is configured to execute instructions stored in the memory to implement the defect detection method.
[0033] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in an electronic device to implement the defect detection method.
[0034] The defect detection method provided by the present invention utilizes a feature extraction function to process an image to be tested to extract texture features, and further reconstructs the image to be tested using the texture features to obtain a target image to be tested. This effectively reduces redundant information in the image to be tested and amplifies the texture feature information of the image to be tested, thereby improving the accuracy when comparing the target image to be tested with the reconstructed image to be tested, thereby improving the detection accuracy of defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of a preferred embodiment of the defect detection method of the present invention.
[0036] Figure 2 for Figure 1 Sub-steps of step S1 are shown.
[0037] Figure 3 for Figure 1 Sub-steps of step S2 are shown.
[0038] Figure 4 for Figure 1 Sub-steps of step S3 are shown.
[0039] Figure 5 It is a functional module diagram of a preferred embodiment of the defect detection device of the present invention.
[0040] Figure 6 It is a structural diagram of an electronic device according to a preferred embodiment of the defect detection method implemented by the present invention.
[0041] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings.
[0042] Description of main component symbols
[0043] Defect detection device 100
[0044] Training Module 101
[0045] Image processing module 102
[0046] Comparison module 103
[0047] Determination module 104
[0048] Acquisition module 105
[0049] Prompt module 106
[0050] Electronic equipment 200
[0051] Memory 201
[0052] Processor 202
[0053] Computer Programs 203
[0054] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0055] 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.
[0056] The following description sets forth numerous specific details to facilitate a thorough understanding of the present invention. The embodiments described are merely a portion of the embodiments of the present invention, not all of them. 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.
[0057] 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.
[0058] See also Figure 1 , Figure 1 The flowchart of the preferred embodiment of the defect detection method of the present invention is shown in FIG. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0059] In step S1, a plurality of defect-free images are imported into an autoencoder (AE) for model training to obtain a plurality of reconstructed images.
[0060] It can be understood that an autoencoder (AE) is a type of artificial neural network (ANNs) used in semi-supervised learning and unsupervised learning. Its function is to perform representation learning on the input information by taking the input information as the learning target.
[0061] It can be understood that in this embodiment, the type of the autoencoder is not limited. For example, the autoencoder can be a contraction autoencoder, a regular autoencoder, or another type of autoencoder.
[0062] It can be understood that the self-encoder includes an encoder and a decoder. When executing step S1, please refer to Figure 2 , step S1 includes the following sub-steps:
[0063] Step S11: extracting image features of the flawless image using the encoder and outputting corresponding latent representations;
[0064] Step S12: Decode the latent representation using the decoder to obtain a corresponding reconstructed image.
[0065] It can be understood that the encoder and the decoder are both parameterized equations, and the latent representation is the abstract features of the flawless image learned by the encoder. The latent representation represents the texture features of the imported flawless image.
[0066] Step S2: Process the plurality of flawless images to obtain a plurality of target images. Figure 3 In this embodiment, step S2 includes the following sub-steps:
[0067] In step S21 , a feature extraction function is used to process the plurality of defect-free images to obtain texture features of each defect-free image.
[0068] Step S22 : converting the texture features of each of the acquired flawless images to obtain a target image corresponding to each of the flawless images.
[0069] In one embodiment, in step S21 and step S22 , the feature extraction function is a Gabor function and a gray level co-occurrence matrix function, and the texture feature is a gray level co-occurrence matrix of the flawless image.
[0070] As you can understand, the Gabor function is a windowed Fourier transform function that can extract relevant features at different scales and directions in the image frequency domain. The gray-level co-occurrence matrix function is a matrix function involving pixel distance and angle. It calculates the gray-level correlation between two points at a certain distance and direction in the image to reflect comprehensive information about the direction, interval, amplitude of change, and speed of the image.
[0071] Because texture is formed by the recurrence of grayscale distribution in space, there is a certain grayscale relationship between two pixels separated by a certain distance in image space, which is the spatial correlation characteristic of grayscale in the image. The gray level co-occurrence matrix is a common method for describing texture by statistically analyzing the spatial correlation characteristics of grayscale values.
[0072] Thus, in this embodiment, step S2 first processes the defect-free image using the Gabor function to obtain a corresponding complex signal. The imaginary part of the complex signal is then processed using the gray-level co-occurrence matrix function to obtain a gray-level co-occurrence matrix corresponding to the defect-free image, thereby obtaining texture features corresponding to the defect-free image. The image is then reconstructed using the gray-level relationships in the gray-level co-occurrence matrix to obtain the corresponding target image.
[0073] It is understood that in other embodiments, step S2 may be performed first and then step S1, or step S1 and step S2 may be performed simultaneously.
[0074] Step S3, compare the reconstructed image with the corresponding target image to obtain multiple groups of test errors. Figure 4 In this embodiment, step S3 includes the following sub-steps:
[0075] Step S31: extracting all pixel points of the reconstructed image and the corresponding target image respectively;
[0076] Step S32: comparing the pixel values of each pixel of the reconstructed image and the corresponding target image to obtain a pixel value difference of each pixel;
[0077] Step S33: Calculate the expected value of the square of the pixel value difference of each pixel point to obtain the multiple groups of test errors.
[0078] It is understandable that in other embodiments, before executing step S31, the reconstructed image and the target image may be preprocessed to make the size and direction of the reconstructed image and the target image consistent, so as to facilitate the subsequent execution of steps S31 to S33.
[0079] It can be understood that in this embodiment, the test error is the mean square error between the reconstructed image and the target image.
[0080] It is understandable that the present invention does not limit the type of the test error. For example, the test error may be a Peak Signal to Noise Ratio (PSNR) or a Structural Similarity (SSIM) indicator.
[0081] Step S4: selecting an error threshold from multiple groups of test errors according to a preset rule.
[0082] In this embodiment, the preset rule is: selecting the maximum value among the multiple groups of test errors as the error threshold.
[0083] Step S5: obtaining an image to be tested, and repeating steps S1 to S3 to obtain a reconstructed image to be tested, a target image to be tested, and a test error between the reconstructed image to be tested and the target image to be tested.
[0084] It can be understood that in step S5, the method for obtaining the reconstructed image to be tested is the same as the method for obtaining the reconstructed image in step S1, the method for obtaining the target image to be tested is the same as the method for obtaining the target image in step S2, and the method for obtaining the error to be tested is the same as the method for obtaining the test error in step S3, which will not be repeated here.
[0085] It can be understood that the error to be measured is the mean square error between the reconstructed image to be measured and the target image to be measured.
[0086] It is understood that in other embodiments, the error to be measured and the test error are errors of the same type. The present invention does not limit the type of the error to be measured. For example, the error to be measured can be a Peak Signal to Noise Ratio (PSNR) or a Structural Similarity (SSIM) indicator.
[0087] Step S6: determining a detection result of the image to be tested according to the error to be tested and an error threshold.
[0088] In this embodiment, step S6 includes:
[0089] When the error to be measured is less than the error threshold, determining the detection result as that the image to be measured is flawless; or
[0090] When the error to be measured is greater than or equal to the error threshold, the detection result is determined as the image to be measured having a defect.
[0091] It is understandable that, in other embodiments, the defect detection method further includes step S7: outputting a corresponding alarm signal or prompt signal according to the detection result.
[0092] In other words, different corresponding measures can be taken based on the test results. For example, in this embodiment, when the test result indicates a defect, a reminder message is generated based on the image to be tested and sent to the terminal device of a designated contact. The designated contact may be the quality control personnel responsible for inspecting the test object. Through the above implementation, the designated contact can be promptly notified when a defect is found in the image to be tested.
[0093] In the embodiment of the present application, a plurality of flawless images, such as N flawless images, are input as an example to describe the flaw detection method of this case in detail.
[0094] First, N flawless images are fed into an autoencoder, denoted as flawless image 1, flawless image 2, flawless image 3, ..., flawless image N, to obtain corresponding reconstructed images, denoted as reconstructed image 1, reconstructed image 2, reconstructed image 3, ..., reconstructed image N. Next, the N flawless images are processed using the Gabor function and the gray-level co-occurrence matrix function to obtain corresponding target images, denoted as target image 1, target image 2, target image 3, ..., target image N. These reconstructed images are then compared with their corresponding target images to obtain multiple sets of test errors. For example, comparing reconstructed image 1 with target image 1 yields an error value of 0.01, denoted as test error 1; comparing reconstructed image 2 with target image 2 yields an error value of 0.02, denoted as test error 2; comparing reconstructed image 3 with target image 3 yields an error value of 0.0001, denoted as test error 3; and so on. The error values obtained by comparing reconstructed image N with target image N are denoted as test error N. The maximum value among the N groups of test errors is selected as the error threshold. An image to be tested is obtained, and the image to be tested is input into the autoencoder to obtain a reconstructed image to be tested; the image to be tested is processed using the Gabor function and the gray-level co-occurrence matrix function to obtain a target image to be tested. The reconstructed image to be tested is compared with the target image to be tested to obtain an error to be tested. The error to be tested is compared with the error threshold. If the error to be tested is less than the error threshold, the detection result is determined to be that the image to be tested is flawless; if the error to be tested is greater than or equal to the error threshold, the detection result is determined to be that the image to be tested has a defect.
[0095] It can be understood that in the present invention, after the autoencoder is trained with multiple defect-free images, when an image containing defects is input, the autoencoder will repair some of the defects and then output a reconstructed image with the repaired defects. Furthermore, the present invention uses the feature extraction function to process the image to be tested (or defect-free image) to obtain the target image to be tested (or target image), thereby reducing redundant information in the image to be tested (or defect-free image) and amplifying the feature information of the image to be tested (or defect-free image). Therefore, for the same image to be tested, the error between the reconstructed image to be tested obtained by inputting the autoencoder and the target image to be tested obtained by processing the feature extraction function should be within a certain range. If the error exceeds the range, it can be assumed that the autoencoder has repaired some defects, resulting in a large error between the reconstructed image to be tested and the target image to be tested. The present invention determines an error threshold by comparing multiple reconstructed images with multiple target images. That is, the error threshold is the maximum error acceptable when the autoencoder reconstructs the defect-free image. Therefore, when the error between the reconstructed image to be tested and the target image to be tested exceeds the error threshold, it can be considered that the image to be tested has defects, causing the error when the autoencoder reconstructs the image to exceed the error threshold.
[0096] It can be understood that the present invention utilizes a feature extraction function to process the image to be tested to extract texture features, and further reconstructs the image to be tested by using the texture features to obtain a target image to be tested, thereby effectively reducing the redundant information of the image to be tested and amplifying the texture feature information of the image to be tested, thereby improving the accuracy of the comparison between the target image to be tested and the reconstructed image to be tested, thereby improving the detection accuracy of defect detection.
[0097] See also Figure 5 It is understood that another embodiment of the present invention further provides a defect detection device 100. The defect detection device 100 includes a training module 101, an image processing module 102, a comparison module 103, a determination module 104 and an acquisition module 105.
[0098] The training module 101 is used to import a plurality of flawless images into an autoencoder for model training to obtain a plurality of reconstructed images.
[0099] The image processing module 102 is configured to process the plurality of flawless images to obtain a plurality of target images.
[0100] The comparison module 103 is used to compare the reconstructed image with the corresponding target image to obtain multiple groups of test errors.
[0101] The determination module 104 is configured to select an error threshold from multiple groups of test errors according to a preset rule.
[0102] The acquisition module 105 is used to obtain an image to be tested, and import the image to be tested into the training module 101 to obtain a reconstructed image to be tested through the training module 101 .
[0103] The image processing module 102 is further configured to process the image to be tested to obtain a target image to be tested. The comparison module 103 is further configured to compare the reconstructed image to be tested with the target image to obtain a test error. The determination module 104 is further configured to determine a test result of the image to be tested based on the test error and the error threshold.
[0104] It will be appreciated that in other embodiments, the defect detection device 100 further includes a prompt module 106. The prompt module 106 is configured to output a corresponding alarm signal or prompt signal based on the detection result. For example, in this embodiment, when the detection result indicates a defect, the prompt module 106 generates a reminder message based on the image to be tested and sends the message to a terminal device of a designated contact. The designated contact may be the quality control personnel responsible for inspecting the test object. Through the above embodiment, the designated contact can be promptly notified when a defect is detected in the image to be tested.
[0105] It can be understood that the training module 101, image processing module 102, comparison module 103, determination module 104, acquisition module 105 and prompt module 106 are used to jointly implement steps S1 to S7 in the above-mentioned defect detection method embodiment. The specific implementation process of each functional module is not repeated here. Please refer to the above-mentioned steps S1 to S7 for details.
[0106] Understandable, please refer to Figure 6 Another embodiment of the present invention further provides an electronic device 200. The electronic device 200 includes a memory 201, a processor 202, and a computer program 203 stored in the memory 201 and executable on the processor 202.
[0107] The electronic device 200 may be any one of a smartphone, a tablet computer, a laptop computer, an embedded computer, a desktop computer, or a server, etc. Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 200 and does not limit the electronic device 200 , which may include more or fewer components than shown, or may combine certain components, or may include different components.
[0108] The processor 202 is configured to implement the steps of the above-described defect detection method embodiments, such as steps S1-S7 shown in the first embodiment, when executing the computer program 203. Alternatively, the processor 202 implements the functions of the various modules / units of the above-described defect detection device 100 embodiments, such as the training module 101, image processing module 102, comparison module 103, determination module 104, acquisition module 105, and prompt module 106 in the second embodiment, when executing the computer program 203.
[0109] Exemplarily, the computer program 203 may be divided into one or more modules / units, which are stored in the memory 201 and executed by the processor 202 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 203 in the electronic device 200. For example, the computer program 203 may be divided into the training module 101, image processing module 102, comparison module 103, determination module 104, acquisition module 105, and prompt module 106 in the second embodiment.
[0110] The processor 202 may be a central processing unit (CPU), or 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 202 may be any conventional processor, etc. The processor 202 is the control center of the electronic device 200, and connects various parts of the entire electronic device 200 using various interfaces and lines.
[0111] The memory 201 can be used to store the computer program 203 and / or modules / units. The processor 202 implements various functions of the electronic device 200 by running or executing the computer program and / or modules / units stored in the memory 201 and calling data stored in the memory 201. The memory 201 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created based on the use of the electronic device 200 (such as video data, audio data, a phone book, etc.). In addition, the memory 201 may include high-speed random access memory and may also include 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.
[0112] If the modules / units integrated in the electronic device 200 are implemented in the form of software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes 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 the form of source code, 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), electrical 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 electrical carrier signals and telecommunication signals.
[0113] 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.
[0114] 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.
[0115] It is obvious 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 present invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the invention is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims be included in the present invention. Any figure marks in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other modules or steps, and the singular does not exclude the plural. Multiple modules or electronic devices stated in the electronic device claim may also be implemented by the same module or electronic device through software or hardware. Words such as first and second are used to indicate names and do not indicate any particular order.
[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A defect detection method, characterized in that: The defect detection method comprises: (a) Multiple flawless images are fed into an autoencoder for model training to obtain multiple reconstructed images; (b) processing the plurality of flawless images to obtain a plurality of target images; (c) comparing the reconstructed image with a corresponding target image to obtain multiple sets of test errors; (d) selecting an error threshold from multiple groups of test errors according to a preset rule; (e) obtaining an image to be tested, and repeating steps (a) to (c) to obtain a reconstructed image to be tested, a target image to be tested, and a measured error between the reconstructed image to be tested and the target image to be tested; (f) determining a detection result of the image to be tested based on the error to be tested and the error threshold; Wherein, step (b) includes the following sub-steps: Processing the plurality of flawless images using a feature extraction function to obtain texture features of each flawless image; The texture features of each of the acquired flawless images are converted to obtain the target image corresponding to each of the flawless images.
2. The defect detection method according to claim 1, wherein: The autoencoder includes an encoder and a decoder, and step (a) includes the following sub-steps: extracting image features of the flawless image using the encoder and outputting corresponding latent representations; The latent representation is decoded using the decoder to obtain a corresponding reconstructed image.
3. The defect detection method according to claim 1, wherein: The feature extraction function includes a Gabor function and a gray-level co-occurrence matrix function, and the texture feature includes a gray-level co-occurrence matrix.
4. The defect detection method according to claim 1, wherein: The test error is the mean square error between the reconstructed image and the target image, and the error to be tested is the mean square error between the reconstructed image to be tested and the target image to be tested.
5. The defect detection method according to claim 1, wherein: The preset rule is: selecting the maximum value among the multiple groups of test errors as the error threshold.
6. The defect detection method according to claim 1, wherein: Step (f) comprises: When the error to be measured is less than the error threshold, determining the detection result as that the image to be measured is flawless; or When the error to be measured is greater than or equal to the error threshold, the detection result is determined as the image to be measured having a defect.
7. A defect detection device, characterized in that: The defect detection device comprises: A training module, configured to feed a plurality of flawless images into an autoencoder for model training to obtain a plurality of reconstructed images; an image processing module, configured to process the plurality of flawless images to obtain a plurality of target images, wherein the image processing module processes the plurality of flawless images using a feature extraction function to obtain texture features of each flawless image; and converts the obtained texture features of each flawless image to obtain the target image corresponding to each flawless image; a comparison module, configured to compare the reconstructed image with a corresponding target image to obtain multiple sets of test errors; A determination module, configured to select an error threshold from multiple groups of test errors according to a preset rule; An acquisition module, configured to obtain an image to be tested, and import the image to be tested into the training module, thereby obtaining a reconstructed image to be tested through the training module; The image processing module is further used to process the image to be tested to obtain a target image to be tested. The comparison module is further used to compare the reconstructed image to be tested with the target image to be tested to obtain an error to be tested. The determination module is further used to determine the detection result of the image to be tested based on the error to be tested and the error threshold.
8. An electronic device, characterized in that: The electronic device comprises: a memory storing at least one instruction; and A processor, configured to execute instructions stored in the memory to implement the defect detection method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in an electronic device to implement the defect detection method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Detection method for defect area of colored fabric cutting piece
CN111402197A