Defect detection method, apparatus and electronic device

By combining AI algorithms with traditional 2D algorithms, automatic inspection of glove production quality has been achieved, solving the problems of time-consuming, labor-intensive, and missed detections caused by manual visual inspection, and improving inspection efficiency and accuracy.

CN117115096BActive Publication Date: 2026-04-24HANGZHOU HIKROBOT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU HIKROBOT TECH CO LTD
Filing Date
2023-08-09
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In existing technologies, the quality inspection of glove production relies on manual visual inspection, which is time-consuming, labor-intensive, and prone to missed inspections.

Method used

AI algorithms are used to perform preliminary defect localization and classification on glove images. Combined with traditional 2D algorithms, abnormal pixels and target defect categories are determined by converting color saturation to a specified color space.

Benefits of technology

It enables automated detection of glove production quality, improves detection efficiency, avoids missed detections, and enhances detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117115096B_ABST
    Figure CN117115096B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a defect detection method, device and electronic equipment. In the embodiment, an AI algorithm is used for preliminary positioning of defects in a glove image, initial classification is performed on a suspected defect area, a suspected defect category is obtained, fine classification is performed on the suspected defect area, a target defect category is obtained, automatic detection of the production quality of the glove is realized through machine vision, manual naked-eye detection is replaced, detection efficiency is improved, and the situation of missed detection is avoided. Further, the AI algorithm and the traditional 2D algorithm (i.e., the fine classification process described above) are combined to realize defect detection of the glove, the advantages of the AI algorithm and the traditional 2D algorithm are fully utilized, and the defect detection efficiency and accuracy of the glove are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine vision technology, and in particular to a defect detection method, apparatus and electronic device. Background Technology

[0002] In product manufacturing applications, taking glove production as an example, after the gloves are formed, they are processed in various processes on a hand mold along the assembly line, and finally the finished product is removed.

[0003] Currently, in order to ensure the production quality of gloves, defects (such as oil stains, impurities, white spots, and leftover materials) are often checked manually by the naked eye. This manual inspection method is time-consuming and labor-intensive, and it is also common to miss some defects. Summary of the Invention

[0004] In view of this, embodiments of this application provide a defect detection method, apparatus, and electronic device to achieve automatic detection of glove production quality through machine vision, replacing manual visual inspection, improving detection efficiency, and avoiding missed detections.

[0005] According to a first aspect of the application embodiments, a defect detection method is provided, the method being applied to an electronic device, the method comprising:

[0006] AI algorithms are used to perform preliminary defect localization on the obtained glove images, resulting in at least one suspected defect area.

[0007] Based on the color value of each suspected defect area and the background color value of the glove image, the suspected defect category of each suspected defect area is determined;

[0008] The suspected defect areas that meet the set category requirements are converted to a specified color space with color saturation to obtain the reference defect areas corresponding to the suspected defect areas.

[0009] For each reference defect region, based on the suspected defect category of the corresponding suspected defect region, abnormal pixels are identified from the reference defect region; the feature information of the abnormal pixels includes at least the color saturation of the abnormal pixels.

[0010] For each suspected defect region whose suspected defect category meets the set category requirements, the target defect category of the suspected defect region is determined based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region.

[0011] According to a second aspect of the application, a defect detection apparatus is provided, the apparatus being applied to an electronic device, the apparatus comprising:

[0012] The preliminary positioning module is used to perform preliminary defect positioning on the obtained glove image using AI algorithms to obtain at least one suspected defect area.

[0013] The suspected defect category determination module is used to determine the suspected defect category of each suspected defect area based on the color value of each suspected defect area and the background color value of the glove image;

[0014] The conversion module is used to convert suspected defect areas that meet the set category requirements to a specified color space with color saturation, so as to obtain the reference defect area corresponding to the suspected defect area.

[0015] An abnormal pixel determination module is used to determine abnormal pixels from each reference defect region based on the suspected defect category of the suspected defect region corresponding to the reference defect region; the feature information of the abnormal pixel includes at least the color saturation of the abnormal pixel.

[0016] The target defect category determination module is used to determine the target defect category of each suspected defect region that meets the set category requirements, based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region.

[0017] According to a third aspect of the embodiments of the application, an electronic device is provided, the electronic device comprising: a processor and a memory;

[0018] The memory is used to store machine-executable instructions;

[0019] The processor is configured to read and execute machine-executable instructions stored in the memory to implement the method as described in the first aspect.

[0020] The technical solutions provided in this application embodiment may include the following beneficial effects:

[0021] As can be seen from the above technical solutions, in this embodiment of the application, the AI ​​algorithm is used to perform preliminary defect localization on the glove image, then the suspected defect area is initially classified to obtain the suspected defect category, and then the suspected defect area is further classified to obtain the target defect category. This realizes automatic detection of glove production quality through machine vision, replacing manual visual inspection, improving detection efficiency, and avoiding missed detection.

[0022] Furthermore, by combining AI algorithms with traditional 2D algorithms (i.e., the fine classification process mentioned above), defect detection of gloves can be achieved, giving full play to the advantages of AI algorithms and traditional 2D algorithms, and improving the efficiency and accuracy of glove defect detection. Attached Figure Description

[0023] Figure 1 This is a flowchart of a defect detection method provided in an embodiment of this application.

[0024] Figure 2 This is an example image of a glove provided in an embodiment of this application.

[0025] Figure 3 This is an example diagram of dimensional measurement provided in an embodiment of this application.

[0026] Figure 4 This is a flowchart illustrating the determination of the target category provided in the embodiments of this application.

[0027] Figure 5 This is a block diagram of a defect detection device shown in an embodiment of this application.

[0028] Figure 6 Block diagrams of electronic devices shown in embodiments of this application. Detailed Implementation

[0029] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0030] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0031] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0032] The method provided in the embodiments of this application is described below:

[0033] See Figure 1 , Figure 1This is a flowchart illustrating a method provided in an embodiment of this application. The method is applied to an electronic device; as an example, the electronic device may be a terminal, a server, etc., but this embodiment is not specifically limited to this.

[0034] like Figure 1 As shown, the process may include the following steps:

[0035] S110: Use artificial intelligence (AI) algorithms to perform preliminary defect localization on the obtained glove images to obtain at least one suspected defect area.

[0036] For example, in this embodiment, the gloves can be made of polyvinyl chloride (PVC), nitrile, etc., and this embodiment is not specifically limited.

[0037] In this embodiment, the glove image is a pre-captured red, green, and blue (RGB) image. Specifically, the glove image can be taken before or after the glove is demolded. Figure 2 The glove image shown was taken after the gloves were demolded, and the embodiments of this application are not specifically limited.

[0038] For example, in this embodiment, the AI ​​algorithm may include, but is not limited to, object detection, semantic segmentation, etc., and the embodiments of this application are not specifically limited.

[0039] It should be noted that the above-mentioned object detection, semantic segmentation and other methods are all conventional techniques, and will not be elaborated on here.

[0040] In this embodiment, the suspected defect area can be a real defect area or a mislocated non-defect area. The defect category of the suspected defect area will be identified below to obtain the suspected defect category of the suspected defect area.

[0041] S120: Determine the suspected defect category for each suspected defect area based on the color value of each suspected defect area and the background color value of the glove image.

[0042] For example, in this embodiment, there can be many types of suspected defect categories. As one embodiment, the suspected defect categories are: a first suspected category, a second suspected category, or a third suspected category. The first suspected category indicates that the color of the suspected defect area is darker than the background color of the glove image; the second suspected category indicates that the color of the suspected defect area is lighter than the background color of the glove image; and the third suspected category indicates that the color of the suspected defect area is the same as the background color of the glove image, belonging to a misidentified suspected defect area.

[0043] After obtaining the suspected defect categories for each suspected defect area, the suspected defect areas with the third suspected defect category can be filtered out, that is, the initial defect location errors can be filtered out and the defect location results can be corrected.

[0044] In another embodiment, the suspected defect category is either a first suspected category or a second suspected category. The first suspected category indicates that the color of the suspected defect area is darker than the background color of the glove image; the second suspected category indicates that the color of the suspected defect area is lighter than the background color of the glove image.

[0045] In this embodiment, there are many ways to determine the suspected defect category of each suspected defect area based on the color value of each suspected defect area and the background color value of the glove image in step S120. For example, there are methods such as Convolutional Neural Networks (CNN) classification algorithms, methods that combine color feature extraction and machine learning classification algorithms, etc. This embodiment of the application does not specifically limit the method.

[0046] When using a CNN classification algorithm to determine the suspected defect category of each suspected defect region, the suspected defect region is input into a pre-trained classification model so that the classification model can output the suspected defect category of the suspected defect region. Here, the classification model can be an AlexNet model, a computer vision model MobileNet, a residual network ResNet, etc., and the embodiments of this application are not specifically limited.

[0047] In this embodiment, the classification model is pre-trained. As an example, the training method is as follows:

[0048] (1) Building a network model

[0049] Specifically, in this application, the classification model is mainly used for feature extraction and classification, and its model structure can adopt any one of AlexNet, MobileNet and ResNet mentioned above.

[0050] (2) Obtain training samples

[0051] Based on the above classification model, image samples containing various defects can be obtained, and then the obtained defect image samples can be labeled and category labels can be added.

[0052] Of course, in order to increase the amount and diversity of training samples, data augmentation can also be performed on the obtained defective image samples. Here, data augmentation can include random scaling, random cropping, random color transformation, etc. This application embodiment does not specifically limit the data augmentation method, and it can be determined according to the actual situation.

[0053] (3) Use the obtained training samples to train the above network model to obtain the trained classification model.

[0054] Specifically, the network parameters in the network model can be set to specified values ​​first, and then the network model can be trained using the obtained training samples to obtain a trained classification model.

[0055] Specifically, the process can include two stages: forward propagation and backward propagation. Forward propagation involves taking a training sample as input, performing forward propagation on the training sample to extract data features, and calculating the loss function. Backward propagation involves using the loss function to propagate backward from the last layer of the network model, while simultaneously using gradient descent to modify the network parameters of the network model so that the loss function converges, resulting in a trained classification model.

[0056] When using a combination of color feature extraction and machine learning classification algorithms to determine the suspected defect category of each suspected defect region, a color histogram of the suspected defect region is determined for each suspected defect region; the color histogram is then processed using a specified classification algorithm to obtain the suspected defect category in the suspected defect region. Here, the specified classification algorithm can be a Support Vector Machine (SVM) algorithm or other classification algorithms, and this application embodiment is not specifically limited.

[0057] S130: Convert the suspected defect area that meets the set category requirements to the specified color space with color saturation to obtain the reference defect area corresponding to the suspected defect area.

[0058] For example, in this embodiment, a suspected defect area whose suspected defect category meets the set category requirements refers to a suspected defect area whose suspected defect category is not the third suspected category. By converting the suspected defect area whose suspected defect category meets the set category requirements to a specified color space with color saturation, the reference defect area corresponding to the suspected defect area can be obtained.

[0059] For example, in this embodiment, since the suspected defect area may have multiple colors, it is necessary to convert the suspected defect area to a specified color space with color saturation. Here, the specified color space may be, for example, Hue, Saturation, Value (HSV) space, Hue, Saturation, Intensity (HSI) space, etc. This application embodiment does not specifically limit the specified color space.

[0060] This application describes embodiments using the HSV color space as an example only:

[0061] For suspected defect regions whose suspected defect categories meet the set category requirements, each pixel of the suspected defect region (RGB image) is converted to HSV space to obtain the reference defect region. Specifically, it can be:

[0062]

[0063]

[0064]

[0065] Where h represents hue; s represents color saturation; v represents brightness; max represents the maximum value of the three-channel RGB, and min represents the minimum value of the three-channel RGB.

[0066] S140: For each reference defect region, based on the suspected defect category of the suspected defect region corresponding to the reference defect region, determine the abnormal pixel points from the reference defect region.

[0067] For example, in this embodiment, the feature information of abnormal pixels includes at least the color saturation of the abnormal pixels, but this embodiment is not specifically limited.

[0068] In this embodiment, in step S140, determining abnormal pixels from the reference defect region based on the suspected defect category of the suspected defect region corresponding to the reference defect region can specifically be as follows:

[0069] Step a: Obtain reference pixels in the reference defect region whose color saturation is a pre-specified color saturation value;

[0070] Step b: Select abnormal pixels from each reference pixel. At least one of the neighboring pixels of the abnormal pixel has a color saturation value that is specified in the pre-defined color saturation value.

[0071] For example, in this embodiment, the pre-specified color saturation value can be any value, such as 255, and this embodiment of the application is not specifically limited.

[0072] As for how to obtain reference pixels in the reference defect area whose color saturation is the pre-specified color saturation value, the following examples illustrate this, and will not be elaborated here.

[0073] For example, in this embodiment, at least one of the neighboring pixels of the abnormal pixel has a color saturation value that is pre-specified. For example, such as Figure 3As shown in the figure, the white pixels are the obtained reference pixels. When selecting abnormal pixels from the reference pixels, the individual white pixels can be deleted first. Here, an individual white pixel refers to a pixel whose color saturation of all its neighboring pixels is not the pre-specified color saturation value. In this embodiment, an individual white pixel is regarded as an error pixel.

[0074] S150: For each suspected defect region whose suspected defect category meets the set category requirements, determine the target defect category of the suspected defect region based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the reference defect region corresponding to the suspected defect region.

[0075] For example, in this embodiment, the target defect category can be a first target category, a second target category, a third target category, a fourth target category, or a fifth target category; wherein, the first target category is used to indicate severe oil contamination; the second target category is used to indicate impurities; the third category is used to indicate minor oil contamination; the fourth target category is used to indicate leftover material; and the fifth target category is used to indicate white spots.

[0076] Here, the suspected defect categories corresponding to severe oil stains, minor oil stains, and impurities are classified as the first suspected defect category; the suspected defect categories corresponding to white spots and leftover material are classified as the second suspected defect category. Severe oil stains have a higher color saturation than minor oil stains, and / or, the area of ​​severe oil stains is larger than the area of ​​minor oil stains; minor oil stains have a higher color saturation than impurities, and / or, the area of ​​minor oil stains is larger than the area of ​​impurities; leftover material has a higher color saturation than white spots, and / or, the area of ​​leftover material is larger than the area of ​​white spots.

[0077] In this embodiment, there are many methods to determine the target defect category of the suspected defect region based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region. This embodiment of the application does not specifically limit these methods.

[0078] For example, when the suspected defect category of the suspected defect area is the first suspected category, two color saturation thresholds are set, denoted as color saturation threshold 1 and color saturation threshold 2. Color saturation threshold 1 is greater than color saturation threshold 2. When the feature information of each abnormal pixel in the reference defect area corresponding to the suspected defect area is less than or equal to color saturation threshold 2, the target defect category of the suspected defect area is determined to be noise. When the feature information of each abnormal pixel in the reference defect area corresponding to the suspected defect area is greater than color saturation threshold 2 and less than or equal to color saturation threshold 1, the target defect category of the suspected defect area is determined to be slight oil stain. When the feature information of each abnormal pixel in the reference defect area corresponding to the region is greater than the color saturation threshold 1, the target defect category of the suspected defect area is determined to be severe oil contamination. When the suspected defect category of the suspected defect area is the second suspected category, a color saturation threshold is set, denoted as color saturation threshold 3. When the feature information of each abnormal pixel in the reference defect area corresponding to the suspected defect area is less than or equal to color saturation threshold 3, the target defect category of the suspected defect area is determined to be white spot. When the feature information of each abnormal pixel in the reference defect area corresponding to the suspected defect area is greater than color saturation threshold 3, the target defect category of the suspected defect area is determined to be scrap material.

[0079] The following examples illustrate the target defect categories for suspected defect areas, which will not be elaborated upon here.

[0080] This concludes the process. Figure 1 The process is shown below.

[0081] pass Figure 1 As can be seen from the process, in this embodiment of the application, the AI ​​algorithm is used to initially locate defects in the glove image, then the suspected defect area is initially classified to obtain the suspected defect category, and then the suspected defect area is further classified to obtain the target defect category. This realizes the automatic detection of glove production quality through machine vision, replacing manual visual inspection, improving detection efficiency, and avoiding missed detections.

[0082] Furthermore, by combining AI algorithms with traditional 2D algorithms (i.e., the fine classification process mentioned above), defect detection of gloves can be achieved, giving full play to the advantages of AI algorithms and traditional 2D algorithms, and improving the efficiency and accuracy of glove defect detection.

[0083] As an optional implementation of this application, the above-mentioned reference pixel points for obtaining the color saturation of the pixels in the reference defect region to a pre-specified color saturation value include:

[0084] First, the color saturation of the pixels in the reference defect area is binarized to obtain the binarized result.

[0085] In this embodiment, the color saturation of any pixel in the binarization result is one of the pre-specified binary values. Here, the binary values ​​can be any two different values, such as 0 and 255. This embodiment of the application does not specifically limit the value.

[0086] The color saturation of the pixels in the reference defect region is binarized to obtain the following binarized result:

[0087] Calculate the mean_val and standard deviation_val of color saturation for each pixel in the reference defect image. For each pixel in the reference defect image, if the difference between the color saturation of the pixel and the mean color saturation and the standard deviation of color saturation meet the specified conditions, the color saturation of the pixel is determined to be the first value; otherwise, the color saturation of the pixel is determined to be the second value.

[0088] Specifically, for each pixel in the reference defect image, a point-by-point judgment is performed. If the suspected defect category of the suspected defect area corresponding to the reference defect image is the first suspected category, the specified condition can be that the mean_val and the color saturation of the pixel are greater than std_val. When the difference between the color saturation of the pixel and the average color saturation and the standard deviation of color saturation meet the specified condition, the color saturation of the pixel is determined to be the first value (e.g., 255). Otherwise, the color saturation of the pixel is determined to be the second value (e.g., 0).

[0089] If the suspected defect category of the suspected defect area corresponding to the reference defect image is the second suspected category, the specified condition can be: the color saturation of the pixel minus mean_val is greater than std_val. Then, if the difference between the color saturation of the pixel and the average color saturation and the standard deviation of color saturation meet the specified condition, the color saturation of the pixel is determined to be the first value (e.g., 255). Otherwise, the color saturation of the pixel is determined to be the second value (e.g., 0).

[0090] Secondly, reference pixels with a pre-specified color saturation value are obtained from the binarization result.

[0091] For example, in this embodiment, the pre-specified color saturation value is one of the pre-specified binary values. After obtaining the binarization result, a reference pixel with a color saturation value of the pre-specified color saturation value can be obtained from the binarization result.

[0092] Here, the color saturation values ​​of each pixel in the binarization result are used to identify abnormal pixels and are not used in subsequent calculations. The subsequent calculations all use the color saturation values ​​of each pixel in the reference defect area.

[0093] As an optional implementation of this application embodiment, step S150 above, determining the target defect category of the suspected defect region based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region, includes:

[0094] First, based on the abnormal pixels in the reference defect area corresponding to the suspected defect area, the abnormal area is determined.

[0095] For example, in this embodiment, the abnormal region includes each abnormal pixel in the reference defect region; specifically, the abnormal region can be represented by the region enclosed by each abnormal pixel, or by the smallest rectangle containing each abnormal pixel, and this embodiment is not specifically limited.

[0096] Secondly, based on the suspected defect category of the suspected defect area, the color saturation of each abnormal pixel in the corresponding reference defect area, and the size of the abnormal area, the target defect category of the suspected defect area is determined.

[0097] For example, in this embodiment, the size of the abnormal region can be the length * width of the smallest rectangle containing all abnormal pixels, for example, such as... Figure 3 As shown, the size of the abnormal region is 10*8.

[0098] In this embodiment, determining the target defect category of the suspected defect region based on the suspected defect category, the color saturation of each abnormal pixel in the corresponding reference defect region, and the size of the abnormal region can specifically be as follows:

[0099] If the suspected defect category of the suspected defect area is: first suspected category, the first suspected category is used to indicate that the color of the suspected defect area is darker than the background color of the glove image, then check whether the reference defect area corresponding to the suspected defect area meets the first set condition;

[0100] If the reference defect area corresponding to the suspected defect area meets the first set condition, then if the size of the abnormal area in the reference defect area is larger than the first set size, the target defect category of the suspected defect area is determined to be: the first target category, which is used to indicate severe oil contamination; otherwise, the target defect category of the suspected defect area is determined to be: the second target category, which is used to indicate impurities.

[0101] If the reference defect area corresponding to the suspected defect area does not meet the first set condition, then if the size of the abnormal area in the reference defect area is larger than the second set size, the target defect category of the suspected defect area is determined to be: the first target category; otherwise, the target defect category of the suspected defect area is determined to be: the third category. The third category is used to indicate minor oil stains.

[0102] For example, in this embodiment, when the color saturation of at least M% (e.g., 40%, 10%, etc.) of abnormal pixels in the reference defect region is less than a first preset color saturation, the reference defect region is determined to meet the first preset condition. Of course, the first preset condition can also be other conditions, and this embodiment of the application does not specifically limit it.

[0103] Here, the first set color saturation is the preset minimum color saturation for severe oil stains, which can be any value, and is not specifically limited in this application embodiment.

[0104] For example, in this embodiment, when the reference defect area corresponding to the suspected defect area is found to meet the first set condition, it is further determined that the size of the abnormal area in the reference defect area is greater than the first set size. Here, the first set size is the preset minimum size of severe oil stains, which can be any value, such as 10 pixels. This embodiment of the application does not specifically limit it.

[0105] If the size of the abnormal area in the reference defect area is larger than the first set size, then the target defect category of the suspected defect area is determined to be: the first target category; otherwise, the target defect category of the suspected defect area is determined to be: the second target category.

[0106] In this embodiment, when it is found that the reference defect area corresponding to the suspected defect area does not meet the first set condition, it is further determined that the size of the abnormal area in the reference defect area is greater than the second set size. Here, the second set size is the preset maximum size of slight oil stains, which can be any value, such as 8 pixels. This embodiment of the application does not specifically limit it.

[0107] If the size of the abnormal area in the reference defect area is larger than the second set size, then the target defect category of the suspected defect area is determined to be: the first target category; otherwise, the target defect category of the suspected defect area is determined to be: the third category.

[0108] If the suspected defect category of the suspected defect area is: second suspected category, the second suspected category is used to indicate that the color of the suspected defect area is lighter than the background color of the glove image, then check whether the reference defect area corresponding to the suspected defect area meets the second set condition.

[0109] If the reference defect area corresponding to the suspected defect area meets the second set condition, then if the size of the abnormal area in the reference defect area is greater than the third set size, the target defect category of the suspected defect area is determined to be: the fourth target category, which is used to indicate residual material; otherwise, the target defect category of the suspected defect area is determined to be: the fifth target category, which is used to indicate white spots.

[0110] If the reference defect area corresponding to the suspected defect area is found to not meet the first set condition, then the target defect category of the suspected defect area is determined to be: the fifth target category.

[0111] For example, in this embodiment, when the color saturation of at least N% (e.g., 40%, 10%, etc.) of the abnormal pixels in the reference defect region is greater than the second preset color saturation, the reference defect region is determined to meet the first preset condition. Of course, the second preset condition can also be other conditions, and this embodiment of the application does not specifically limit it.

[0112] It should be noted that N% and M% can be the same or different, and the embodiments in this application are not specifically limited.

[0113] Here, the second set color saturation is the preset minimum color saturation of the remaining material. The second set color saturation can be any value less than the first set color saturation. This application embodiment does not specifically limit it.

[0114] For example, in this embodiment, when the reference defect area corresponding to the suspected defect area is found to meet the second set condition, it is further determined that the size of the abnormal area in the reference defect area is greater than the third set size. Here, the third set size is the preset minimum size of the remaining material, which can be any value, such as 3 pixels. This embodiment of the application does not specifically limit it.

[0115] If the size of the abnormal area in the reference defect area is larger than the third set size, then the target defect category of the suspected defect area is determined to be: the fourth target category; otherwise, the target defect category of the suspected defect area is determined to be: the fifth target category.

[0116] When it is found that the reference defect area corresponding to the suspected defect area does not meet the second set condition, the target defect category of the suspected defect area is determined to be: the fifth target category.

[0117] The following is combined with Figure 4 How to describe the target defect category of a suspected defect area:

[0118] like Figure 4As shown, when the suspected defect category of the suspected defect area is the first suspected category (i.e., dark defect), if the first set condition is not met in the reference defect area corresponding to the suspected defect area (i.e., the color saturation of at least M% of the abnormal pixels in the reference defect area is less than the preset minimum color saturation of severe oil stains), then when the size of the abnormal area in the reference defect area corresponding to the suspected defect area is greater than the preset maximum size of slight oil stains, the target defect category of the suspected defect area is determined to be: severe oil stains; otherwise, the target defect category of the suspected defect area is determined to be: slight oil stains.

[0119] If the first set condition is not met in the reference defect area corresponding to the suspected defect area, then if the size of the abnormal area in the reference defect area corresponding to the suspected defect area is greater than the preset minimum size of severe oil contamination, the target defect category of the suspected defect area is determined to be: severe oil contamination; otherwise, the target defect category of the suspected defect area is determined to be: impurities.

[0120] When the suspected defect category of the suspected defect area is the first suspected category (i.e., light-colored defect), if the second set condition is not met in the reference defect area corresponding to the suspected defect area (i.e., the color saturation of at least N% of the abnormal pixels in the reference defect area is greater than the preset minimum color saturation of the leftover material), then when the size of the abnormal area in the reference defect area corresponding to the suspected defect area is greater than the preset minimum size of the leftover material, the target defect category of the suspected defect area is determined to be: leftover material; otherwise, the target defect category of the suspected defect area is determined to be: white spot.

[0121] When the second set condition is not met in the reference defect area corresponding to the suspected defect area, the target defect category of the suspected defect area is determined to be: white spot.

[0122] Corresponding to the embodiments of the foregoing methods, this specification also provides embodiments of the apparatus and the terminal to which it is applied.

[0123] like Figure 5 As shown, Figure 5 This is a block diagram of a defect detection device provided in an embodiment of this application. The defect detection device includes:

[0124] The preliminary positioning module is used to perform preliminary defect positioning on the obtained glove image using AI algorithms to obtain at least one suspected defect area.

[0125] The suspected defect category determination module is used to determine the suspected defect category of each suspected defect area based on the color value of each suspected defect area and the background color value of the glove image;

[0126] The conversion module is used to convert suspected defect areas that meet the set category requirements to a specified color space with color saturation, so as to obtain the reference defect area corresponding to the suspected defect area.

[0127] An abnormal pixel determination module is used to determine abnormal pixels from each reference defect region based on the suspected defect category of the suspected defect region corresponding to the reference defect region; the feature information of the abnormal pixel includes at least the color saturation of the abnormal pixel.

[0128] The target defect category determination module is used to determine the target defect category of each suspected defect region that meets the set category requirements, based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region.

[0129] As an optional implementation of this application, the above-mentioned abnormal pixel point determination module is specifically used for:

[0130] Obtain reference pixels in the reference defect region whose color saturation is a pre-specified color saturation value;

[0131] Select abnormal pixels from each reference pixel. Among the neighboring pixels of the abnormal pixel, at least one neighboring pixel has a color saturation value that is pre-specified.

[0132] As an optional implementation of this application, the above-mentioned reference pixel points in the reference defect region whose color saturation is a pre-specified color saturation value include:

[0133] The color saturation of the pixels in the reference defect area is binarized to obtain the binarized result; the color saturation of any pixel in the binarized result is one of the pre-specified binary values;

[0134] The reference pixel whose color saturation is a pre-specified color saturation value is obtained from the binarization result; the pre-specified color saturation value is one of the pre-specified binary values.

[0135] As an optional implementation of this application, the target defect category determination module is specifically used for:

[0136] Based on each abnormal pixel in the reference defect region corresponding to the suspected defect region, an abnormal region is determined; the abnormal region includes each abnormal pixel in the reference defect region.

[0137] Based on the suspected defect category of the suspected defect area, the color saturation of each abnormal pixel in the corresponding reference defect area, and the size of the abnormal area, the target defect category of the suspected defect area is determined.

[0138] As an optional implementation of this application, the above-mentioned determination of the target defect category of the suspected defect region based on the suspected defect category of the suspected defect region, the color saturation of each abnormal pixel in the corresponding reference defect region, and the size of the abnormal region includes:

[0139] If the suspected defect category of the suspected defect area is: the first suspected category, the first suspected category is used to indicate that the color of the suspected defect area is darker than the background color of the glove image, then check whether the reference defect area corresponding to the suspected defect area meets the first set condition; wherein, when the color saturation of at least M% of the abnormal pixels in the reference defect area is less than the first set color saturation, then it is determined that the reference defect area meets the first set condition.

[0140] If the reference defect area corresponding to the suspected defect area meets the first set condition, then if the size of the abnormal area in the reference defect area is larger than the first set size, the target defect category of the suspected defect area is determined to be: the first target category, which is used to indicate severe oil contamination; otherwise, the target defect category of the suspected defect area is determined to be: the second target category, which is used to indicate impurities.

[0141] If the reference defect area corresponding to the suspected defect area does not meet the first set condition, then if the size of the abnormal area in the reference defect area is larger than the second set size, the target defect category of the suspected defect area is determined to be: the first target category; otherwise, the target defect category of the suspected defect area is determined to be: the third category. The third category is used to indicate minor oil stains.

[0142] As an optional implementation of this application, the above-mentioned determination of the target defect category of the suspected defect region based on the suspected defect category of the suspected defect region, the color saturation of each abnormal pixel in the corresponding reference defect region, and the size of the abnormal region includes:

[0143] If the suspected defect category of the suspected defect area is: second suspected category, the second suspected category is used to indicate that the color of the suspected defect area is lighter than the background color of the glove image, then check whether the reference defect area corresponding to the suspected defect area meets the second set condition; wherein, when the color saturation of at least N% of the abnormal pixels in the reference defect area is greater than the second set color saturation, then it is determined that the reference defect area meets the second set condition.

[0144] If the reference defect area corresponding to the suspected defect area meets the second set condition, then if the size of the abnormal area in the reference defect area is greater than the third set size, the target defect category of the suspected defect area is determined to be: the fourth target category, which is used to indicate residual material; otherwise, the target defect category of the suspected defect area is determined to be: the fifth target category, which is used to indicate white spots.

[0145] If the reference defect area corresponding to the suspected defect area is found to not meet the second set condition, then the target defect category of the suspected defect area is determined to be: the fifth target category.

[0146] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0147] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the solution in this specification according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0148] Correspondingly, embodiments of this application also provide Figure 5 The hardware structure diagram of the device shown is as follows: Figure 6 As shown, the electronic device can be a device implementing the above-described method. Figure 6 As shown, the hardware architecture includes a processor and memory.

[0149] The memory is used to store machine-executable instructions;

[0150] The processor is used to read and execute machine-executable instructions stored in the memory to implement the corresponding defect detection method embodiment shown above.

[0151] As one embodiment, the memory can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For example, the memory can be volatile memory, non-volatile memory, or similar storage media. Specifically, the memory can be RAM (Random Access Memory), flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0152] This concludes the process. Figure 6 Description of the electronic device shown.

[0153] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0154] Other embodiments of this specification will readily occur to those skilled in the art upon consideration of the specification and practice of the invention claimed herein. This specification is intended to cover any variations, uses, or adaptations that follow the general principles of this specification and include common knowledge or customary techniques in the art not claimed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this specification are indicated by the following claims.

[0155] It should be understood that this specification is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this specification is limited only by the appended claims.

[0156] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.

Claims

1. A defect detection method, characterized in that, The method is applied to an electronic device, and the method includes: AI algorithms are used to perform preliminary defect localization on the obtained glove images, resulting in at least one suspected defect area. Based on the color value of each suspected defect area and the background color value of the glove image, the suspected defect category of each suspected defect area is determined; The suspected defect areas that meet the set category requirements are converted to a specified color space with color saturation to obtain the reference defect areas corresponding to the suspected defect areas. For each reference defect region, based on the suspected defect category of the corresponding suspected defect region, abnormal pixels are identified from the reference defect region; the feature information of the abnormal pixels includes at least the color saturation of the abnormal pixels. For each suspected defect region whose suspected defect category meets the set category requirements, the target defect category of the suspected defect region is determined based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region.

2. The method according to claim 1, characterized in that, The step of determining abnormal pixels from the reference defect region based on the suspected defect category of the suspected defect region corresponding to the reference defect region includes: Obtain reference pixels in the reference defect region whose color saturation is a pre-specified color saturation value; Select abnormal pixels from each reference pixel, wherein at least one of the neighboring pixels of the abnormal pixel has a color saturation value that is the pre-specified color saturation value.

3. The method according to claim 2, characterized in that, The reference pixel points for obtaining the color saturation of the pixels in the reference defect region to a pre-specified color saturation value include: The color saturation of the pixels in the reference defect area is binarized to obtain the binarized result; the color saturation of any pixel in the binarized result is one of the pre-specified binary values; A reference pixel with a pre-specified color saturation value is obtained from the binarization result; the pre-specified color saturation value is one of the pre-specified binary values.

4. The method according to claim 1, characterized in that, The step of determining the target defect category of the suspected defect region based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region includes: Based on each abnormal pixel in the reference defect region corresponding to the suspected defect region, an abnormal region is determined; the abnormal region includes each abnormal pixel in the reference defect region. Based on the suspected defect category of the suspected defect area, the color saturation of each abnormal pixel in the corresponding reference defect area, and the size of the abnormal area, the target defect category of the suspected defect area is determined.

5. The method according to claim 4, characterized in that, Based on the suspected defect category of the suspected defect region, the color saturation of each abnormal pixel in the corresponding reference defect region, and the size of the abnormal region, the target defect category of the suspected defect region is determined, including: If the suspected defect category of the suspected defect area is: the first suspected category, the first suspected category is used to indicate that the color of the suspected defect area is darker than the background color of the glove image, then check whether the reference defect area corresponding to the suspected defect area meets the first set condition; wherein, when the color saturation of at least M% of the abnormal pixels in the reference defect area is less than the first set color saturation, then it is determined that the reference defect area meets the first set condition. If the reference defect area corresponding to the suspected defect area meets the first set condition, then if the size of the abnormal area in the reference defect area is larger than the first set size, the target defect category of the suspected defect area is determined to be: the first target category, which is used to indicate severe oil contamination; otherwise, the target defect category of the suspected defect area is determined to be: the second target category, which is used to indicate impurities. If the reference defect area corresponding to the suspected defect area does not meet the first set condition, then if the size of the abnormal area in the reference defect area is larger than the second set size, the target defect category of the suspected defect area is determined to be: the first target category; otherwise, the target defect category of the suspected defect area is determined to be: the third category, wherein the third category is used to indicate minor oil stains.

6. The method according to claim 4, characterized in that, The process of determining the target defect category of the suspected defect region based on the suspected defect category, the color saturation of each abnormal pixel in the corresponding reference defect region, and the size of the abnormal region includes: If the suspected defect category of the suspected defect area is: second suspected category, the second suspected category is used to indicate that the color of the suspected defect area is lighter than the background color of the glove image, then check whether the reference defect area corresponding to the suspected defect area meets the second set condition; wherein, when the color saturation of at least N% of the abnormal pixels in the reference defect area is greater than the second set color saturation, then it is determined that the reference defect area meets the second set condition. If the reference defect area corresponding to the suspected defect area meets the second set condition, then if the size of the abnormal area in the reference defect area is greater than the third set size, the target defect category of the suspected defect area is determined to be: the fourth target category, which is used to indicate residual material; otherwise, the target defect category of the suspected defect area is determined to be: the fifth target category, which is used to indicate white spots. If the reference defect area corresponding to the suspected defect area is found to not meet the second set condition, then the target defect category of the suspected defect area is determined to be: the fifth target category.

7. A defect detection device, characterized in that, The device is used in an electronic device, and the device includes: The preliminary positioning module is used to perform preliminary defect positioning on the obtained glove image using AI algorithms to obtain at least one suspected defect area. The suspected defect category determination module is used to determine the suspected defect category of each suspected defect area based on the color value of each suspected defect area and the background color value of the glove image; The conversion module is used to convert suspected defect areas that meet the set category requirements to a specified color space with color saturation, so as to obtain the reference defect area corresponding to the suspected defect area. An abnormal pixel determination module is used to determine abnormal pixels from each reference defect region based on the suspected defect category of the suspected defect region corresponding to the reference defect region; the feature information of the abnormal pixel includes at least the color saturation of the abnormal pixel. The target defect category determination module is used to determine the target defect category of each suspected defect region that meets the set category requirements, based on the suspected defect category of the suspected defect region and the feature information of each abnormal pixel in the corresponding reference defect region.

8. The apparatus according to claim 7, characterized in that, The abnormal pixel point determination module is specifically used for: Obtain reference pixels in the reference defect region whose color saturation is a pre-specified color saturation value; Select abnormal pixels from each reference pixel, wherein at least one of the neighboring pixels of the abnormal pixel has a color saturation value that is the pre-specified color saturation value.

9. The apparatus according to claim 8, characterized in that, The reference pixel points for obtaining the color saturation of the pixels in the reference defect region to a pre-specified color saturation value include: The color saturation of the pixels in the reference defect area is binarized to obtain the binarized result; the color saturation of any pixel in the binarized result is one of the pre-specified binary values; A reference pixel with a pre-specified color saturation value is obtained from the binarization result; the pre-specified color saturation value is one of the pre-specified binary values.

10. An electronic device, characterized in that, Electronic devices include: processors and memory; The memory is used to store machine-executable instructions; The processor is configured to read and execute machine-executable instructions stored in the memory to implement the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Screen defect detection method, device and electronic equipment

    CN112348773A

  • Method for performing a glove inspection

    CN114252448A