Image detection method and apparatus, electronic device, and storage medium
By using preset defect detection algorithms to obtain defect-free images and train defect detection models in the surface quality detection of industrial products, the problems of misjudgment and low efficiency in traditional detection methods are solved, and efficient and accurate defect detection is achieved.
Patent Information
- Application Number
- PCT/CN2024/140303
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-27
- Filing Date
- 2024-12-18
- Publication Date
- 2025-07-03
AI Technical Summary
Traditional industrial product surface quality detection methods have problems of low accuracy, low efficiency and high labor intensity, and traditional visual detection algorithms are prone to misjudgment of normal products as defective products, which affects the accuracy of the detection results.
By acquiring the image to be detected, preliminary detection is performed using the preset defect detection algorithm, defect-free images are obtained and defect detection models are trained, and secondary detection is performed using the trained model to improve detection accuracy and robustness.
It improves the accuracy and robustness of surface quality inspection of industrial products, reduces the amount of calculation, improves the detection efficiency, avoids repeated calculations and passes, and enhances the accuracy and efficiency of detection.
Smart Images

Figure CN2024140303_03072025_PF_FP_ABST
Abstract
Description
Image detection method, device, electronic device and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on December 27, 2023, with application number 202311811816.8 and invention name “Image detection method, device, electronic device and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the technical field, and more specifically to an image detection method, an image detection device, an electronic device, and a storage medium. Background Art
[0003] Traditionally, industrial product surface quality inspections rely on manual testing by quality inspectors. However, these methods suffer from low precision, low efficiency, and high labor intensity. Utilizing machine vision technology, automated surface quality inspections for industrial products have become a crucial tool for improving product quality in the manufacturing industry. Machine vision-based quality inspection systems typically offer advantages such as high precision, high efficiency, rapid continuous inspection speeds, and non-contact measurement.
[0004] Related technologies typically use visual inspection algorithms to detect surface defects on industrial products. However, when the threshold control is low, traditional visual inspection algorithms can easily misidentify normal industrial products as defective, thus affecting the accuracy of inspection results. Summary of the Invention
[0005] In view of the above problems, the present application is proposed. The present application provides an image detection method, an image detection device, an electronic device and a storage medium.
[0006] According to one aspect of the present application, an image detection method is provided, including: acquiring an image to be detected; performing defect detection on the image to be detected using a preset defect detection algorithm to determine a first defect detection result, wherein the first defect detection result includes position information of a defective area in the image to be detected; acquiring a non-defective image from the image to be detected based on the first defect detection result; training a defect detection model using the non-defective image to obtain a trained defect detection model; performing defect detection on a target image using at least the trained defect detection model to determine a second defect detection result, wherein the second defect detection result includes position information of the defective area in the target image, and the target image is the image to be detected or a defective image acquired from the image to be detected based on the first defect detection result.
[0007] This technical solution uses a first defect detection result obtained based on a preset defect detection algorithm to obtain a defect-free image from the target image. It then uses a defect detection model trained on this defect-free image to perform defect detection on the target image, thereby improving the accuracy and robustness of image detection. Furthermore, this solution eliminates the need for additional image collection when training the defect detection model, which helps improve the efficiency of image detection.
[0008] In one possible implementation, defect detection is performed on a target image using at least a trained defect detection model to determine a second defect detection result, including: extracting a sub-image to be detected on the target image that corresponds one-to-one to the position of at least one target image; performing defect detection on at least part of the extracted at least one sub-image to be detected using the trained defect detection model to determine a sub-defect detection result corresponding one-to-one to each sub-image to be detected in at least part of the sub-image to be detected, the sub-defect detection result including position information and / or area of the sub-defect area in the corresponding sub-image to be detected; wherein the second defect detection result includes the sub-defect detection result corresponding one-to-one to at least part of the sub-image to be detected.
[0009] The above technical solution extracts sub-images to be detected from a target image and uses a trained defect detection model to perform defect detection on at least a portion of the extracted sub-images to be detected. This method can obtain sub-defect detection results that correspond one-to-one with at least a portion of the sub-images to be detected. In short, this solution helps to more accurately determine defect detection results for target images.
[0010] In one possible implementation, defect detection is performed on at least a portion of at least one sub-image to be detected using a trained defect detection model, including: using the trained defect detection model to perform defect detection on at least one sub-image to be detected that has an intersection with the defect area indicated in the first defect detection result.
[0011] In the solution of this example, only the sub-image to be detected with defects determined by the first defect detection result needs to be input into the trained defect detection model for defect detection, which helps to reduce the amount of calculation and improve the efficiency of defect detection.
[0012] In one possible implementation, defect detection is performed on at least a portion of at least one sub-image to be detected using a trained defect detection model, including: using the trained defect detection model to perform defect detection on at least one sub-image to be detected in which the degree of pixel value fluctuation in the sub-image to be detected is greater than a preset fluctuation degree.
[0013] In the solution of this example, only the sub-image to be detected with higher image noise needs to be input into the trained defect detection model for defect detection, which helps to reduce the amount of calculation and improve the efficiency of defect detection.
[0014] In one possible implementation, defect detection is performed on the target image using at least a trained defect detection model to determine a second defect detection result, and the method further includes: for each sub-image to be detected in the remaining sub-images to be detected, the first defect detection result corresponding to the sub-image to be detected is used as the sub-defect detection result corresponding to the sub-image to be detected; or, defect detection is performed on the remaining sub-images to be detected using the trained defect detection model to determine the sub-defect detection results corresponding one-to-one to the remaining sub-images to be detected; wherein the remaining sub-images to be detected are the other sub-images to be detected in the at least one sub-image to be detected except for the at least part of the sub-image to be detected, and the second defect detection result also includes the sub-defect detection results corresponding one-to-one to the remaining sub-images to be detected.
[0015] In the above technical solution, the first defect detection result can be directly used to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected, or the trained defect detection model can be used to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected. Directly using the first defect detection result to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected helps avoid repeated calculations and improve defect detection efficiency. Using a trained defect detection model to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected helps to more accurately determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected.
[0016] In a possible implementation, the preset defect detection algorithm performs defect detection based on the difference between at least one image region in the image to be detected and a standard image.
[0017] The above technical solution helps to obtain the first defect detection result of the image to be detected more accurately and quickly by directly performing defect detection based on the difference between at least one image area in the image to be detected and the standard image.
[0018] In one possible implementation, the pixels of each image area in at least one image area correspond one-to-one to the pixels of the standard image, and the preset defect detection algorithm includes the following operations: for each image area in at least one image area, calculating the pixel value difference between the pixel value of each pixel in the image area and the pixel value of the corresponding pixel in the standard image, and the pixel difference between the image area and the standard image is represented by the pixel value difference; and determining the area where the pixels in the image area whose corresponding pixel value difference is greater than the preset difference threshold are located as the defect area in the image to be detected.
[0019] The above technical solution performs defect detection directly based on the pixel value difference between the pixel value of each pixel in the image area and the pixel value of the corresponding pixel in the standard image. The calculation is simple, helps to improve calculation efficiency, and has relatively good accuracy.
[0020] In one possible implementation, the image to be inspected and the standard image are product images of the product to be inspected, and each image area in at least one image area and the standard image each contain a single product to be inspected. The preset defect detection algorithm also includes the following operations: obtaining multiple sample images containing a single product to be inspected, and the width and height of different sample images are consistent; calculating the median pixel value or the mean pixel value of the pixels located at the same image coordinates in the multiple sample images obtained; and determining the image whose pixel value is equal to the median pixel value or the mean pixel value as the standard image.
[0021] In the above technical solution, an image whose pixel value is equal to the median pixel value or the mean pixel value is determined as a standard image. Thus, the first defect detection result of the image to be detected can be determined more accurately based on the standard image.
[0022] In one possible implementation, the image to be inspected contains multiple identical areas to be inspected, and a defect-free image is obtained from the image to be inspected based on the first defect detection result, including: extracting multiple target product images from the image to be inspected, each target product image containing a single area to be inspected; and determining the target product image that does not contain the defect area indicated by the first defect detection result among the multiple target product images as a defect-free image.
[0023] In this example, the image to be inspected contains multiple identical products to be inspected. Each area containing a product to be inspected corresponds to a target product image. This solution uses the first defect detection result to determine whether each target product image contains a defect (i.e., whether the target product image is a defective image). This allows for relatively accurate acquisition of defect-free images, thereby providing relatively accurate samples for training the defect detection model in subsequent steps and improving the detection accuracy of the defect detection model.
[0024] In one possible implementation, the target image is a defective image. When executing the step of obtaining a defect-free image from the image to be detected based on the first defect detection result, the method further includes: determining the target product image containing the defect area indicated by the first defect detection result among multiple target product images as a defective image.
[0025] In this example, the determination of whether the target product image is defective can be made directly based on the first defect detection result. In subsequent steps, the trained defect detection model can be used to perform a secondary judgment on the defective image, thereby further improving the accuracy of the image detection method.
[0026] In one possible implementation, there are multiple images to be inspected, and different images to be inspected respectively contain the same product to be inspected. A defect-free image is obtained from the images to be inspected based on the first defect detection result, including: determining the image to be inspected that does not contain the defect area indicated by the first defect detection result among the multiple images to be inspected as a defect-free image.
[0027] The above technical solution can more accurately obtain defect-free images from multiple images to be detected, thereby providing more accurate samples for the training of the defect detection model in subsequent steps, and helping to improve the detection accuracy of the defect detection model.
[0028] In one possible implementation, the target image is a defective image. When executing the step of obtaining a defect-free image from the image to be detected based on the first defect detection result, the method further includes: determining the image to be detected that contains the defect area indicated by the first defect detection result among the multiple images to be detected as a defective image.
[0029] In the solution of this example, defective images among multiple images to be detected can be directly determined. In subsequent steps, the trained defect detection model can be used to perform a secondary judgment on the defective images, thereby further improving the accuracy of the image detection method.
[0030] In one possible implementation, a defect detection model is trained using a defect-free image, including: extracting a sample sub-image corresponding one-to-one to at least one target image position on the defect-free image; for each target image position of the at least one target image position, training the defect detection model using the sample sub-image corresponding to the target image position to obtain a trained defect detection model corresponding to the target image position.
[0031] In the above technical solution, the defect detection model is trained using sample sub-images at the same target image position, thereby obtaining a trained defect detection model corresponding to each target image position. This solution helps to obtain a defect detection model with high detection accuracy.
[0032] According to another aspect of the present application, an image detection device is provided, including: a first acquisition module for acquiring an image to be detected; a first detection module for performing defect detection on the image to be detected using a preset defect detection algorithm to determine a first defect detection result, wherein the first defect detection result includes position information of a defective area in the image to be detected; a second acquisition module for acquiring a defect-free image from the image to be detected based on the first defect detection result; a training module for training a defect detection model using the defect-free image to obtain a trained defect detection model; and a second detection module for performing defect detection on a target image using at least the trained defect detection model to determine a second defect detection result, wherein the second defect detection result includes position information of the defective area in the target image, and the target image is the image to be detected or a defective image acquired from the image to be detected based on the first defect detection result.
[0033] This technical solution uses a first defect detection result obtained based on a preset defect detection algorithm to obtain a defect-free image from the target image. It then uses a defect detection model trained on this defect-free image to perform defect detection on the target image, thereby improving the accuracy and robustness of image detection. Furthermore, this solution eliminates the need for additional image collection when training the defect detection model, which helps improve the efficiency of image detection.
[0034] According to another aspect of the present application, an electronic device is provided, including a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions are used to execute the above-mentioned image detection method when the processor is executed.
[0035] This technical solution uses a first defect detection result obtained based on a preset defect detection algorithm to obtain a defect-free image from the target image. It then uses a defect detection model trained on this defect-free image to perform defect detection on the target image, thereby improving the accuracy and robustness of image detection. Furthermore, this solution eliminates the need for additional image collection when training the defect detection model, which helps improve the efficiency of image detection.
[0036] According to another aspect of the present application, a storage medium is provided, on which program instructions are stored. The program instructions are used to execute the above-mentioned image detection method when running.
[0037] This technical solution uses a first defect detection result obtained based on a preset defect detection algorithm to obtain a defect-free image from the target image. It then uses a defect detection model trained on this defect-free image to perform defect detection on the target image, thereby improving the accuracy and robustness of image detection. Furthermore, this solution eliminates the need for additional image collection when training the defect detection model, which helps improve the efficiency of image detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and other purposes, features, and advantages of the present application will become more apparent through a more detailed description of the embodiments of the present application in conjunction with the accompanying drawings. The accompanying drawings are intended to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the drawings, the same reference numerals generally represent the same components or steps.
[0039] FIG1 is a schematic flow chart of an image detection method according to an embodiment of the present application;
[0040] FIG2 is a schematic diagram showing an image detection method according to a specific embodiment of the present application;
[0041] FIG3 is a schematic diagram showing an image detection method according to another specific embodiment of the present application;
[0042] FIG4 is a schematic diagram showing an image to be detected according to an embodiment of the present application;
[0043] FIG5 shows a schematic block diagram of an image detection device according to an embodiment of the present application; and
[0044] FIG6 shows a schematic block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the present application more apparent, the following is a detailed description of example embodiments according to the present application with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the example embodiments described herein. Based on the embodiments of the present application described in this application, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of this application.
[0046] Traditionally, surface quality inspections of industrial products are performed manually by quality inspectors. For example, wafers require at least four optical inspections during the semiconductor packaging process. These inspections involve personnel using microscopes at varying magnifications to perform spot checks or full inspections. This results in low efficiency, fatigued eyesight, and missed defects. To improve inspection efficiency, machine vision technology is now commonly used to conduct quality inspections throughout the entire semiconductor packaging process.
[0047] In the related art, visual inspection (MV) algorithms are often used to directly detect defects on the surface of industrial products. In some embodiments of the related art, MV algorithms typically pre-create a standard template of the product to be inspected based on a sample image. The algorithm then performs a difference calculation between the image to be inspected, which contains the product to be inspected, and the standard template image. If the difference exceeds a preset threshold, the image to be inspected is determined to contain a defect.
[0048] However, the preset threshold is generally set by the user. When the preset threshold is relatively small, it is easy to judge normal industrial products as defective industrial products, while when the preset threshold is relatively large, it is easy to judge defective industrial products as normal industrial products. This affects the accuracy of the detection results.
[0049] To at least partially address the above issues, an embodiment of the present application provides an image detection method. FIG1 illustrates a schematic flow chart of an image detection method according to an embodiment of the present application. As shown in FIG1 , the image detection method 100 may include the following steps S110, S120, S130, S140, and S150.
[0050] In step S110 , an image to be detected is acquired.
[0051] According to embodiments of the present application, the image to be inspected can be an image of any object to be inspected for defects. In other words, the image to be inspected can include the target object to be inspected for defects. The target object to be inspected for defects can be any suitable object, including but not limited to metal, glass, paper, electronic components, and other objects with strict appearance requirements and clear indicators, and this application does not limit them.
[0052] In one possible implementation, the image to be detected may be a black and white image or a color image. In one possible implementation, the image to be detected may be an image of any size or resolution. In another possible implementation, the image to be detected may also be an image that meets a preset resolution requirement. In one example, the image to be detected may be a black and white image with a size of 512*512 pixels. The requirements for the image to be detected may be set based on the actual detection requirements, the hardware conditions of the image acquisition device, and the requirements of the defect detection algorithm (such as the preset defect detection algorithm below) for the input image, and this application does not limit them.
[0053] In one possible implementation, the image to be detected may be an original image captured by an image acquisition device. According to an embodiment of the present application, any existing or future image acquisition method may be used to acquire the image to be detected. In one possible implementation, the image to be detected may be acquired by an image acquisition device in a machine vision inspection system, such as by using a lighting device, lens, high-speed camera, and image acquisition card that match the inspection environment and the object to be inspected.
[0054] In another example, the image to be detected may be an image obtained by performing a preprocessing operation on the original image.
[0055] In a possible implementation, the pre-processing operation can be any pre-processing operation that can meet the needs of the subsequent image detection step, and can include all operations that are convenient for image detection to be carried out to the image to be detected in order to improve the visual effect of the image, improve the clarity of the image, or highlight certain features in the image. In a possible implementation, the pre-processing operation can include denoising operations such as filtering, and can also include the adjustment of image parameters such as image enhancement grayscale, contrast, brightness. In another possible implementation, the pre-processing operation can include pixel normalization processing of the image to be detected. For example, each pixel of the image to be detected can be divided by 255 so that the pixel of the pre-processed image to be detected is within the range of 0-1. This helps to improve the efficiency of subsequent image detection.
[0056] In one possible implementation, the preprocessing operation may further include operations such as cropping and deleting images. For example, the original image may be cropped to the size required by the defect detection algorithm, or original images that do not meet image quality requirements may be deleted to obtain an image to be detected that meets the image quality requirements.
[0057] In one possible implementation, the number of images to be inspected may be one or more. In one possible implementation, the number of images to be inspected is one, for example, only one image to be inspected is acquired at a time. In another possible implementation, the number of images to be inspected may be multiple, for example, 10 or 500 images. Multiple images to be inspected may be acquired at once, and then defect detection may be performed on the multiple images to be inspected using the preset defect detection algorithm described below.
[0058] In step S120 , defect detection is performed on the image to be detected using a preset defect detection algorithm to determine a first defect detection result, wherein the first defect detection result includes position information of a defect area in the image to be detected.
[0059] In one possible implementation, a defect region is a region of the target object in the image to be inspected that has defects, and may be a partial region of the image to be inspected. It will be readily understood that the normal region and the defect region of the target object in the image to be inspected may have different morphologies, and the defect region may be detected based on these different morphologies, such as grayscale and texture. For example, if the image to be inspected is an image of a metal object, the defect region may be an area showing scratches on the metal object. If the image to be inspected is an image of glass, the defect region may be an area showing bubbles, impurities, cracks, etc. in the glass.
[0060] In one possible implementation, the preset defect detection algorithm may be any existing or future developed defect detection algorithm. For example, the algorithm may be based on the comparison result between the image to be detected and the standard template image to determine whether there are defects in the image to be detected. In some embodiments, an image of the target object may be acquired in advance as a standard template image. Then, feature vectors are extracted from the image to be detected and the standard template image respectively to obtain the feature vector of the image to be detected and the feature vector of the standard template image, and the similarity of the two feature vectors is calculated to obtain a first defect detection result. In other embodiments, template matching may be performed based on the image to be detected and the standard template image to obtain a first defect detection result. In yet other embodiments, a subtraction operation may be performed on the image to be detected and the standard template image to obtain the pixel difference corresponding to each pixel position in the image. Then, each pixel difference is compared with a pixel difference threshold to obtain a first defect detection result.
[0061] In one possible implementation, the position information of the defective region in the image to be inspected may be the relative position between the defective region and the image to be inspected. In another possible implementation, the position information of the defective region in the image to be inspected may be the coordinates of the defective region in the image to be inspected. For example, the coordinates of the four corner points of the target frame where the defective region is located may be used.
[0062] In step S130 , a non-defective image is acquired from the image to be inspected based on the first defect detection result.
[0063] In one possible implementation, the defect-free image may include a partial area in the image to be inspected. In some embodiments, the image to be inspected may be a wafer image, and each wafer image includes multiple bare die units. The partial area may be the image area corresponding to each die unit on the wafer image. In this embodiment, step S120 may be performed for each wafer image to determine whether each die unit on the wafer image has defects. When a die unit has a defect, the image area where the die unit is located is regarded as a defective image; when the image area where the die unit is located does not have a defect, the image area where the die unit is located is regarded as a defect-free image. The above division method is only an example, and other division methods can also be used to divide partial areas on the image to be inspected. For example, a preset number of die units can be used as an area, and a single wafer can be divided into areas of the same size in advance. Then, the area is used as a processing unit. When there are no defects in the die units in the area, the area is determined to be a defect-free image, and a trained defect detection model is obtained.
[0064] In one possible implementation, there may be multiple images to be inspected. Multiple images to be inspected may include the same number of target objects (e.g., wafers). After executing step S120 on the images to be inspected, a first defect detection result corresponding to each image to be inspected may be obtained. Then, based on the first defect detection result corresponding to each image to be inspected, the images to be inspected that do not have defects may be treated as defect-free images. In some embodiments, all defect-free images in the images to be inspected may be obtained. In other embodiments, only some defect-free images in the images to be inspected may be obtained.
[0065] After the defect-free image is obtained, step S140 may be performed based on the obtained defect-free image.
[0066] In step S140 , the defect detection model is trained using the defect-free image to obtain a trained defect detection model.
[0067] In one possible implementation, a defect-free image can be divided into multiple sample sub-images, each of which can be used to train the same or different defect detection models. In one embodiment, the same defect detection model can be trained based on multiple sample sub-images located at different positions in the defect-free image. In another embodiment, the defect detection model can be trained based on a sample sub-image located at each position in the defect-free image, thereby obtaining a trained defect detection model that corresponds one-to-one with each position in the defect-free image.
[0068] In one possible implementation, the defect detection model can be any existing or future developed defect detection model that can be used for defect detection. This application does not limit the specific model type. In one possible implementation, the defect detection model can be a neural network model for defect detection. For example, it can be a target detection model based on deep learning, a semantic segmentation model, etc. In one possible implementation, the defect detection model can also be trained based on any open source anomaly detection algorithm. For example, the open source anomaly detection algorithm can be such as the Patchcore algorithm, the CFA algorithm, the PyramidFlow algorithm, etc.
[0069] In step S150, defect detection is performed on the target image using at least the trained defect detection model to determine a second defect detection result, wherein the second defect detection result includes location information of the defect area in the target image, and the target image is the image to be detected or a defective image obtained from the image to be detected based on the first defect detection result.
[0070] In short, the defective area detected in step S130 may be due to over-inspection. Based on this, the embodiment of the present application can use S150 to perform a secondary inspection on the first inspection result. In other words, the defective area detected in step S130 is subjected to a secondary inspection using the trained defect detection model to determine the second defect detection result.
[0071] Similar to the defect-free image, the defective image can be a partial area of the image to be inspected or the entire image to be inspected. For example, when there are multiple images to be inspected, if a defect is determined to exist in the image to be inspected based on the first defect detection result, the image to be inspected is determined to be a defective image.
[0072] Figure 2 illustrates a schematic diagram of an image detection method according to a specific embodiment of the present application. As shown in Figure 2 , a predetermined defect detection algorithm is first used to perform defect detection on an image to be detected to determine a first defect detection result. Then, a target image within the image to be detected is input into a trained defect detection model to obtain a second defect detection result, thereby determining the location and area of the defective region within the image to be detected. In this embodiment, the target image is a defective image obtained from the image to be detected based on the first defect detection result.
[0073] This technical solution uses a first defect detection result obtained based on a preset defect detection algorithm to obtain a defect-free image from the target image. It then uses a defect detection model trained on this defect-free image to perform defect detection on the target image, thereby improving the accuracy and robustness of image detection. Furthermore, this solution eliminates the need for additional image collection when training the defect detection model, which helps improve the efficiency of image detection.
[0074] In one possible implementation, step S150, performing defect detection on the target image using at least a trained defect detection model to determine a second defect detection result, may specifically include the following steps: extracting a sub-image to be detected on the target image that corresponds one-to-one to the position of at least one target image; performing defect detection on at least part of the extracted at least one sub-image to be detected using the trained defect detection model to determine a sub-defect detection result corresponding one-to-one to each sub-image to be detected in at least part of the sub-image to be detected, the sub-defect detection result including position information and / or area of the sub-defect area in the corresponding sub-image to be detected; wherein the second defect detection result includes the sub-defect detection result corresponding one-to-one to at least part of the sub-image to be detected.
[0075] In one possible implementation, the target image may include at least one region, each corresponding to a target image location. For example, the target image may be divided into multiple image regions based on a preset division rule, each corresponding to a target image location. In this embodiment, each image region may be treated as a sub-image to be detected, and then at least some of the multiple sub-images to be detected may be input into a trained defect detection model to obtain sub-defect detection results that correspond one-to-one with at least some of the sub-images to be detected. In a specific embodiment, the multiple image regions have the same size. For example, the region containing each pixel in the target image may be treated as an image region.
[0076] In one possible implementation, at least part of the sub-images to be detected may be all of the sub-images to be detected in the target image. In another possible implementation, at least part of the sub-images to be detected may be specific parts of the sub-images to be detected in the target image. For example, they may be sub-images to be detected that contain defective areas determined based on the first defect detection result. As another example, they may be sub-images to be detected that do not contain defective areas determined based on the first defect detection result. In a specific embodiment, when the threshold corresponding to the preset defect detection algorithm is low, at least part of the sub-images to be detected may be sub-images to be detected that contain defective areas determined based on the first defect detection result. This helps to avoid over-detection.
[0077] The above technical solution extracts sub-images to be detected from a target image and uses a trained defect detection model to perform defect detection on at least a portion of the extracted sub-images to be detected. This method can obtain sub-defect detection results that correspond one-to-one with at least a portion of the sub-images to be detected. In short, this solution helps to more accurately determine defect detection results for target images.
[0078] In one possible implementation, using a trained defect detection model to perform defect detection on at least part of at least one sub-image to be detected can specifically include the following steps: using the trained defect detection model to perform defect detection on at least one sub-image to be detected that has an intersection with the defect area indicated in the first defect detection result.
[0079] In this example, at least some of the sub-images to be detected in the target image intersect with the defective area indicated in the first defect detection result. In other words, at least some of the sub-images to be detected are sub-images containing defects. In this example, only the sub-images to be detected that contain defects, as determined by the first defect detection result, need to be input into the trained defect detection model for defect detection. This helps reduce computational complexity and improves defect detection efficiency.
[0080] In one possible implementation, using a trained defect detection model to perform defect detection on at least part of at least one sub-image to be detected can specifically include the following steps: using the trained defect detection model to perform defect detection on at least one sub-image to be detected in which the degree of pixel value fluctuation in the sub-image to be detected is greater than a preset fluctuation degree.
[0081] In one possible implementation, the degree of pixel value fluctuation can be the difference between the maximum and minimum pixel values in the sub-image to be detected. In another possible implementation, the average of the pixel values in the sub-image to be detected can be first calculated, and then the differences between the pixel values in the sub-image to be detected and the pixel average can be calculated. The degree of pixel value fluctuation can be represented by the average of the differences corresponding to the pixel values.
[0082] In a possible implementation, the preset fluctuation degree can be set as needed.
[0083] It can be understood that for a sub-image to be detected, the higher the degree of pixel value fluctuation within that sub-image, the higher the noise level in that sub-image, and the lower the image quality of that sub-image. Consequently, the accuracy of the first defect detection result obtained based on that sub-image may be lower. In this example, at least some of the sub-images to be detected have high image noise. In other words, this solution only requires inputting sub-images with high image noise into the trained defect detection model for defect detection, thereby helping to reduce computational complexity and improve defect detection efficiency.
[0084] In one possible implementation, step S150, at least using a trained defect detection model to perform defect detection on the target image to determine a second defect detection result, may also include the following steps: for each sub-image to be detected in the remaining sub-images to be detected, using the first defect detection result corresponding to the sub-image to be detected as the sub-defect detection result corresponding to the sub-image to be detected; or, using the trained defect detection model to perform defect detection on the remaining sub-images to be detected to determine the sub-defect detection results that correspond one-to-one to the remaining sub-images to be detected; wherein the remaining sub-images to be detected are other sub-images to be detected in at least one sub-image to be detected except at least part of the sub-images to be detected, and the second defect detection result also includes the sub-defect detection results that correspond one-to-one to the remaining sub-images to be detected.
[0085] In one possible implementation, step S150, which involves performing defect detection on the target image using at least the trained defect detection model to determine a second defect detection result, may also include the following steps: for each of the remaining sub-images to be detected, using the first defect detection result corresponding to the sub-image as the sub-defect detection result corresponding to the sub-image to be detected. In this embodiment, the sub-defect detection results corresponding to the remaining sub-images to be detected can be determined directly based on the first defect detection result. In other words, defect detection can be performed solely on the remaining sub-images to be detected based on the preset defect detection algorithm. This avoids repeated calculations and improves defect detection efficiency.
[0086] In one possible implementation, step S150 includes at least performing defect detection on the target image using the trained defect detection model to determine a second defect detection result. The step may also include performing defect detection on the remaining sub-images to be detected using the trained defect detection model to determine sub-defect detection results corresponding to each of the remaining sub-images to be detected. In this embodiment, determining the sub-defect detection results corresponding to each of the remaining sub-images to be detected using the trained defect detection model helps improve defect detection accuracy.
[0087] In the above technical solution, the first defect detection result can be directly used to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected, or the trained defect detection model can be used to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected. Directly using the first defect detection result to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected helps avoid repeated calculations and improve defect detection efficiency. Using a trained defect detection model to determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected helps to more accurately determine the sub-defect detection results corresponding to each of the remaining sub-images to be detected.
[0088] In one possible implementation, step S140, training the defect detection model using a defect-free image, may include the following steps: extracting a sample sub-image corresponding one-to-one to at least one target image position on the defect-free image; for each target image position of the at least one target image position, training the defect detection model using the sample sub-image corresponding to the target image position to obtain a trained defect detection model corresponding to the target image position.
[0089] In one possible implementation, a defect-free image can include at least one region, each corresponding to a target image location. For example, a wafer image includes multiple die units. If a region is determined to be defect-free, such as the upper left corner of the wafer image, each die unit within that region can be considered a defect-free image.
[0090] In one possible implementation, each defect-free image can be divided into multiple image regions, each corresponding to a target image location. In this case, each image region can be determined as a sample sub-image. The sample sub-image at the target image location is then used to train the defect detection model to obtain a trained defect detection model corresponding to the target image location.
[0091] Figure 3 shows a schematic diagram of an image detection method according to another specific embodiment of the present application. As shown in Figure 3, first, a preset defect detection algorithm is used to perform defect detection on the image to be detected, so as to obtain a defect-free image in the image to be detected based on the first defect detection result obtained (in this embodiment, the image to be detected is a wafer image, and the defect-free image is the image area corresponding to the die unit on the wafer image). Then, a plurality of sample sub-images of the same size as at least one target image can be extracted on the defect-free image in a sliding window manner with a preset step size. Then, for each target image position, the defect detection model can be trained using the sample sub-image of the same target image position to obtain a trained defect detection model corresponding to the target image position. Thus, the defect detection model training is completed.
[0092] As shown in Figure 3, after the defect detection model is trained, the trained defect detection model can be used to perform defect detection on the target image. In this embodiment, the target image can first be divided into sub-images to be detected corresponding to at least one target image position using a sliding window method with a preset step size. Then, defect detection is performed on the sub-image to be detected corresponding to each target image position using the trained defect detection model corresponding to each of the at least one target image positions, thereby obtaining a second defect detection result and further determining the defect area in the target image.
[0093] In the above technical solution, the defect detection model is trained using sample sub-images at the same target image position, thereby obtaining a trained defect detection model corresponding to each target image position. This solution helps to obtain a defect detection model with high detection accuracy.
[0094] In one possible implementation, an image to be inspected includes multiple areas to be inspected, each of which corresponds one-to-one to multiple target image positions. Defect detection is performed on the target image using at least a trained defect detection model to determine a second defect detection result, including: extracting sub-images to be inspected corresponding one-to-one to the multiple target image positions on the image to be inspected; for each of the multiple sub-images to be inspected, performing defect detection on the sub-image to be inspected using a trained defect detection model corresponding to the target image position where the sub-image to be inspected is located, to obtain a second sub-defect detection result corresponding to the sub-image to be inspected; wherein, for any two identical sub-images to be inspected among the multiple sub-images to be inspected, the same trained defect detection model is used for defect detection.
[0095] It will be appreciated that in this exemplary embodiment, the image to be inspected may include multiple target image locations, each corresponding to a region to be inspected on the image to be inspected. The multiple regions to be inspected may include the same region to be inspected, and the same trained defect detection model may be used to perform defect detection on the same region to be inspected.
[0096] In a possible implementation, a method such as normalized cross correlation (NCC) matching may be used to determine the same to-be-detected region in the to-be-detected image.
[0097] Figure 4 shows a schematic diagram of an image to be inspected according to one embodiment of the present application. As shown in Figure 4 , the image to be inspected includes multiple identical areas to be inspected (i.e., the circular holes in the figure). Therefore, the area containing each circular hole can be extracted as a sub-image to be inspected, and then defect detection can be performed on each sub-image using the same trained defect detection model.
[0098] In this example, the same defect detection model can be used for the same sub-image to be detected, thereby eliminating the need for repeated model training, which helps to further improve image detection efficiency.
[0099] In a possible implementation, the preset defect detection algorithm performs defect detection based on the difference between at least one image region in the image to be detected and a standard image.
[0100] In one possible implementation, the difference may be a difference in pixel values between at least one image region in the image to be detected and the standard image, or a difference in feature vectors between at least one image region in the image to be detected and the standard image. For example, feature vectors may be extracted from the image to be detected and the standard template image to obtain feature vectors of the image to be detected and feature vectors of the standard template image. Similarity may then be calculated between the two feature vectors to determine the difference in feature vectors between at least one image region in the image to be detected and the standard image.
[0101] The above technical solution helps to obtain the first defect detection result of the image to be detected more accurately and quickly by directly performing defect detection based on the difference between at least one image area in the image to be detected and the standard image.
[0102] In one possible implementation, the pixels of each image area in at least one image area correspond one-to-one to the pixels of the standard image, and the preset defect detection algorithm includes the following operations: for each image area in at least one image area, calculating the pixel value difference between the pixel value of each pixel in the image area and the pixel value of the corresponding pixel in the standard image, and the pixel difference between the image area and the standard image is represented by the pixel value difference; and determining the area where the pixels in the image area whose corresponding pixel value difference is greater than the preset difference threshold are located as the defect area in the image to be detected.
[0103] In one possible implementation, the preset difference threshold can be set as needed. It is understandable that when the preset difference threshold is higher, missed detection may occur. When the preset difference threshold is lower, over-detection may occur. Therefore, the user can set the preset difference threshold according to actual needs. In a specific embodiment, the preset difference threshold can be set to a lower value. It is understandable that in the subsequent step S150, defect detection can be performed only on the defective image obtained from the image to be detected based on the first defect detection result. In other words, even if over-detection occurs due to the low preset difference threshold, a secondary judgment can be made in the subsequent steps through the trained defect detection model to eliminate the over-detection and improve the detection accuracy.
[0104] The above technical solution performs defect detection directly based on the pixel value difference between the pixel value of each pixel in the image area and the pixel value of the corresponding pixel in the standard image. The calculation is simple, helps to improve calculation efficiency, and has relatively good accuracy.
[0105] In one possible implementation, the image to be inspected and the standard image are product images of the product to be inspected, and each image area in at least one image area and the standard image each contain a single product to be inspected. The preset defect detection algorithm also includes the following operations: obtaining multiple sample images containing a single product to be inspected, and the width and height of different sample images are consistent; calculating the median pixel value or the mean pixel value of the pixels located at the same image coordinates in the multiple sample images obtained; and determining the image whose pixel value is equal to the median pixel value or the mean pixel value as the standard image.
[0106] In this embodiment, multiple sample images of the same size, each containing a single product to be inspected, can be first acquired. Then, the median or mean pixel value of the pixels at the same image coordinate in the acquired sample images can be calculated. This median or mean pixel value can be referred to as the standard pixel value at the corresponding image coordinate. Finally, a standard image can be generated based on the standard pixel value corresponding to each image coordinate.
[0107] In the above technical solution, an image whose pixel value is equal to the median pixel value or the mean pixel value is determined as a standard image. Thus, the first defect detection result of the image to be detected can be determined more accurately based on the standard image.
[0108] In one possible implementation, the image to be inspected contains multiple identical areas to be inspected. Step S130, obtaining a defect-free image from the image to be inspected based on the first defect detection result, may include the following steps: extracting multiple target product images from the image to be inspected, each target product image containing a single area to be inspected; and determining the target product image that does not contain the defect area indicated by the first defect detection result among the multiple target product images as a defect-free image.
[0109] In the scheme of this example, the image to be inspected contains multiple identical areas to be inspected. Each area where the product to be inspected is located corresponds to a target product image. Taking a wafer image as an example, the wafer image includes multiple identical die units, and the image area where each die unit is located is an area to be inspected. This scheme can more accurately obtain defect-free images by using the first defect detection result to determine whether there is a defect in each target product image (that is, whether the target product image is a defective image), which is beneficial for providing more accurate samples for the training of the defect detection model in the subsequent steps, and helps to improve the detection accuracy of the defect detection model.
[0110] In one possible implementation, when the target image is a defective image and the step of obtaining a non-defective image from the image to be inspected based on the first defect detection result is performed, method 100 may further include the following step: determining, among the multiple target product images, a target product image containing a defective area indicated by the first defect detection result as a defective image. In this example, whether the target product image is a defective image can be determined directly based on the first defect detection result. In subsequent steps (e.g., step S150), a trained defect detection model can be used to perform a secondary judgment on the defective image, thereby further improving the accuracy of the image detection method.
[0111] In one possible implementation, there are multiple images to be inspected, and different images to be inspected respectively contain the same product to be inspected. Obtaining a defect-free image from the images to be inspected based on the first defect detection result can include the following steps: determining the image to be inspected that does not contain the defect area indicated by the first defect detection result among the multiple images to be inspected as a defect-free image.
[0112] In this example, there are multiple images to be inspected. After executing step S120 for each of the multiple images to be inspected, a first defect detection result corresponding to each image to be inspected can be obtained. Then, based on the first defect detection result corresponding to each image to be inspected, images to be inspected that do not have defects can be designated as defect-free images.
[0113] The above technical solution can more accurately obtain defect-free images from multiple images to be detected, thereby providing more accurate samples for the training of the defect detection model in subsequent steps, and helping to improve the detection accuracy of the defect detection model.
[0114] In one possible implementation, the target image is a defective image. When executing the step of obtaining a defect-free image from the image to be inspected based on the first defect detection result, method 100 may further include the following steps: determining the image to be inspected that contains the defect area indicated by the first defect detection result among the multiple images to be inspected as a defective image.
[0115] In the solution of this example, defective images among multiple images to be detected can be directly determined. In subsequent steps (such as step S150), the trained defect detection model can be used to perform a secondary judgment on the defective images, thereby further improving the accuracy of the image detection method.
[0116] According to another aspect of the present application, an image detection device is provided. FIG5 shows a schematic block diagram of an image detection device according to one embodiment of the present application. As shown in FIG5 , image detection device 500 may include a first acquisition module 510, a first detection module 520, a second acquisition module 530, a training module 540, and a second detection module 550.
[0117] The first acquisition module 510 is used to acquire an image to be detected.
[0118] The first detection module 520 is configured to perform defect detection on the image to be detected using a preset defect detection algorithm to determine a first defect detection result, wherein the first defect detection result includes position information of a defective area in the image to be detected.
[0119] The second acquisition module 530 is configured to acquire a defect-free image from the image to be inspected based on the first defect detection result.
[0120] The training module 540 is configured to train the defect detection model using defect-free images to obtain a trained defect detection model.
[0121] The second detection module 550 is used to perform defect detection on the target image using at least a trained defect detection model to determine a second defect detection result, wherein the second defect detection result includes location information of the defect area in the target image, and the target image is the image to be detected or a defective image obtained from the image to be detected based on the first defect detection result.
[0122] According to another aspect of the present application, an electronic device is provided. FIG6 shows a schematic block diagram of an electronic device according to one embodiment of the present application. As shown in FIG6 , a control device 600 includes a processor 610 and a memory 620. Memory 620 stores a computer program. Processor 610 is configured to execute the computer program to implement image detection method 100.
[0123] In one possible implementation, the processor may include any suitable processing device having data processing capabilities and / or instruction execution capabilities. For example, the processor may be implemented using one or a combination of a programmable logic controller (PLC), a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic array (PLA), a central processing unit (CPU), an application specific integrated circuit (ASIC), a microcontroller unit (MCU), and other types of processing units.
[0124] According to another aspect of the embodiments of the present application, a storage medium is further provided. The storage medium stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the image detection method 100 described above is implemented. The storage medium may include, for example, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. The computer-readable storage medium may be any combination of one or more computer-readable storage media.
[0125] A person skilled in the art can understand the specific implementation schemes of the above-mentioned image detection device, electronic device, and storage medium by reading the above description of the image detection method 100. For the sake of brevity, they will not be described here in detail.
[0126] Embodiment 1: An image detection method, comprising:
[0127] Obtain the image to be detected;
[0128] Performing defect detection on the image to be detected using a preset defect detection algorithm to determine a first defect detection result, wherein the first defect detection result includes position information of a defect area in the image to be detected;
[0129] acquiring a defect-free image from the image to be inspected based on the first defect detection result;
[0130] Training a defect detection model using the defect-free image to obtain a trained defect detection model;
[0131] Defect detection is performed on a target image using at least the trained defect detection model to determine a second defect detection result, wherein the second defect detection result includes location information of a defective area in the target image, and the target image is the image to be detected or a defective image obtained from the image to be detected based on the first defect detection result.
[0132] Embodiment 2: According to the image detection method described in Embodiment 1, performing defect detection on the target image using at least a trained defect detection model to determine a second defect detection result includes:
[0133] Extracting a sub-image to be detected corresponding to at least one target image position on the target image;
[0134] performing defect detection on at least a portion of the extracted at least one sub-image to be detected using the trained defect detection model to determine a sub-defect detection result corresponding one-to-one to each sub-image to be detected in the at least portion of the sub-images to be detected, the sub-defect detection result including position information of a sub-defect region in the corresponding sub-image to be detected and / or an area of the sub-defect region;
[0135] The second defect detection result includes sub-defect detection results corresponding one-to-one to at least part of the sub-image to be detected.
[0136] Embodiment 3: According to the image detection method described in any one of Embodiments 1-2, performing defect detection on at least part of the at least one sub-image to be detected using the trained defect detection model includes:
[0137] Defect detection is performed on a sub-image to be detected that intersects with a defect area indicated in the first defect detection result in the at least one sub-image to be detected by using the trained defect detection model.
[0138] Embodiment 4: According to the image detection method described in any one of Embodiments 1-3, performing defect detection on at least part of the at least one sub-image to be detected using the trained defect detection model includes:
[0139] The trained defect detection model is used to perform defect detection on the sub-image to be detected in which the fluctuation degree of pixel values in the at least one sub-image to be detected is greater than a preset fluctuation degree.
[0140] Embodiment 5: The image detection method according to any one of Embodiments 1-4, wherein the method further comprises: performing defect detection on the target image using at least a trained defect detection model to determine a second defect detection result;
[0141] For each of the remaining sub-images to be detected, the first defect detection result corresponding to the sub-image to be detected is used as the sub-defect detection result corresponding to the sub-image to be detected;
[0142] or,
[0143] Using the trained defect detection model, defect detection is performed on the remaining sub-images to be detected to determine sub-defect detection results corresponding one-to-one to the remaining sub-images to be detected;
[0144] Among them, the remaining sub-images to be detected are other sub-images to be detected in the at least one sub-image to be detected except for the at least part of the sub-image to be detected, and the second defect detection result also includes sub-defect detection results corresponding one-to-one to the remaining sub-images to be detected.
[0145] Example 6: According to the image detection method introduced in any one of Examples 1-5, the preset defect detection algorithm performs defect detection based on the difference between at least one image area in the image to be detected and a standard image.
[0146] Embodiment 7: According to the image detection method described in any one of Embodiments 1-6, the pixels of each image area in the at least one image area correspond one-to-one with the pixels of the standard image, and the preset defect detection algorithm includes the following operations:
[0147] For each image region of the at least one image region,
[0148] Calculating a pixel value difference between a pixel value of each pixel in the image region and a pixel value of a corresponding pixel in the standard image, wherein the pixel difference between the image region and the standard image is represented by the pixel value difference;
[0149] The area where pixels corresponding to the pixel value difference in the image area is greater than a preset difference threshold value are located is determined as the defect area in the image to be detected.
[0150] Embodiment 8: According to the image detection method described in any one of Embodiments 1-7, the image to be detected and the standard image are product images of the product to be detected, each image area in the at least one image area and the standard image each contain a single product to be detected, and the preset defect detection algorithm further includes the following operations:
[0151] Acquire multiple sample images containing a single product to be inspected, where the width and height of different sample images are consistent;
[0152] Calculating a median pixel value or a mean pixel value of pixels located at the same image coordinate in the obtained multiple sample images;
[0153] An image whose pixel value is equal to the median value of the pixel value or the mean value of the pixel value is determined as the standard image.
[0154] Embodiment 9: According to the image detection method described in any one of Embodiments 1-8, the image to be detected includes multiple identical areas to be detected, and obtaining a defect-free image from the image to be detected based on the first defect detection result includes:
[0155] Extracting a plurality of target product images from the image to be detected, each target product image containing a single area to be detected;
[0156] The target product image that does not include the defect area indicated by the first defect detection result among the multiple target product images is determined as the defect-free image.
[0157] Embodiment 10: According to the image detection method described in any one of Embodiments 1-9, the target image is the defective image. When executing the step of acquiring a defect-free image from the image to be detected based on the first defect detection result, the method further includes:
[0158] The target product image containing the defect area indicated by the first defect detection result among the multiple target product images is determined as the defective image.
[0159] Embodiment 11: According to the image detection method described in any one of Embodiments 1-10, there are multiple images to be detected, and different images to be detected respectively contain the same product to be detected. The step of obtaining a defect-free image from the images to be detected based on the first defect detection result includes:
[0160] An image to be inspected that does not contain the defect area indicated by the first defect detection result among the multiple images to be inspected is determined as the defect-free image.
[0161] Embodiment 12: According to the image detection method described in any one of Embodiments 1-11, the target image is the defective image. When executing the step of acquiring a defect-free image from the image to be detected based on the first defect detection result, the method further includes:
[0162] An image to be inspected that contains a defective area indicated by the first defect detection result among the multiple images to be inspected is determined as the defective image.
[0163] Embodiment 13: According to the image detection method described in any one of Embodiments 1-12, the step of training a defect detection model using the defect-free image includes:
[0164] Extracting a sample sub-image corresponding to at least one target image position on the defect-free image;
[0165] For each target image position in the at least one target image position,
[0166] The defect detection model is trained using the sample sub-image corresponding to the target image position to obtain a trained defect detection model corresponding to the target image position.
[0167] Embodiment 14: An image detection device, comprising:
[0168] A first acquisition module is used to acquire an image to be detected;
[0169] a first detection module, configured to perform defect detection on the image to be detected using a preset defect detection algorithm to determine a first defect detection result, wherein the first defect detection result includes position information of a defect area in the image to be detected;
[0170] A second acquisition module, configured to acquire a defect-free image from the image to be inspected based on the first defect detection result;
[0171] A training module, configured to train a defect detection model using the defect-free image to obtain a trained defect detection model;
[0172] A second detection module is used to perform defect detection on a target image using at least the trained defect detection model to determine a second defect detection result, wherein the second defect detection result includes location information of a defective area in the target image, and the target image is the image to be detected or a defective image obtained from the image to be detected based on the first defect detection result.
[0173] Example 15: An electronic device comprises a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions are used by the processor to execute the image detection method described in any one of Examples 1-13 when the processor is running.
[0174] Embodiment 16: A storage medium having program instructions stored thereon, wherein the program instructions are used to execute the image detection method described in any one of embodiments 1-13 when running.
[0175] Although example embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above example embodiments are merely illustrative and are not intended to limit the scope of the present application. Various changes and modifications may be made therein by those skilled in the art without departing from the scope and spirit of the present application. All such changes and modifications are intended to be included within the scope of the present application as required by the appended claims.
[0176] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0177] It should be noted that the above embodiments illustrate rather than limit the present application, and that a person skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbols placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0178] The above description is merely a specific embodiment or illustration of a specific embodiment of the present application, and the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. The scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An image detection method, characterized in that, Including: Obtain an image to be detected; Use a preset defect detection algorithm to perform defect detection on the image to be detected to determine a first defect detection result, where the first defect detection result includes position information of a defect area in the image to be detected; Obtain a defect-free image from the image to be detected based on the first defect detection result; Use the defect-free image to train a defect detection model to obtain the trained defect detection model; At least use the trained defect detection model to perform defect detection on a target image to determine a second defect detection result, where the second defect detection result includes position information of a defect area in the target image, and the target image is the image to be detected or a defective image obtained from the image to be detected based on the first defect detection result.
2. The image detection method according to claim 1, wherein The at least using the trained defect detection model to perform defect detection on the target image to determine a second defect detection result includes: Extract sub-images to be detected corresponding one by one to at least one target image position on the target image; Use the trained defect detection model to perform defect detection on at least some of the extracted sub-images to be detected to determine sub-defect detection results corresponding one by one to each of the at least some sub-images to be detected, where the sub-defect detection results include position information and / or area of a sub-defect area in the corresponding sub-image to be detected; Wherein, the second defect detection result includes sub-defect detection results corresponding one by one to the at least some sub-images to be detected.
3. The image detection method according to claim 2, wherein The using the trained defect detection model to perform defect detection on at least some of the at least one sub-image to be detected includes: Use the trained defect detection model to perform defect detection on the sub-images to be detected that have an intersection with the defect area indicated in the first defect detection result among the at least one sub-image to be detected.
4. The image detection method according to claim 2 or 3, wherein The using the trained defect detection model to perform defect detection on at least some of the at least one sub-image to be detected includes: Use the trained defect detection model to perform defect detection on the sub-images to be detected with a pixel value fluctuation degree greater than a preset fluctuation degree among the at least one sub-image to be detected.
5. The image detection method according to claim 2 or 3, characterized in that The at least using the trained defect detection model to perform defect detection on the target image to determine a second defect detection result further includes: For each of the remaining sub-images to be detected, use the first defect detection result corresponding to the sub-image to be detected as the sub-defect detection result corresponding to the sub-image to be detected; Or, Use the trained defect detection model to perform defect detection on the remaining sub-images to be detected to determine sub-defect detection results corresponding one by one to the remaining sub-images to be detected; Wherein, the remaining sub-images to be detected are other sub-images to be detected except the at least some sub-images to be detected among the at least one sub-image to be detected, and the second defect detection result further includes sub-defect detection results corresponding one by one to the remaining sub-images to be detected.
6. The image detection method according to any one of claims 1 to 3, characterized in that, The preset defect detection algorithm performs defect detection based on the differences between at least one image region in the image to be detected and a standard image respectively.
7. The image detection method according to claim 6, wherein Pixels of each image region in the at least one image region correspond one by one to the pixels of the standard image. The preset defect detection algorithm includes the following operations: For each image region in the at least one image region, calculate the pixel value difference between the pixel value of each pixel in this image region and the pixel value of the corresponding pixel in the standard image. The pixel difference between this image region and the standard image is represented by the pixel value difference; Determine the region where the pixels with pixel value differences greater than the preset difference threshold in this image region are located as the defect region in the image to be detected.
8. The image detection method according to claim 6, wherein The image to be detected and the standard image are product images of the product to be detected. Each image region in the at least one image region and the standard image each contain a single product to be detected. The preset defect detection algorithm further includes the following operations: Obtain a plurality of sample images each containing a single product to be detected, and the widths and heights of different sample images are the same; Calculate the median or mean of the pixel values of the pixels at the same image coordinates in the obtained plurality of sample images; Determine the image with pixel values equal to the median or mean of the pixel values as the standard image.
9. The image detection method according to any one of claims 1-3, characterized in that, The image to be detected contains a plurality of identical regions to be detected. Obtaining a defect-free image from the image to be detected based on the first defect detection result includes: Extract a plurality of target product images from the image to be detected, and each target product image contains a single region to be detected; Determine the target product images that do not contain the defect regions indicated by the first defect detection result among the plurality of target product images as the defect-free images.
10. The image detection method according to claim 9, wherein When the target image is the defective image and performing the step of obtaining a defect-free image from the image to be detected based on the first defect detection result, the method further includes: Determine the target product images that contain the defect regions indicated by the first defect detection result among the plurality of target product images as the defective images.
11. The image detection method according to any one of claims 1-3, characterized in that, The number of images to be detected is multiple, and different images to be detected respectively contain the same product to be detected. Obtaining a defect-free image from the image to be detected based on the first defect detection result includes: Determine the images to be detected that do not contain the defect regions indicated by the first defect detection result among the multiple images to be detected as the defect-free images.
12. The image detection method according to claim 11, wherein When the target image is the defective image and performing the step of obtaining a defect-free image from the image to be detected based on the first defect detection result, the method further includes: Determine the images to be detected that contain the defect regions indicated by the first defect detection result among the multiple images to be detected as the defective images.
13. The image detection method according to any one of claims 1-3, characterized in that, Training the defect detection model using the defect-free image includes: Extract sample sub-images corresponding one by one to at least one target image position on the defect-free image; For each target image position in the at least one target image position, Training the defect detection model using the sample sub-image corresponding to the target image position to obtain the trained defect detection model corresponding to the target image position.
14. An image detection device, characterized in that, Including: A first acquisition module for acquiring the image to be detected; A first detection module for performing defect detection on the image to be detected using a preset defect detection algorithm to determine a first defect detection result, where the first defect detection result includes the position information of the defect area in the image to be detected; A second acquisition module for acquiring a defect-free image from the image to be detected based on the first defect detection result; A training module for training the defect detection model using the defect-free image to obtain the trained defect detection model; A second detection module for performing defect detection on the target image using at least the trained defect detection model to determine a second defect detection result, where the second defect detection result includes the position information of the defect area in the target image, and the target image is the image to be detected or a defective image acquired from the image to be detected based on the first defect detection result.
15. An electronic device, comprising a processor and a memory, wherein, Computer program instructions are stored in the memory, and when the computer program instructions are run by the processor, they are used to execute the image detection method according to any one of claims 1-13.
16. A storage medium, on which program instructions are stored, and when the program instructions are run, they are used to execute the image detection method according to any one of claims 1-13.
Citation Information
Patent Citations
Express outer package defect detection method and device based on deep learning
CN111862092A
Defect detection method, related device, equipment and storage medium
CN112001902A
Image defect detection method and device, electronic equipment and storage medium
CN113240642A
Defect detection method and system, electronic equipment and storage medium
CN115170501A
Defect detection method and system, electronic equipment and storage medium
CN115239719A
Cited By
Defect detection method and device, equipment, storage medium and program product
CN120823218A
Defect detection method, device, equipment, storage medium and program product
CN120823218B