Printing defect data generation method and device and printing defect detection method and device
Through registration and standardization processing, printing defect samples are generated, combined with object detection and classification network, the problems of low efficiency and poor accuracy in color printing are solved, and efficient and accurate printing defect recognition is achieved.
Patent Information
- Application Number
- CN202510911375.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-07-02
AI Technical Summary
In the process of color printing, traditional manual visual inspection is inefficient and prone to missed inspection. It is difficult for existing algorithms to accurately identify printing defects in complex backgrounds. Especially in the fields of high-security printing such as cards and certificates, there are problems of insufficient detection accuracy and poor robustness, and the number of defect samples is limited and uneven, resulting in model overfitting and missed inspection.
By acquiring the real defect-free image and aligning with the reference image registration and standardizing the processing, it is converted to the CMY color space, calculating the difference value to generate defect samples, and using object detection, segmentation and classification network collaborative optimization to simulate printing defects and generate efficient training samples.
It improves the accuracy and generalization ability of printing defect detection, can effectively identify printing defects in complex backgrounds, reduce the misjudgment rate, and adapt to personalized printing characteristics.
Smart Images

Figure CN120411099A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of printing defect detection, and in particular to a method for generating printing defect data, a method for detecting printing defects, and a device therefor. Background Art
[0002] In the process of color printing, equipment failures may cause various printing defects, including printing omission, color deviation, irregular stripes caused by color band wrinkles, and impurity mixing. Especially in the field of high-security printing such as ID cards, the traditional quality control method relying on manual visual inspection is not only inefficient (the average single-piece inspection takes more than 3 seconds), but also has the risk of missed inspection. To achieve efficient and accurate quality inspection, automated inspection technology based on computer vision has become an inevitable choice, but it needs to meet three core requirements: (1) The detection accuracy needs to reach a microscopic resolution of 0.1 mm²; (2) The algorithm needs to have the ability to jointly detect multiple defects, including but not limited to the above-mentioned printing defect types; (3) In some special scenarios such as ID card printing, the printed text or image has personalized features (such as personalized names, ID numbers, portraits, etc.), and the algorithm needs to be robust when printing personalized information.
[0003] The implementation of this technology mainly faces the following technical challenges: First, there are multiple interference factors in the imaging link: The color distortion generated during the printing process and the imaging environmental light interference are superimposed to form a composite color deviation, making it difficult for traditional color difference determination methods to accurately identify the true color difference. At the same time, the complex background pattern on the surface of the printing substrate and the high-reflectivity characteristics of the post-processing anti-counterfeiting elements are likely to cause dynamic range compression of the imaging system (typically manifested as the loss of details in the high-light area), resulting in misjudgment of pseudo-defect interference.
[0004] Secondly, there are algorithm challenges in the defect recognition level: The non-linear deformation characteristics of the wrinkled stripes and the morphological diversity of random impurities make it difficult for traditional image processing algorithms based on rules to be effectively generalized. Especially in the field of ID card printing, the personalized text / image features have unpredictability and cannot be obtained through conventional sample learning, which puts higher requirements on the robustness and adaptability of the algorithm.
[0005] Furthermore, there is a data bottleneck in model training: In practical applications, it is impossible to enumerate all types of printing defects for sample collection. The existing defect samples are not only limited in quantity, but also have a serious problem of unbalanced class distribution, resulting in overfitting and missed detection phenomena in traditional supervised learning models.
[0006] In view of the above technical bottlenecks, it is urgent to develop an intelligent high-precision detection solution to achieve real-time and accurate identification of printing defects under complex working conditions.
[0007] In the cause analysis of printing defects, there is a clear corresponding relationship between different defect types and the abnormal manifestations of the CMYK four-color channels: Printing omission: It is manifested as the ineffective attachment of CMYK four-color inks in a specific area, forming a completely blank defect without printing. Such defects are common in comprehensive ink rejection caused by ink supply system failures or abnormalities on the surface of the printing substrate.
[0008] Color deviation defect: Caused by abnormalities in single or multiple color channels, it can be divided into two categories: (1) Channel omission type color deviation: When the ink of any one of the C / M / Y channels is not attached, complementary color development will be triggered (red tone appears when C is missing, green tone appears when M is missing, blue tone appears when Y is missing); for grayscale printing, K ink is usually used for printing, and when K is missing, it will cause a grayscale printing omission defect; (2) Ink amount insufficiency type color deviation: The ink amount of single or multiple channels does not reach the set value (such as a 50% reduction in the ink amount of the C channel), resulting in the color space coordinates deviating from the standard value.
[0009] Folding stripes: Essentially belonging to dynamic printing omission, due to the folding deformation of the ribbon, the ink transfer rate of the four-color inks in a local area drops sharply, showing discontinuous linear omission characteristics at the micro scale.
[0010] Impurity contamination: It is manifested as a double anomaly caused by the area covered by exogenous substances (such as black impurities): (1) Physical covering causes the loss of the underlying four-color printing information (positive omission); (2) The impurities themselves generate abnormal response values in the four-color channel imaging (reverse interference).
[0011] This mechanism model reveals the essential characteristics of printing defects: from the perspective of separating the four-color channels, all defects can be deconstructed into abnormal gain (impurity interference) or abnormal attenuation (omission / ink amount insufficiency) of specific channels. Summary of the Invention
[0012] In order to solve the problems of existing technologies in printing defect detection, the present invention provides a method for generating printing defect data, a method for detecting printing defects, and a device. The following technical solutions are adopted: A method for generating printing defect data includes the following steps: Step 1, obtaining a real defect-free printed object image as the image to be processed, and obtaining a printed object image that only contains the background without printed text or image as the second reference image; Step 2, registering and aligning the image to be processed and the second reference image; Step 3, performing normalization processing on the second reference image so that the average brightness, average hue, and average saturation of the second reference image and the image to be processed are equal in the non-printing area, obtaining a normalized reference image; Step 4: Convert the standardized reference image and the image to be detected into the CMY color space; Step 5: Calculate the difference value between the standardized image and the image to be detected on a single color channel; Step 6: Set the printed defect area; Step 7: For the defect area, generate the first defect sample based on the linear weighting of the standardized reference image and the difference value on a single color channel; Step 8: For the defect area, generate the second defect sample by multiplying the pixel value of the image to be detected on a single color channel by a second attenuation coefficient; Step 9: Convert the defect sample data generated in Step 7 and Step 8 into the RGB color space.
[0013] By adopting the above technical solution, first register and align the second reference image with the defect-free image to be detected and perform color standardization processing. Estimate the printing amount distribution of each color channel in the CMY color space, simulate printing defects in the form of single-channel printing amount attenuation, and generate training images containing missing defects and color deviation defects through color space conversion. It can efficiently and batch generate defect samples required for training the detection model automatically.
[0014] Optionally, the formula for calculating the difference value in Step 5 is: ; is the difference value between the standardized image and the image to be detected on a single color channel, , , i ∈ {C, M, Y} respectively represent the C, M, and Y channels of the image to be processed and the reference image.
[0015] By adopting the above technical solution, the printing ink amounts that need to be added to C, M, and Y from the standardized reference image to the image to be detected, that is, , i ∈ {C, M, Y}, can be accurately estimated, so as to facilitate subsequent removal or attenuation of the printing ink amount to simulate printing missing or printing color deviation defects.
[0016] Optionally, Step 6 includes the following sub-steps: Step 61: Train a target segmentation network to segment the printed area from normal samples; Step 62: Obtain the labels of the defects from real defect samples to get a label image; Step 63: Rotate, scale, and translate the label image to get a transformed label image; Step 64: Take the intersection of the transformed label image and the printed area to get the defect area.
[0017] By adopting the above technical solution, on the one hand, defect regions with diverse shapes, sizes, and positions can be obtained, and on the other hand, subsequent defect generation regions are restricted to the printing area, avoiding operations on non-printing areas; by adopting this technical solution, the generated defects are closer to actual defects.
[0018] Optionally, in step 7, the first defect sample is generated according to the following formula: ; is the first defect sample, is an indicator function that generates 1 with probability p and 0 otherwise, is the first attenuation coefficient, which is a random number in the interval [0, 1]. When , the generated sample is a printing omission sample; when and , the generated sample is a printing color deviation sample. When , takes the value equal to Ri, that is, the value before printing text or an image, so as to simulate a printing omission sample. When and , , i ∈ {C, M, Y} respectively represent the attenuation coefficients on the C, M, and Y channels, represents the printing ink amount. When the attenuation coefficient is less than 1, it means that the printing ink amount on this channel is insufficient, thus simulating a printing color deviation sample. If only one channel among the three channels has an attenuation coefficient less than 1, a single-channel printing color deviation sample can be simulated; if two channels among the three channels have attenuation coefficients less than 1, a two-channel printing color deviation sample can be simulated; if the attenuation coefficients of all three channels are less than 1, a three-channel printing color deviation sample can be simulated.
[0019] Optionally, in step 8, the second defect sample is generated according to the following formula: ; is the second attenuation coefficient, which is a random number in the interval [0, 1].
[0020] By adopting the above technical solution, it is possible to directly attenuate the ink amount of a single color channel without relying on a standardized reference image, which is more suitable for printing areas with a light background. When the area to be printed presents a light background (such as a white background) on the second reference image, the printed color deviation samples generated by this solution are more in line with the actual situation. On the one hand, there will be some errors in the registration and alignment of the image to be processed and the second reference image; on the other hand, the combined color deviation formed by color distortion during printing and imaging environment light interference will affect the result of color standardization. These two aspects of printing will cause errors in the estimation of the difference value on a single color channel, resulting in some artifacts in the generated first defective color deviation samples, which do not match the actual defects. The generation scheme of the second defective sample can avoid this problem.
[0021] A printing defect detection method includes the following steps: Step a, training a target detector using the defect data generated by a printing defect data generation method and the real defect data, where the target detector is used to detect defect targets; Step b, training a defect target segmenter using the defect data generated by a printing defect data generation method and the real defect data, where the defect target segmenter is used to segment defect targets; Step c, training an anomaly detector using real defect-free data, where the anomaly detector is used for anomaly detection; Step d, training a siamese classification network using the defect data generated by a printing defect data generation method, the real defect data, and the first reference image corresponding to the defect data for defect classification; Step e, for real test data, performing target detection, target segmentation, or anomaly detection using the trained target detector, defect target segmenter, or anomaly detector to obtain candidate defect regions.
[0022] Optionally, it further includes step f, obtaining the corresponding region of the candidate defect region on the first reference image, feeding it into the siamese classification network for classification, and determining whether the candidate region is a defect.
[0023] By adopting the above technical solution, a target detector is trained using the generated defect data and the real defect data for detecting defect targets; here, YOLO series of target detection algorithms can be used.
[0024] Using the generated defect data and the formal defect data, a defect target segmenter is trained for segmenting defect targets. Here, target segmentation algorithms such as Unet and HRNet can be used, and an online hard example mining loss function and focal loss are adopted to solve the problem of class imbalance.
[0025] Use real defect-free data to train an anomaly detector for anomaly detection. The RealNet algorithm can be adopted here.
[0026] Use the generated defect data, official data, and their corresponding first reference images to train a siamese classification network for defect classification. First, align the first reference image with the image to be detected, and then intercept their respective defect regions to form an image pair, which is input into the siamese classification network for training. With the help of the first reference image, false alarms can be reduced.
[0027] A printing defect detection device includes an imaging device, a storage medium, and a processor. The imaging device is used to acquire an image of a printed product to be detected. The storage medium stores reference images and a detection program designed by a printing defect detection method. The storage medium communicates with the imaging device to interact with the image of the printed product to be detected. The processor is communicatively connected to the storage medium, inputs the image of the printed product to be detected into the detection program, runs the detection program to output a printing defect detection result, and stores the printing defect detection result in the storage medium.
[0028] Optionally, it further includes a display device, which is communicatively connected to the storage medium and is used to display the printing defect detection result.
[0029] In summary, the present invention includes at least the following beneficial technical effects: The present invention can provide a method for generating printing defect data, a method for detecting printing defects, and a device. Based on accurately aligned first reference images and images to be detected, it first extracts candidate defect regions in the images to be detected through object detection, object segmentation, or anomaly detection algorithms, and then inputs the candidate regions and their corresponding regions in the first reference images into a siamese classification network for authenticity judgment. To improve the model performance, a method for generating printing defect data based on color space decoupling is proposed: first, register and align the second reference image with the defect-free image to be detected and perform color normalization processing, estimate the printing amount distribution of each color channel in the CMY color space, simulate printing defects in the form of single-channel printing amount attenuation, and generate training images containing missing defects and color deviation defects through color space conversion. Through the collaborative optimization of data generation and detection algorithms, the accuracy and generalization ability of printing defect detection are effectively improved. Description of the Drawings
[0030] Figure 1 It is a schematic flowchart of a method for generating printing defect data according to the present invention. Detailed Embodiments
[0031] The following further describes the present invention in detail with reference to the drawings.
[0032] Embodiments of the present invention disclose a method for generating printing defect data, a printing defect detection method, and a device.
[0033] Referring to Figure 1 , a method for generating printing defect data includes the following steps: Step 1, obtain a real defect-free printed object image as the image to be processed, and obtain a printed object image that only contains the background without printed text or image as the second reference image; Step 2, register and align the image to be processed and the second reference image; Step 3, perform normalization processing on the second reference image so that the average brightness, average hue, and average saturation of the second reference image and the image to be processed are equal in the non-printing area to obtain a normalized reference image; Step 4, convert the normalized reference image and the image to be detected into the CMY color space; Step 5, calculate the difference value between the normalized image and the image to be detected on a single color channel; Step 6, set the printing defect area; Step 7, for the defect area, generate a first defect sample based on the linear weighting of the normalized reference image and the difference value on a single color channel; Step 8, for the defect area, generate a second defect sample by multiplying the pixel value of the image to be detected on a single color channel by a second attenuation coefficient; Step 9, convert the defect sample data generated in Step 7 and Step 8 into the RGB color space.
[0034] By adopting the above technical solution, first register and align the second reference image with the defect-free image to be detected and perform color normalization processing. Estimate the printing amount distribution of each color channel in the CMY color space, simulate printing defects in the form of single-channel printing amount attenuation, and generate training images containing missing defects and color deviation defects through color space conversion. It can efficiently and batch generate defect samples required for training the detection model automatically.
[0035] Optionally, the formula for calculating the difference value in Step 5 is: ; is the difference value between the normalized image and the image to be detected on a single color channel, , , i ∈ {C, M, Y} respectively represent the C, M, and Y channels of the image to be processed and the reference image.
[0036] By adopting the above technical solution, the printing ink amounts that need to be added to C, M, and Y from the normalized reference image to the image to be detected can be accurately estimated, that is, , where \(i\in\{C,M,Y\}\), which facilitates subsequent removal or attenuation of the printing ink volume to simulate printing missing or printing color deviation defects.
[0037] Optionally, step 6 includes the following sub-steps: Step 61, training a target segmentation network to segment the printing area from normal samples; Step 62, obtaining the label of the defect from the real defect sample to obtain a label image; Step 63, rotating, scaling, and translating the label image to obtain a changed label image; Step 64, taking the intersection of the changed label image and the printing area to obtain the defect area.
[0038] By adopting the above technical solutions, on the one hand, defect areas with diverse shapes, sizes, and positions can be obtained, and on the other hand, the subsequent defect generation areas are restricted to the printing area, avoiding operations on non-printing areas; adopting this technical solution, the generated defects are closer to actual defects.
[0039] Optionally, in step 7, the first defect sample is generated according to the following formula: ; is the first defect sample, is an indicator function that generates 1 with probability \(p\) and 0 in other cases, is the first attenuation coefficient, which is a random number in the interval \([0,1]\). When , the generated is a printing missing sample; when and , the generated is a printing color deviation sample. When , takes the value equal to \(R_i\), that is, the value before printing the text or image, so as to simulate the printing missing sample. When and , , \(i\in\{C,M,Y\}\) respectively represent the attenuation coefficients on the C, M, and Y channels, represents the printing ink volume. When the attenuation coefficient is less than 1, it means that the printing ink volume on this channel is insufficient, thus simulating the printing color deviation sample. If only one channel among the three channels has an attenuation coefficient less than 1, a single-channel printing color deviation sample can be simulated; if two channels among the three channels have attenuation coefficients less than 1, a two-channel printing color deviation sample can be simulated; if the attenuation coefficients of all three channels are less than 1, a three-channel printing color deviation sample can be simulated.
[0040] Optionally, in step 8, the second defect sample is generated according to the following formula: ; is the second attenuation coefficient, which is a random number in the interval [0, 1].
[0041] By adopting the above technical solution, it is not necessary to rely on a standardized reference image, and the ink amount of a single color channel can be directly attenuated, which is more suitable for printing areas with a light background. When the area to be printed presents a light background (such as a white background) on the second reference image, the printed color deviation samples generated by using this solution are more in line with the actual situation. On the one hand, there will be some errors in the registration and alignment of the image to be processed and the second reference image; on the other hand, the combined color deviation formed by color distortion during printing and imaging environment light interference will affect the result of color standardization. These two aspects of printing will cause errors in the estimation of the difference value on a single color channel, resulting in some artifacts in the generated first defective color deviation samples, which do not match the actual defects. The generation scheme of the second defect sample can avoid this problem.
[0042] A printing defect detection method includes the following steps: Step a, training a target detector with the defect data generated by a printing defect data generation method and the real defect data, where the target detector is used to detect defect targets; Step b, training a defect target segmenter with the defect data generated by a printing defect data generation method and the real defect data, where the defect target segmenter is used to segment defect targets; Step c, training an anomaly detector with real defect-free data, where the anomaly detector is used for anomaly detection; Step d, training a siamese classification network with the defect data generated by a printing defect data generation method, the real defect data, and the first reference image corresponding to the defect data for defect classification; Step e, for real test data, using the trained target detector, defect target segmenter or anomaly detector to perform target detection, target segmentation or anomaly detection to obtain candidate defect regions.
[0043] Optionally, it further includes step f, obtaining the corresponding region of the candidate defect region on the first reference image, sending it into the siamese classification network for classification, and determining whether the candidate region is a defect.
[0044] By adopting the above technical solution, a target detector is trained with the generated defect data and the real defect data to detect defect targets; here, the target detection algorithm of the YOLO series can be adopted.
[0045] Using the generated defect data and the official defect data, train a defect target segmenter for segmenting defect targets. Here, object segmentation algorithms such as Unet and HRNet can be adopted, and the online hard example mining loss function and focal loss are used to solve the class imbalance problem.
[0046] Using the real defect-free data, train an anomaly detector for anomaly detection. Here, the RealNet algorithm can be adopted.
[0047] Using the generated defect data, the official data, and their corresponding first reference images, train a siamese classification network for defect classification. It is necessary to align the first reference image with the image to be detected first, and then intercept their respective defect regions to form an image pair, which is input into the siamese classification network for training. With the help of the first reference image, false alarms can be reduced.
[0048] A printing defect detection device includes an imaging device, a storage medium, and a processor. The imaging device is used to obtain an image of the printed matter to be detected. The storage medium stores a reference image and a detection program designed by a printing defect detection method. The storage medium communicates with the imaging device to interact with the image of the printed matter to be detected. The processor is communicatively connected to the storage medium, inputs the image of the printed matter to be detected into the detection program, runs the detection program to output a printing defect detection result, and stores the printing defect detection result in the storage medium.
[0049] Optionally, it further includes a display device communicatively connected to the storage medium for displaying the printing defect detection result.
[0050] The following uses specific embodiments to illustrate the implementation principles of a printing defect data generation method, a printing defect detection method, and a device: In the field of card printing, the printing quality of portraits is of crucial importance. Portrait printing can be divided into color printing and grayscale printing. Taking color printing as an example, common printing defects include printing omission, color patches and color dots caused by color deviation in printing, linear defects caused by wrinkling and deformation of color bands, and impurity pollution defects (such as printing defects similar to moles on the face caused by black spot impurities and printing defects similar to irregular curves in the portrait area caused by black stripe impurities). Taking grayscale printing as an example, the common printing defect is mainly printing omission. In practical applications, on the one hand, it is difficult to obtain a large number of defect samples (for example, in the portraits of grayscale printing, the proportion of defect samples is about 0.7%). On the other hand, among the obtained defect samples, the type distribution is unbalanced (for example, in the portrait defects of color printing, color patches and color dots account for 80%, and impurity pollution defects account for 9%). Limited by the number and unbalanced distribution of defect samples, it is impossible to train a sufficiently robust model for defect detection or segmentation. To address this problem, by analyzing the causes of printing defects, the following solutions are adopted to generate sufficient defect samples.
[0051] A method for generating printing defect data, comprising the following steps: Step 1, obtain a real defect-free printed object image as the image to be processed; image a card without a printed portrait to obtain a second reference image; obtain a large number of real defect-free sample images, which can generate diverse defect samples.
[0052] Step 2, register and align the image to be processed and the second reference image; the registration and alignment can adopt a feature point matching algorithm. To avoid false matching pairs caused by interference from printed portraits and improve the matching accuracy, feature points in the non-portrait printing area can be selected for matching. The portrait printing area can be obtained by training a portrait segmentation algorithm. The portrait segmentation algorithm segments the image to be processed to obtain the portrait area, and removing the portrait area can obtain the non-portrait printing area.
[0053] Step 3, perform normalization processing on the second reference image to make the average brightness, average hue and average saturation of the second reference image and the image to be processed equal in the non-printing area, to obtain a normalized reference image; for example, first convert the image from the RGB color space to the HSV color space; in the HSV color space, for the non-portrait printing area, calculate the average brightness, average hue and average saturation of the second reference image and the image to be processed respectively, and adjust the grayscale, hue and saturation of the second reference image so that the average brightness, average hue and average saturation of the adjusted image are respectively equal to the average brightness, average hue and average saturation of the image to be detected; finally, convert back from the HSV space to the RGB space. The adjusted image is the normalized reference image.
[0054] Step 4, convert the normalized reference image and the image to be detected to the CMY color space; Step 5, calculate the difference value between the standardized image and the image to be detected on a single color channel according to the following formula; ; According to the above formula, the amount of printing ink to be added to C, M, and Y from the standardized reference image to the image to be detected can be accurately estimated, that is , i ∈ {C, M, Y}, so as to facilitate subsequent removal or attenuation of the printing ink amount to simulate printing missing or printing color deviation defects.
[0055] Step 6, set the printing defect area; Step 7, for the defect area, generate the first defect sample according to the following formula: ; is the first defect sample, is an indicator function that generates 1 with probability p and 0 otherwise, is the first attenuation coefficient, which is a random number in the interval [0, 1]. When , takes the value equal to Ri, that is, the value before printing text or image, so as to simulate the printing missing sample. When and , , i ∈ {C, M, Y} respectively represent the attenuation coefficients on the C, M, and Y channels, represents the printing ink amount. When the attenuation coefficient is less than 1, it means that the printing ink amount on this channel is insufficient, so as to simulate the printing color deviation sample. If only one channel among the three channels has an attenuation coefficient less than 1, a single-channel printing color deviation sample can be simulated; if two channels among the three channels have an attenuation coefficient less than 1, a two-channel printing color deviation sample can be simulated; if the attenuation coefficients of all three channels are less than 1, a three-channel printing color deviation sample can be simulated.
[0056] Generate printing missing samples and printing color deviation samples according to the above scheme.
[0057] Step 8, for the defect area, generate the second defect sample according to the following formula: ; is the second attenuation coefficient, which is a random number in the interval [0, 1].
[0058] By adopting the above technical solution, without relying on a standardized reference image, the ink amount of a single color channel is directly attenuated, which is more suitable for printing areas with a light background. When the area to be printed presents a light background (such as a white background) on the second reference image, the printed color deviation samples generated by this solution are more in line with the actual situation. On the one hand, there will be some errors in the registration and alignment of the image to be processed and the second reference image; on the other hand, the combined color deviation formed by color distortion during printing and imaging ambient light interference will affect the result of color standardization. These two aspects of printing will cause errors in the estimation of the difference value on a single color channel, resulting in some artifacts in the generated first defective color deviation samples, which do not match the actual defects. The generation scheme of the second defective sample can avoid this problem.
[0059] Step 9, convert the defective sample data generated in Step 7 and Step 8 to the RGB color space.
[0060] By adopting the above technical solution, first register and align the second reference image with the defect-free image to be detected and perform color standardization processing. Estimate the printing amount distribution of each color channel in the CMY color space, simulate printing defects in the form of single-channel printing amount attenuation, and generate training images containing missing defects and color deviation defects through color space conversion. It can efficiently and batch-automatically generate the defective samples required for training the detection model.
[0061] Optionally, Step 6 includes the following sub-steps: Step 61, train a human portrait segmentation network to segment the human portrait area, that is, the printing area, from normal samples; Step 62, obtain the labels of the defects from real defective samples to get a label image; Step 63, rotate, scale, and translate the label image to get a changed label image; Step 64, take the intersection of the changed label image and the printing area to get the defective area.
[0062] By adopting the above technical solution, on the one hand, defective areas with diverse shapes, sizes, and positions can be obtained; on the other hand, the subsequent defective generation area is restricted to the printing area, avoiding operations on non-printing areas; adopting this technical solution, the generated defects are closer to the actual defects.
[0063] In addition, it is also possible to obtain a label image from data in other fields, such as obtaining a label image from a road segmentation dataset, so as to generate linear missing defect samples caused by similar ribbon wrinkle deformation.
[0064] For grayscale-printed human portraits, the printed missing defect samples can be generated by restricting the indicator function in the first defective sample generation formula to 0.
[0065] After generating a sufficient amount of defective samples, the generated samples and real samples are used together for the training of the printing defect detection model. The specific technical solution is as follows: A printing defect detection method includes the following steps: Step a: Use the defective data and real defective data generated by a printing defect data generation method to train a target detector, which is used to detect defective targets. For example, for the YOLO series of target detection algorithms, a large amount of generated defective data can be used for training first, and then the generated data and real data can be used for fine-tuning. The ratio of generated data to real data in fine-tuning can be 1:1, which is not limited here.
[0066] Step b: Use the defective data and real defective data generated by a printing defect data generation method to train a defective target segmenter, which is used to segment defective targets. For example, target segmentation algorithms such as UNet and deepLab, and use the online hard example mining loss function and focal loss to solve the class imbalance problem. The generated data can be used for training first, and then fine-tuning can be performed based on the generated data and real data.
[0067] Step c: Use real defect-free data to train an anomaly detector, which is used for anomaly detection. Here, the RealNet algorithm can be used, or other anomaly detection algorithms can also be used.
[0068] Step d: Use the generated defective data, official data, and their corresponding first reference images to train a siamese classification network for defect classification. Here, the first reference image is the portrait printing original. First, the first reference image needs to be aligned with the image to be detected, and then the respective defective regions are intercepted to form an image pair, which is input into the siamese classification network for training. With the help of the information of the first reference image, false alarms can be reduced. For example, the black impurities on the face are easily confused with the moles on the face, and it is impossible to distinguish them only based on the defective target detector, defective target segmenter, or anomaly detector. However, with the help of the first reference image, these two situations can be distinguished. Another example is the buttons or fine textures on the clothes, which are likely to cause false alarms for the defective target detector, defective target segmenter, or anomaly detector. By using the siamese network and introducing the information of the first reference image, such false alarms can be reduced.
[0069] Step e: For real test data, use the trained target detector, defective target segmenter, or anomaly detector to perform target detection, target segmentation, or anomaly detection to obtain candidate defective regions.
[0070] Step f: Obtain the corresponding region of the candidate defect region on the first reference image, and send it into the siamese classification network for classification to determine whether the candidate region is a defect. The siamese network can use ResNet as the backbone network, and then combine the attention mechanism module and the fully connected layer for classification, which is not limited here.
[0071] The above are all preferred embodiments of the present invention, and the protection scope of the present invention is not limited thereby. Therefore, all equivalent changes made according to the structure, shape, and principle of the present invention shall be covered within the protection scope of the present invention.
Claims
1. A method for generating printing defect data, characterized in that, Including the following steps: Step 1: Obtain a real defect-free printed object image as the image to be processed, and obtain a printed object image that only contains the background without printed text or images as the second reference image; Step 2: Register and align the image to be processed and the second reference image; Step 3: Normalize the second reference image so that the average brightness, average hue, and average saturation of the second reference image and the image to be processed in the non-printing area are equal, obtaining a normalized reference image; Step 4: Convert the normalized reference image and the image to be detected to the CMY color space; Step 5: Calculate the difference value between the normalized reference image and the image to be detected on a single color channel; Step 6: Set the printed defect area; Step 7: For the defect area, generate the first defect sample based on the linear weighting of the normalized reference image and the difference value on a single color channel; Step 8: For the defect area, generate the second defect sample by multiplying the pixel values of the image to be detected on a single color channel by a second attenuation coefficient; Step 9: Convert the defect sample data generated in Step 7 and Step 8 to the RGB color space.
2. The method for generating printing defect data according to claim 1, wherein The formula for calculating the difference value in Step 5 is: ; is the difference value between the standardized reference image and the image to be detected on a single color channel, , , where i ∈ {C, M, Y} respectively represents the C, M, and Y channels of the image to be processed and the standardized reference image.
3. A method for generating printing defect data according to claim 1, characterized in that, Step 6 includes the following sub-steps: Step 61: Train a target segmentation network to segment the printed area from normal samples; Step 62: Obtain the labels of the defects from real defect samples to obtain a label image; Step 63: Rotate, scale, and translate the label image to obtain a transformed label image; Step 64: Take the intersection of the transformed label image and the printed area to obtain the defect area.
4. A method for generating printing defect data according to claim 1, characterized in that In Step 7, the first defect sample is generated according to the following formula: ; is the first defective sample, is an indicator function that generates 1 with probability p and 0 otherwise, is the first attenuation coefficient, which is a random number in the interval [0, 1]. When , the generated sample is a printing missing sample; when and , the generated sample is a printing color deviation sample.
5. A method for generating printing defect data according to claim 1, wherein In Step 8, the second defect sample is generated according to the following formula: ; is the second attenuation coefficient, which is a random number in the interval [0, 1], T i , where i ∈ {C, M, Y} represents the C, M, and Y channels of the image to be processed.
6. A method for detecting printing defects, characterized in that: Including the following steps: Step a: Train a target detector using the defect data generated by the method for generating printed defect data according to any one of claims 1-5 and real defect data. The target detector is used to detect defect targets; Step b: Train a defect target segmenter using the defect data generated by the method for generating printed defect data according to any one of claims 1-5 and real defect data. The defect target segmenter is used to segment defect targets; Step c: Train an anomaly detector using real defect-free data. The anomaly detector is used for anomaly detection; Step d: Train a siamese classification network using the defect data generated by the method for generating printed defect data according to any one of claims 1-5, real defect data, and the first reference image corresponding to the defect data for defect classification. The first reference image is the printing original; Step e: For real test data, perform target detection, target segmentation, or anomaly detection using the trained target detector, defect target segmenter, or anomaly detector to obtain candidate defect areas.
7. A printing defect detection method according to claim 6, characterized in that: It further includes Step f: Obtain the corresponding area of the candidate defect area on the first reference image, send it into the siamese classification network for classification, and determine whether the candidate area is a defect.
8. A printing defect detection device, characterized in that: It includes an imaging device, a storage medium, and a processor. The imaging device is used to acquire an image of a printed matter to be detected. The storage medium stores a reference image and a detection program designed by using the printed defect detection method described in claim 6 or 7. The storage medium communicates with the imaging device to exchange the image of the printed matter to be detected. The processor is communicatively connected to the storage medium, inputs the image of the printed matter to be detected into the detection program, runs the detection program to output a printed defect detection result, and stores the printed defect detection result in the storage medium.
9. The printing defect detection device according to claim 8, characterized in that: It further includes a display device. The display device is communicatively connected to the storage medium and is used to display the printed defect detection result.
Citation Information
Patent Citations
Printed character defect positioning method
CN111126391A
General printing defect detection method based on deep learning and model thereof
CN111709909A
Printing defect detection method, device and equipment and storage medium
CN118446950A
Color cast identification method and device based on region weight, equipment and storage medium
CN119295775A
Printing defect detection method and apparatus, and device and storage medium
WO2024160201A1
Cited By
Printing defect detection method and device based on color channel splicing
CN120823196A
Printing quality online visual detection method and system based on image comparison
CN122089744A