A method of flexographic label defect detection

By combining a two-stage generator and a differential threshold, the false detection problem in flexographic label defect detection is solved, achieving efficient and accurate defect detection, which is suitable for rapid production of flexographic labels.

CN116071333BActive Publication Date: 2025-11-21GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310113112.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-13
Publication Date
2025-11-21
Estimated Expiration
2043-02-13

AI Technical Summary

Technical Problem

Existing technologies are prone to false detection in flexographic label defect detection, and manual inspection is inefficient and cannot detect batch printing errors in a timely manner, resulting in waste of raw materials and labor.

Method used

A two-stage generator is used to repair flexographic label images. The image is divided into character regions and background regions using a pre-built segmentation template. Defects are judged by different difference thresholds, structural similarity, and block residual statistical thresholds. The union is taken to obtain the final detection result.

Benefits of technology

It improves the accuracy of defect detection, reduces the false detection rate, and can more accurately locate defects, adapting to the rapid production needs of flexographic labels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116071333B_ABST
    Figure CN116071333B_ABST
Patent Text Reader

Abstract

The present application provides a kind of flexographic label defect detection method, comprising the following steps: S1: the flexographic label image to be detected is preliminarily repaired, and first generation sample is generated;S2: first generation sample is further repaired, and second generation sample is generated;S3: using pre-constructed division template is divided to obtain character region and background region;S4: different differential threshold is used to binarize character region and background region respectively;S5: after binarization, character region is judged using structural similarity, and character region detection result is obtained;After binarization, background region is judged using block residual statistical threshold, and background region detection result is obtained;S6: the union of character region detection result and background region detection result is obtained to obtain final detection result, and defect detection is completed.The present application provides a kind of flexographic label defect detection method, solves the problem that the current flexographic defect detection mode using standard template is prone to false detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of textile industry testing technology, and more specifically, to a method for detecting defects in flexographic labels. Background Technology

[0002] Flexographic printing refers to a printing method that uses a flexible plate to transfer ink via an anilox roller. Flexographic plates are a general term for relief printing plates made of elastic solid materials such as rubber and photosensitive materials. During printing, the ink transfer roller evenly and stably coats the image area of ​​the printing plate cylinder with ink. Then, under the pressure of the printing plate cylinder and the impression cylinder, the image on the printing plate is transferred to the surface of the substrate, thus obtaining a clear image. Flexographic printing is widely used in the packaging, labeling, and decoration of daily necessities due to its advantages such as high printing quality, wide applicability, high productivity, and good controllability. Non-toxic ink flexographic printing has become the mainstream choice for label printing, especially in the fabric and clothing industries.

[0003] Defects are unavoidable in the flexographic printing process due to machine malfunctions, ink failures, and environmental contaminants. If these defects are not detected promptly, they can lead to errors in batch production, resulting in significant waste of raw materials and labor. Furthermore, flexographic labels often contain languages ​​from around the world and a large amount of printed content. Manual inspection and random sampling are prone to omissions, leaving a risk of batch printing errors.

[0004] Currently, online inspection is generally used. However, due to the uneven thickness and density of the substrate material during flexographic printing, the printing force is uneven, and even the contents of defect-free samples will undergo slight deformation, such as printing coarseness or distortion. If the method of using the difference between the standard template and the sample is used to detect defects, it is easy to cause a large number of false detections. Summary of the Invention

[0005] This invention provides a method for detecting defects in flexographic labels to overcome the technical shortcomings of current flexographic printing defect detection methods that rely on standard templates and are prone to false detections.

[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0007] A method for detecting defects in flexographic labels includes the following steps:

[0008] S1: Use the first generator to perform preliminary repair on the flexographic label image to be detected, and generate the first generated sample;

[0009] S2: Use the second generator to further repair the first generated sample and generate the second generated sample;

[0010] S3: Use the pre-built partitioning template to partition the flexographic label image, the first generated sample, and the second generated sample to obtain the corresponding character region and background region;

[0011] S4: Use character difference thresholding to binarize the character region, and use background difference thresholding to binarize the background region;

[0012] S5: Use structural similarity to judge the binarized character regions to obtain the character region detection results; use block residual statistical threshold to judge the binarized background regions to obtain the background region detection results;

[0013] S6: Take the union of the character region detection results and the background region detection results to obtain the final detection result, thus completing the defect detection.

[0014] In the above scheme, the sample is first repaired by two generators to avoid the problem of long time consumption of local matching. Then, a pre-constructed segmentation template is used to divide the character region and the background region. Different difference thresholds are used to binarize the character region and the background region respectively. Then, the structural similarity and block residual statistical thresholds are used to determine whether there are defects in the binarized character region and the background region respectively. Finally, the detection results of the two regions are combined to obtain the final detection result. The defect localization is more accurate, the defect detection capability is improved, and the false detection rate is reduced.

[0015] Preferably, the first generator includes a high noise factor encoder, a low noise factor encoder, and a first decoder;

[0016] During the training of the first generator, high-noise factor encoder and low-noise factor encoder are used to add high-noise factor and low-noise factor to the input training samples, respectively. Then, the encoded information obtained by the low-noise factor encoder is fused into the high-noise factor encoder, and the output feature vector is sent to the first decoder. The feature integration module of the first decoder completes the upsampling and fusion of the feature vector. Each feature integration module contains three convolutional units. The connection method of the convolutional layers in the convolutional units is residual connection. The residual connection is used to fuse the upsampled low-scale information and the encoder information by accumulation, so that the new feature layer includes both low-scale decoding information and high-scale encoding information, and the final decoded features are obtained. The first generated sample is obtained by using deconvolution based on the final decoded features.

[0017] Preferably, the second generator includes codecs at multiple scales;

[0018] When training the second generator, the first generated sample is noise-added and used as the input to the second generator. In the second generator, the convolutional kernel size is 3, and multi-scale input is introduced. The high-scale encoded information is stacked with the low-scale encoded information after passing through the attention module, and then the two types of encoded information are fused using a convolutional layer. After the encoder and decoder at each scale obtain the final decoded features, they are fused from low size to high size, so that the lower-scale decoded features are fused with the higher-scale decoded features after passing through the attention module. After the multi-scale fusion is completed, the decoded information is better integrated through residual connections, and finally deconvolution is performed to obtain the second generated sample.

[0019] Preferably, the generator's loss function L GEN for:

[0020] L GEN =L(G,D)+λ1·L δ (y,G(x))+λ2·SSIM(y,G(x))

[0021]

[0022] Where x is the input image with added noise, y is the second generated sample, G is the generator, and δ is set to 1;

[0023]

[0024] Where, μ y μ G(x) Let be the means of y and G(x), respectively. and The variances of y and G(x) are σ and y, respectively. yG(x) Let c1 and c2 be the covariances of y and G(x), and c1 and c2 be different constants.

[0025]

[0026]

[0027] The total loss function L of the first generator and the second generator total for:

[0028] L total =L GEN1 +L GEN2

[0029] Among them, L GEN1 Let L be the loss function of the first generator. GEN2 This is the loss function for the second generator.

[0030] Preferably, the partitioning template is constructed through the following steps:

[0031] Create a zero-based matrix `fre`. Create N templates based on a single training sample from the training set. Input other training samples from the training set sequentially and compare them with each template. Calculate the pixel value `x` of each training sample. i,j With N templates, the number of pixels m n,i,j The Euclidean distance between Dist n,i,j :

[0032] Dist n.i,j =|x i,j -m n,i,j |

[0033] Set x i,j The initial number of matches is 10.

[0034] If Dist n.i,j If x is less than the minimum radius Radius, then i,j Increment the match count by 1.

[0035] If Dist n.i,j If the radius is not less than the minimum radius (Radius), then jump to the (n+1)th template.

[0036] If x i,j If the number of matches is greater than or equal to the preset minimum number of matches, then there is a 1 / K probability of using x. i,j Randomly update the pixel value at the corresponding position in any template, and at the same time, there is a 1 / K probability to update the pixel value of the eight neighbors of pixel (i,j) in the template.

[0037] If x i,j If the number of matches is less than the minimum number of matches, then the (i,j)th pixel in the matrix fre will be fre. i,j Add 1;

[0038] After comparing other training samples with each template, the final matrix fre is obtained as the partitioning template;

[0039] Where 1 / K is the sampling probability; K is 6, and Radius is 15.

[0040] Preferably, after binarizing the segmentation template and removing noise, the character region is set to 0 and the background region is set to 1;

[0041] Then, the background region of the flexographic label image is obtained by multiplying the segmentation template with the flexographic label image, and the character region of the flexographic label image is obtained by subtracting the flexographic label image from its background region.

[0042] The background region of the first generated sample is obtained by multiplying the segmentation template by the first generated sample, and the character region of the first generated sample is obtained by subtracting the first generated sample from its background region.

[0043] The background region of the second generated sample is obtained by multiplying the segmentation template with the second generated sample, and the character region of the second generated sample is obtained by subtracting the background region from the second generated sample.

[0044] Preferably, the character difference threshold is:

[0045] T1 = |u i1 -u i2 |-C1·δ i1

[0046] Among them, u i1 δ represents the mean gray level of the character region in the training samples. i1 u represents the standard deviation of gray levels in the character regions of the training samples. i2 The mean of the background region of the training samples;

[0047] Define the range of the constant C1 as follows:

[0048]

[0049] Preferably, the background difference threshold is:

[0050] T2=|u i2 -u′ i2 |+C2·δ i2

[0051] Among them, u i2 u′ is the mean of the background region of the training samples. i2 δ is the mean of the background region of the second generated sample. i2 The standard deviation of the background region of the training samples;

[0052] T2 <T1

[0053] The range of the constant C2 is then defined as follows:

[0054]

[0055] Preferred method for character area defect determination:

[0056] x flexographic label image i The character region and x i The first generated sample G1(x) i The first difference image is obtained by subtracting the character regions. Based on the character difference threshold T1 Binarization is performed; if the pixel value is less than T1, it is set to 0; if the pixel value is not less than T1, it is set to 255; pixels with a value of 255 are considered noise.

[0057] x flexographic label image iThe character region and x i The second generated sample G2(x) i The second difference image is obtained by subtracting the character regions. Based on the character difference threshold T1 Binarization is performed; if the pixel value is less than T1, it is set to 0; if the pixel value is not less than T1, it is set to 255; pixels with a value of 255 are considered noise.

[0058] right Determine the noise in the data.

[0059] If the contour area of ​​a noise point is less than or equal to 1, it is judged as a false defect and filtered out.

[0060] If the area of ​​the noise point's outline is greater than 1 and less than 10, it is considered a potential defect.

[0061] If the outline area is greater than or equal to 10, it is directly judged as a defect;

[0062] and Find the intersection to obtain the distribution of potential defects;

[0063] To avoid calculating structural similarity multiple times in the same area, we first obtain the minimum bounding rectangle of one potential defect, then obtain the minimum bounding rectangle of another potential defect. If the distance between the two minimum bounding rectangles is less than or equal to 20, they are classified as the same potential defect, resulting in a new minimum bounding rectangle for the defect. We repeat this process to distinguish defects and obtain the locations of potential defects. Then, we calculate x based on the locations of the potential defects. i and G2(x i Structural similarity (SSIM) of the corresponding location neighborhood;

[0064] The SSIM formula for G2 is:

[0065]

[0066] in, For x i The mean, G2(x) i The mean of ) For x i and G2(x i The covariance of ) For x i variance G2(x) i The variance of )

[0067] If the structural similarity is less than 0.9, it is judged as a defect;

[0068] If the structural similarity is not less than 0.9, it is considered normal.

[0069] Preferably, background area defect determination:

[0070] x flexographic label image i Background area and x i The second generated sample G2(x) i The third background difference image is obtained by subtracting the background regions. Based on the background difference threshold T2 Binarization is performed; if the pixel value is less than T2, it is set to 0; if the pixel value is less than T1 and greater than or equal to T2, it is set to 255. Pixels with a value of 255 are potential defects; if the pixel value is greater than or equal to T1, it is directly determined to be a defect.

[0071] x i G2(x) i Divide each patch into r*c patches;

[0072] The block residual statistical threshold is used to comprehensively consider the flexographic label image x. i With x i The second generated sample G2(x) i Residual information:

[0073] res i =|x i -G2(x i )|

[0074]

[0075] in, For res i The reconstruction residual of the r-th row and c-th column patch;

[0076]

[0077]

[0078] in, Let r be the average reconstruction residual of the patch in row r and column c. The second norm of the difference between the reconstructed residual and the average reconstructed residual;

[0079] Defect determination threshold in background area for:

[0080]

[0081]

[0082]

[0083] in, The statistical mean of the r-th row and c-th column for each patch. ) The statistical standard deviation for each patch, where C is a constant. Let the second norm be the difference between the reconstructed residual of the j-th training sample and the average reconstructed residual. The residual information res for the j-th training sample j The reconstruction residual of the r-th row and c-th column patch, where M is the number of training samples;

[0084] like Greater than Then it is determined that the patch in row r and column c has a defect;

[0085] like Not greater than If the patch in row r and column c is deemed normal, the pixel value of the corresponding potential defect will be set to 0.

[0086] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0087] This invention provides a defect detection method for flexographic labels. First, two generators are used to repair the sample, avoiding the time-consuming problem of local matching. Then, a pre-constructed segmentation template is used to divide the character region and the background region, and different difference thresholds are used to binarize the character region and the background region respectively. After that, the structural similarity and block residual statistical thresholds are used to determine whether there is a defect in the binarized character region and the background region respectively. Finally, the detection results of the two regions are combined to obtain the final detection result. This method can more accurately locate defects, improve defect detection capability, and reduce false detection rate. Attached Figure Description

[0088] Figure 1 This is a flowchart illustrating the implementation steps of the technical solution of the present invention;

[0089] Figure 2 This is a schematic diagram of the structure of the first generator in this invention;

[0090] Figure 3 This is a schematic diagram of the feature integration module in this invention;

[0091] Figure 4 This is a schematic diagram of the residual connection module in this invention;

[0092] Figure 5 This is a schematic diagram of the structure of the second generator in this invention;

[0093] Figure 6This is a schematic diagram comparing a noisy input image and its second generated sample in this invention;

[0094] Figure 7 This is a schematic diagram of the region division results in this invention;

[0095] Figure 8 This is a schematic diagram of the detection results in this invention. Detailed Implementation

[0096] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0097] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;

[0098] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.

[0099] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0100] Example 1

[0101] like Figure 1 As shown, a method for detecting defects in flexographic labels includes the following steps:

[0102] S1: Use the first generator to perform preliminary repair on the flexographic label image to be detected, and generate the first generated sample;

[0103] S2: Use the second generator to further repair the first generated sample and generate the second generated sample;

[0104] S3: Use the pre-built partitioning template to partition the flexographic label image, the first generated sample, and the second generated sample to obtain the corresponding character region and background region;

[0105] S4: Use character difference thresholding to binarize the character region, and use background difference thresholding to binarize the background region;

[0106] S5: Use structural similarity to judge the binarized character regions to obtain the character region detection results; use block residual statistical threshold to judge the binarized background regions to obtain the background region detection results;

[0107] S6: Take the union of the character region detection results and the background region detection results to obtain the final detection result, thus completing the defect detection.

[0108] In the specific implementation process, the sample is first repaired by two generators to avoid the problem of long time consumption of local matching. Then, a pre-built partitioning template is used to divide the character region and the background region, and different difference thresholds are used to binarize the character region and the background region respectively. After that, the structural similarity and block residual statistical thresholds are used to determine whether there are defects in the binarized character region and the background region respectively. Finally, the detection results of the two regions are combined to obtain the final detection result. The defect localization is more accurate, the defect detection capability is improved, and the false detection rate is reduced.

[0109] Example 2

[0110] A method for detecting defects in flexographic labels includes the following steps:

[0111] S1: Use the first generator to perform preliminary repair on the flexographic label image to be detected, and generate the first generated sample;

[0112] S2: Use the second generator to further repair the first generated sample and generate the second generated sample;

[0113] S3: Use the pre-built partitioning template to partition the flexographic label image, the first generated sample, and the second generated sample to obtain the corresponding character region and background region;

[0114] S4: Use character difference thresholding to binarize the character region, and use background difference thresholding to binarize the background region;

[0115] S5: Use structural similarity to judge the binarized character regions to obtain the character region detection results; use block residual statistical threshold to judge the binarized background regions to obtain the background region detection results;

[0116] S6: Take the union of the character region detection results and the background region detection results to obtain the final detection result, thus completing the defect detection.

[0117] More specifically, such as Figure 2 As shown, the first generator includes a high noise factor encoder, a low noise factor encoder, and a first decoder;

[0118] During the training of the first generator, high-noise factor encoders and low-noise factor encoders are used to add high-noise factors and low-noise factors to the input training samples, respectively. Then, the encoded information obtained from the low-noise factor encoder is fused into the high-noise factor encoder, enabling the first generator to better repair the structural texture of the training samples and output feature vectors to the first decoder. The feature integration module of the first decoder completes the upsampling and fusion of the feature vectors, such as... Figure 3As shown, each feature integration module contains three convolutional units. The convolutional layers within these units are connected using residual connections. The residual connection module integrates the upsampled low-scale information and the encoder information through accumulation. The residual connection module is shown below. Figure 4 As shown, the new feature layer includes both low-scale decoding information and high-scale encoding information to obtain the final decoded features. Deconvolution is then used to obtain the first generated sample based on the final decoded features.

[0119] In the specific implementation process, an Encoder-Decoder and a Discriminator are used as the first generator, with a kernel size of 4. The input training samples are given a large amount of noise, which allows for a larger receptive field to better repair the character information. Since the texture structure information of flexographic labels is relatively stable, a small number of training samples can be extracted and given a low noise factor as the second input of the first generator.

[0120] More specifically, such as Figure 5 As shown, the second generator includes codecs at multiple scales. During training, the first generated sample is noise-added and used as input. In the second generator, the convolutional kernel size is 3, and multi-scale input is introduced. High-scale encoded information is stacked with low-scale encoded information after passing through an attention module, and then the two types of encoded information are fused using a convolutional layer. The attention module dynamically selects the more important high-scale encoded information. After the codecs at each scale obtain the final decoded features, they are fused from low to high scale, allowing the lower-scale decoded features to be fused with the higher-scale decoded features after passing through the attention module. After multi-scale fusion, residual connections are used to better integrate the decoded information, and finally, deconvolution is performed to obtain the second generated sample, as shown. Figure 6 As shown, the left image is the input image with added noise, and the right image is its corresponding second generated sample. The translated text in the image is as follows:

[0121] :call

[0122] 110cm: Body size, chest circumference 110cm

[0123] Fiber composition

[0124] Fabric.

[0125] In practice, the second generator also consists of an Encoder-Decoder and a discriminator.

[0126] More specifically, the generator's loss function l GEN for:

[0127] L GEN =L(G,D)+λ1·L δ (y,G(x))+λ2·SSIM(y,G(x))

[0128] Huber Loss is a parameterized loss function used for regression problems.

[0129]

[0130] Where x is the input image with added noise, y is the second generated sample, G is the generator, and δ is set to 1;

[0131] The structural similarity index (SSIM) measures the structural similarity between two images. Unlike the widely used L2 loss, SSIM, similar to the human visual system (HVS), is sensitive to changes in local structure. The formula for SSIM is as follows:

[0132]

[0133] Where, μ y μ G(x) Let be the means of y and G(x), respectively. and The variances of y and G(x) are σ and y, respectively. yG(x) Let c1 and c2 be the covariances of y and G(x), and c1 and c2 be different constants.

[0134] Therefore, the SSIM loss is:

[0135] SSIM loss = 1 - SSIM(y,G(c))

[0136] This embodiment uses KL divergence loss to measure the similarity between generated and input samples. Because the generator's loss fluctuates around 0.75, once the Huber loss and SSIM loss decrease to a certain level, the generator's loss function mainly depends on the KL divergence loss, which is as follows:

[0137] KL(y (r,c) ,G(x) (r,c) ) = E[logy (r,c) -logG(x) (r,c) ]

[0138] Where G is the generator, x is the input image with added noise, y is the second generated sample, G(x) is the second generated sample after noise removal, and (r,c) represents the patch in the r-th row and c-th column.

[0139] Therefore, the weights of Huber loss and SSIM loss need to be increased. The coefficient of Huber loss is λ1, and the coefficient of SSIM loss is λ2. Since the generator loss is always one decimal place, the constant c in Huber loss can generally be set to three digits. Observing the graph of Huber loss, it can be found that Huber loss is close to a logarithmic function with a base greater than 0 and less than 1, and a minimum value of 0. Therefore, λ1 is set to a monotonically increasing logarithmic function.

[0140]

[0141] SSIM is typically reduced to two decimal places, with k2 set to a constant greater than 10 and less than 100.

[0142]

[0143] The total loss function L of the first generator and the second generator total for:

[0144] L total =L GEN1 +L GEN2

[0145] Among them, L GEN1 Let L be the loss function of the first generator. GEN2 This is the loss function for the second generator.

[0146] In the implementation process, two generators are used to repair the flexographic label image, avoiding the time-consuming problem caused by local matching using traditional algorithms. Furthermore, the structural positions of the flexographic label image and its corresponding generated samples remain consistent, reducing the false detection rate. This also avoids false detections caused by slight character deformation after matching correction.

[0147] Example 3

[0148] A method for detecting defects in flexographic labels includes the following steps:

[0149] S1: Use the first generator to perform preliminary repair on the flexographic label image to be detected, and generate the first generated sample;

[0150] S2: Use the second generator to further repair the first generated sample and generate the second generated sample;

[0151] S3: Use the pre-built partitioning template to partition the flexographic label image, the first generated sample, and the second generated sample to obtain the corresponding character region and background region;

[0152] S4: Use character difference thresholding to binarize the character region, and use background difference thresholding to binarize the background region;

[0153] S5: Use structural similarity to judge the binarized character regions to obtain the character region detection results; use block residual statistical threshold to judge the binarized background regions to obtain the background region detection results;

[0154] S6: Take the union of the character region detection results and the background region detection results to obtain the final detection result, thus completing the defect detection.

[0155] More specifically, the partitioning template is constructed through the following steps:

[0156] Create a zero-filled matrix `fre` with the same size as the training samples. Create N templates based on a single training sample (usually the first training sample). Input the other training samples from the training set sequentially and compare them with each template, calculating the pixel value `x` of the training samples. i,j With N templates, the number of pixels m n,i,j The Euclidean distance between Dist n,i,j :

[0157] Dist n.i,j =|x i,j -m n,i,j |

[0158] Set x i,j The initial number of matches is 10.

[0159] If Dist n.i,j If x is less than the minimum radius Radius, then i,j Increment the match count by 1.

[0160] If Dist n.i,j If the radius is not less than the minimum radius (Radius), then jump to the (n+1)th template.

[0161] If x i,h If the number of matches is greater than or equal to the preset minimum number of matches, then there is a 1 / K probability of using x. i,j Randomly update the pixel value at the corresponding position in any template, and at the same time, there is a 1 / K probability to update the pixel value of the eight neighbors of pixel (i,j) in the template.

[0162] If x i,j If the number of matches is less than the minimum number of matches, then the (i,j)th pixel in the matrix fre will be fre. i,j Add 1;

[0163] After comparing other training samples with each template, the final matrix fre is obtained as the partitioning template;

[0164] Where 1 / k is the sampling probability; K is 6, and Radius is 15.

[0165] In the specific implementation process, pixel matching modeling is used to construct a frequency map, and then the frequency map is used to construct a partitioning template.

[0166] More specifically, after binarizing the segmentation template and removing noise, the character region is set to 0 and the background region is set to 1;

[0167] Then, the background region of the flexographic label image is obtained by multiplying the segmentation template with the flexographic label image, and the character region of the flexographic label image is obtained by subtracting the flexographic label image from its background region.

[0168] The background region of the first generated sample is obtained by multiplying the segmentation template by the first generated sample, and the character region of the first generated sample is obtained by subtracting the first generated sample from its background region.

[0169] The background region of the second generated sample is obtained by multiplying the segmentation template with the second generated sample, and the character region of the second generated sample is obtained by subtracting the background region from the second generated sample.

[0170] like Figure 7 As shown in the figure, the left side shows the result of character region segmentation, and the right side shows the result of background region segmentation. The foreign language translation in the figure is as follows:

[0171] :call

[0172] 110cm: Body size, chest circumference 110cm

[0173] Fiber composition

[0174] Fabric

[0175] Manufacturing date

[0176] Country of origin

[0177] : Imported from Vietnam (Ming: (state))

[0178] Consumer Consultation Room

[0179] LS 161 161 LS-ro, Posi, Gyeonggi Province (Yamamoto-dong).

[0180] More specifically, the character difference threshold should be less than the difference between the mean of the character region and the mean of the background region. Therefore, the character difference threshold is:

[0181] T1 = |u i1 -u i2 |-C1·δ i1

[0182] Among them, u i1 δ represents the mean gray level of the character region in the training samples. i1 u represents the standard deviation of gray levels in the character regions of the training samples. i2 The mean of the background region of the training samples;

[0183] Define the range of the constant C1 as follows:

[0184]

[0185] More specifically, if the background area has relatively uniform gray levels and no areas with large gray level differences, then the background difference threshold is:

[0186] T2=|u i2 -u′ i2 |+C2·δ i2

[0187] Among them, u i2 u is the mean of the background region of the training samples. i δ′2 represents the mean of the background region of the second generated sample. i2 The standard deviation of the background region of the training samples;

[0188] Based on the grayscale characteristics of different regions, it is easy to conclude that the background difference threshold should be less than the character difference threshold, i.e.:

[0189] T2 <T1

[0190] The range of the constant C2 is then defined as follows:

[0191]

[0192] More specifically, character area defect determination:

[0193] x flexographic label image i The character region and x i The first generated sample G1(x) i The first difference image is obtained by subtracting the character regions. Based on the character difference threshold T1 Binarization is performed; if the pixel value is less than T1, it is set to 0; if the pixel value is not less than T1, it is set to 255; pixels with a value of 255 are considered noise.

[0194] x flexographic label image i The character region and x i The second generated sample G2(x) i The second difference image is obtained by subtracting the character regions. Based on the character difference threshold T1 Binarization is performed; if the pixel value is less than T1, it is set to 0; if the pixel value is not less than T1, it is set to 255; pixels with a value of 255 are considered noise.

[0195] If the actual production requirements of the enterprise are such that the defect exceeds 0.2 square millimeters (or can be more stringent, with a single pixel area of ​​approximately 0.01 square millimeters), an alert will be issued.

[0196] right Determine the noise in the data.

[0197] If the contour area of ​​a noise point is less than or equal to 1, it is judged as a false defect and filtered out.

[0198] If the area of ​​the noise point's outline is greater than 1 and less than 10, it is considered a potential defect.

[0199] If the outline area is greater than or equal to 10, it is directly judged as a defect;

[0200] and Find the intersection to obtain the distribution of potential defects;

[0201] To avoid calculating structural similarity multiple times in the same area, we first obtain the minimum bounding rectangle of one potential defect, then obtain the minimum bounding rectangle of another potential defect. If the distance between the two minimum bounding rectangles is less than or equal to 20, they are classified as the same potential defect, resulting in a new minimum bounding rectangle for the defect. We repeat this process to distinguish defects and obtain the locations of potential defects. Then, we calculate x based on the locations of the potential defects. i and G2(x i Structural similarity (SSIM) of the corresponding location neighborhood;

[0202] The SSIM formula for G2 is:

[0203]

[0204] Similarly, the SSIM formula for G1 is:

[0205]

[0206] in, For x i The mean, G2(x) i The mean of ) For x i and G2(xi The covariance of ) For x i variance G2(x) i The variance of )

[0207] If the structural similarity is less than 0.9, it is judged as a defect;

[0208] If the structural similarity is not less than 0.9, it is considered normal.

[0209] More specifically, background area defect determination:

[0210] x flexographic label image i Background area and x i The second generated sample G2(x) i The third background difference image is obtained by subtracting the background regions. Based on the background difference threshold T2 Binarization is performed; if the pixel value is less than T2, it is set to 0; if the pixel value is less than T1 and greater than or equal to T2, it is set to 255. Pixels with a value of 255 are potential defects; if the pixel value is greater than or equal to T1, it is directly determined to be a defect.

[0211] To enhance the ability to detect subtle defects, x i G2(x) i Divide each patch into r*c patches;

[0212] The block residual statistical threshold is used to comprehensively consider the flexographic label image x. i With x i The second generated sample G2(x) i Residual information:

[0213] res i =|x i -G2(x i )|

[0214]

[0215] in, For res i The reconstruction residual of the r-th row and c-th column patch;

[0216]

[0217]

[0218] in, Let r be the average reconstruction residual of the patch in row r and column c. The second norm of the difference between the reconstructed residual and the average reconstructed residual;

[0219] Defect determination threshold in background area for:

[0220]

[0221]

[0222]

[0223] in, The statistical mean of the r-th row and c-th column for each patch. The statistical standard deviation for each patch, where C is a constant. Let the second norm be the difference between the reconstructed residual of the j-th training sample and the average reconstructed residual. The residual information res for the j-th training sample j The reconstruction residual of the r-th row and c-th column patch, where M is the number of training samples;

[0224] like Greater than Then it is determined that the patch in row r and column c has a defect;

[0225] like Not greater than If the patch in row r and column c is deemed normal, the pixel value of the corresponding potential defect will be set to 0.

[0226] like Figure 8 As shown, from left to right, the detection results are for the defect sample and its corresponding first generated sample, the second generated sample, and the detection result after combining with the background area. The foreign language translation in the figure is as follows:

[0227]

[0228] Precautions when handling products

[0229] 1.

[0230] 1. Please do not damage it while washing in a washing machine.

[0231] 2.

[0232] 2. Avoid bleaching detergents and do not soak in water for extended periods (more than 30 minutes).

[0233] 3.

[0234] 3. If you sweat, it may become stained and discolored, so please wash and dehydrate as soon as possible.

[0235] 4.

[0236] 4. Carefully handle after wear and tear, as friction can cause lint to form.

[0237] 5.

[0238] 5. Do not use hangers; please dry them separately.

[0239] In practice, the differential method is used for defect detection. Compared with other unsupervised defect detection methods, it can improve the detection capability of subtle defects, reduce the false negative rate, and locate defects more accurately, resulting in clearer defect images.

[0240] In practice, due to the extremely high production speed of flexographic labels, judging each patch would take a very long time, which does not meet the actual production speed requirements. Therefore, we can choose to judge the patch containing potential defects with an outline area greater than 0.5. If it is judged as abnormal, the defect is retained, as well as the image after the threshold of the patch location is retained.

[0241] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for detecting defects in flexographic labels, characterized in that, Includes the following steps: S1: Use the first generator to perform preliminary repair on the flexographic label image to be detected, and generate the first generated sample; S2: Use the second generator to further repair the first generated sample and generate the second generated sample; S3: Using a pre-constructed partitioning template, the flexographic label image, the first generated sample, and the second generated sample are partitioned to obtain the corresponding character regions and background regions; including: Construct a partitioning template using the following steps: Create a zero-based matrix `fre`. Create N templates based on the training samples from the training set. Input other training samples from the training set sequentially and compare them with each template. Calculate the pixel value `x` of each training sample. i,j With N templates, the number of pixels m n,i,j The Euclidean distance between Dist n,i,j : Dist n.i,j =|x i,j -m n,i,j | Set x i,j The initial number of matches is 10. If Dist n.i,j If x is less than the minimum radius Radius, then i,j Increment the match count by 1. If Dist n.i,j If the value is not less than the minimum radius (Radius), then jump to the (n+1)th template. If x i,j If the number of matches is greater than or equal to the preset minimum number of matches, then there is a 1 / K probability of using x. i,j Randomly update the pixel value at the corresponding position in any template, and at the same time update the pixel value of the eight neighbors of pixel (i,j) in the template according to the sampling probability; If x i,j If the number of matches is less than the minimum number of matches, then the (i,j)th pixel in the matrix fre will be fre. i,j Add 1; After comparing other training samples with each template, the final matrix fre is obtained as the partitioning template; Where 1 / K is the sampling probability; K is 6, and Radius is 15; After binarizing the segmentation template and removing noise, the character region is set to 0 and the background region is set to 1. Then, the background region of the flexographic label image is obtained by multiplying the segmentation template with the flexographic label image, and the character region of the flexographic label image is obtained by subtracting the flexographic label image from its background region. The background region of the first generated sample is obtained by multiplying the segmentation template by the first generated sample, and the character region of the first generated sample is obtained by subtracting the first generated sample from its background region. The background region of the second generated sample is obtained by multiplying the segmentation template with the second generated sample, and the character region of the second generated sample is obtained by subtracting the background region from the second generated sample. S4: Use character difference thresholding to binarize the character region, and use background difference thresholding to binarize the background region; S5: Use structural similarity to judge the binarized character regions to obtain the character region detection results; use block residual statistical threshold to judge the binarized background regions to obtain the background region detection results; S6: Take the union of the character region detection results and the background region detection results to obtain the final detection result, thus completing the defect detection.

2. The method for detecting defects in flexographic labels according to claim 1, characterized in that, The first generator includes a high noise factor encoder, a low noise factor encoder, and a first decoder; During the training of the first generator, high-noise factor encoder and low-noise factor encoder are used to add high-noise factor and low-noise factor to the input training samples, respectively. Then, the encoded information obtained by the low-noise factor encoder is fused into the high-noise factor encoder, and the output feature vector is sent to the first decoder. The feature integration module of the first decoder completes the upsampling and fusion of the feature vector. Each feature integration module contains three convolutional units. The connection method of the convolutional layers in the convolutional units is residual connection. The residual connection is used to fuse the upsampled low-scale information and the encoder information by accumulation, so that the new feature layer includes both low-scale decoding information and high-scale encoding information, and the final decoded features are obtained. The first generated sample is obtained by using deconvolution based on the final decoded features.

3. The method for detecting defects in flexographic labels according to claim 2, characterized in that, The second generator includes codecs at multiple scales; When training the second generator, the first generated sample is noise-added and used as the input of the second generator. In the second generator, the convolution kernel size is 3, and multi-scale input is introduced. The high-scale encoded information is stacked with the low-scale encoded information after passing through the attention module, and then the two types of encoded information are fused using a convolutional layer. After the encoder and decoder at each scale obtain the final decoded features, they are fused from the low scale to the high scale, so that the low-scale decoded features are fused with the high-scale decoded features after passing through the attention module. After multiple scales are fused, residual connections are used to better integrate the decoded information, and finally deconvolution is performed to obtain the second generated sample.

4. The method for detecting defects in flexographic labels according to claim 3, characterized in that, The generator's loss function L GEN for: L GEN =L(G,D)+λ1·L δ (y,G(x))+λ2·SSIM(y,G(x)) Where x is the input image with added noise, y is the second generated sample, G is the generator, and δ is set to 1; Where, μ y μ G(x) Let be the means of y and G(x), respectively. and The variances of y and G(x) are σ and y, respectively. yG(x) Let c1 and c2 be the covariances of y and G(x), and c1 and c2 be different constants. The total loss function L of the first generator and the second generator total for: L total L GEN1 +L GEN2 Among them, L GEN1 Let L be the loss function of the first generator. GEN2 This is the loss function for the second generator.

5. The method for detecting defects in flexographic labels according to claim 1, characterized in that, The character difference threshold is: T1=|u i1 -in i2 |-C1·δ i1 Among them, u i1 δ represents the mean gray level of the character region in the training samples. i1 u represents the standard deviation of gray levels in the character regions of the training samples. i2 The mean of the background region of the training samples; Define the range of the constant C1 as follows:

6. The method for detecting defects in flexographic labels according to claim 5, characterized in that, The background difference threshold is: T2=|u i2 -in' i2 |+C2·δ i2 Among them, u i2 Let u′ be the mean of the background region of the training samples. i2 δ is the mean of the background region of the second generated sample. i2 The standard deviation of the background region of the training samples; T2 <T1; The range of the constant C2 is then defined as follows:

Citation Information

Patent Citations

  • Abnormal region detection method for adversarial auto-encoder based on introduction of automatic memory mechanism

    CN110992354A

  • Semiconductor lead frame exposure defect detection method

    CN113592866A