An image processing-based label defect detection system and method
The label defect detection system, which utilizes image correction, multi-scale feature extraction, and adaptive threshold calculation, solves the sensitivity issues of traditional methods to changes in illumination and complex backgrounds, achieving highly robust and accurate label defect detection.
Patent Information
- Application Number
- CN202510692673.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-05-27
AI Technical Summary
Existing label defect detection systems are sensitive to changes in ambient lighting, label deformation, and interference from complex backgrounds, making them prone to misjudgment or missed detection, especially when there is slight offset or deformation during template matching.
An image processing-based label defect detection system is adopted. The system performs illumination correction through an image correction module, multi-scale feature extraction through a feature map module, adaptive local threshold calculation through a threshold determination module, residual calculation and differential operation through an image enhancement module, and multi-level fusion through a defect scoring module to generate a defect scoring map and compare it with a preset threshold to detect defects.
It improves the robustness and accuracy of defect detection in label images, enhances adaptability to complex environments, and can effectively identify small, blurry, or deformed defects. It is suitable for scenarios with complex backgrounds, low contrast, and strong reflections.
Smart Images

Figure CN120672671B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a label defect detection system and method based on image processing, an electronic device and a non-transitory computer readable storage medium. BACKGROUND
[0002] In the industrial production process, labels as an important part of product packaging not only carry product information, but also directly affect consumers' perception of product quality. The existing label defect detection system mainly relies on traditional image processing methods such as edge detection, template matching, color histogram analysis, etc. to identify common defects such as label shedding, misplacement, blur, wrinkles, and unclear printing, etc. in cooperation with fixed detection processes.
[0003] However, traditional image processing methods are sensitive to environmental light changes, label deformation, and complex background interference, and are prone to misjudgment or missed detection. In addition, template matching methods rely on pre-set templates, and when there is slight offset or deformation of the label, the detection will often fail. SUMMARY
[0004] The present application provides a label defect detection system and method based on image processing that can improve the accuracy of label defect detection, an electronic device and a non-transitory computer readable storage medium.
[0005] The technical solution of the present application to solve the above technical problems is as follows:
[0006] The present application provides a label defect detection system based on image processing, which comprises:
[0007] An image correction module for obtaining an illumination-corrected corrected image from a non-linear compensation model according to the local brightness distribution and global statistical parameters of the original input label image;
[0008] A feature map module for feature extraction using a multi-scale convolution kernel group to generate a multi-scale feature map according to the corrected image;
[0009] A threshold determination module for calculating a spatially adaptive adaptive local threshold value according to the multi-scale feature map combined with local area mean and standard deviation;
[0010] An image enhancement module for residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold value to obtain a non-linear enhanced enhanced feature map;
[0011] A defect scoring module for generating a defect score map by multi-level fusion of original enhanced features, spatial weighted features and morphological features according to the enhanced feature map.
[0012] a defect detection module configured to calculate a defect score of the label image according to the defect score map, and detect a defect of the label image by comparing the defect score with a preset threshold.
[0013] Further, the image correction module is further configured to:
[0014] by calculating a deviation of the local brightness from a global brightness statistical parameter;
[0015] establishing the non-linear compensation model according to the deviation;
[0016] adjusting the brightness distribution of each pixel of the label image dynamically according to the non-linear compensation model to obtain a corrected image.
[0017] Further, the feature map module is further configured to:
[0018] obtain a scale and a scale attenuation factor for constructing a feature map;
[0019] construct a scale attenuation term according to the scale and the scale attenuation factor;
[0020] perform feature extraction on the offset pixel of the corrected image using the multi-scale convolution kernel group, and process the scale attenuation term to obtain the multi-scale feature map.
[0021] Further, the threshold determination module is further configured to:
[0022] obtain a local mean and a local standard deviation of each pixel of the multi-scale feature map;
[0023] determine a maximum value of all local standard deviations;
[0024] determine the adaptive local threshold according to the local mean, the local standard deviation, and the maximum value of all local standard deviations.
[0025] Further, the image enhancement module is further configured to:
[0026] calculate a square value of a difference between the multi-scale feature map and the adaptive local threshold;
[0027] perform processing on the multi-scale feature map by a Laplacian operator to obtain a second derivative result of the multi-scale feature map;
[0028] determine the enhanced feature map according to the square value and the second derivative result of the multi-scale feature map.
[0029] Further, the defect score module is further configured to:
[0030] obtaining morphological features of the label image;
[0031] processing the enhanced features through a Gaussian smoothing kernel to obtain spatial weighted features;
[0032] performing weighted fusion on the enhanced features, the spatial weighted features and the morphological features to generate a defect score map.
[0033] Further, the defect detection module is further used for:
[0034] obtaining an area of a target region to be detected in the label image;
[0035] performing integral processing on the defect score map and quotient processing on the target region area to obtain a defect score of the label image.
[0036] The application further provides a label defect detection method based on image processing, and the method comprises the following steps:
[0037] obtaining a corrected image after light correction through a nonlinear compensation model according to local brightness distribution and global statistical parameters of an original input label image;
[0038] generating a multi-scale feature map through feature extraction by using a multi-scale convolution kernel group according to the corrected image;
[0039] calculating a spatially adaptive adaptive local threshold value according to the multi-scale feature map combined with local region mean and standard deviation;
[0040] obtaining an enhanced feature map after nonlinear enhancement through residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold value;
[0041] generating a defect score map through multi-level fusion of original enhanced features, spatial weighted features and morphological features according to the enhanced feature map;
[0042] calculating a defect score of the label image according to the defect score map, and detecting defects of the label image through a comparison result of the defect score and a preset threshold value.
[0043] In addition, in order to achieve the above-mentioned purpose, the application further provides an electronic device, which comprises a memory for storing a computer software program and a processor for reading and executing the computer software program, thereby realizing a label defect detection method based on image processing as described above.
[0044] In addition, to achieve the above object, the application further provides a non-transitory computer readable storage medium, wherein the storage medium stores a computer software program, and the computer software program is executed by a processor to realize the label defect detection method based on image processing.
[0045] The application has the following advantages:
[0046] (1) The application can improve the robustness of label image defect detection in complex environments;
[0047] (2) The application can improve the accuracy and sensitivity of label image defect detection;
[0048] (3) The application can enhance the adaptability and scalability of the nonlinear compensation model.
[0049] In summary, the application constructs a label defect detection method with good adaptability, accuracy and robustness by fusing traditional image processing methods and multi-scale deep features, which can effectively identify small, fuzzy or deformed defects produced in various environments. The method is not sensitive to light changes, can dynamically adjust parameters for optimal judgment, and is especially suitable for complex background, low contrast and strong light reflection scenes in the actual production and detection process of label products, and has wide practical value and promotion potential. BRIEF DESCRIPTION OF DRAWINGS
[0050] Figure 1 A scene diagram of a label defect detection method based on image processing provided by the application;
[0051] Figure 2 A structural schematic diagram of a label defect detection system based on image processing provided by the application;
[0052] Figure 3 A flowchart of a label defect detection method based on image processing provided by the application;
[0053] Figure 4 A hardware structural schematic diagram of a possible electronic device provided by the application;
[0054] Figure 5 A hardware structural schematic diagram of a possible computer readable storage medium provided by the application. DETAILED DESCRIPTION
[0055] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments of the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work are within the scope of protection of the present application.
[0056] Please refer to Figure 1 , Figure 1 A scene diagram of a label defect detection method based on image processing provided by the present application is shown in FIG. 1. As shown in FIG. 1, a terminal and a server are connected through a network, such as a wired or wireless network connection. The terminal can include, but is not limited to, a mobile phone, a tablet computer and other portable terminals installed with various network platform applications, and a computer, an inquiry machine, an advertising machine and other fixed terminals. The server provides various service services for users, including a service push server, a user recommendation server and the like. Figure 1
[0057] It should be noted that Figure 1 The scene diagram of a label defect detection method based on image processing shown in FIG. 1 is only an example. The terminal, server and application scenario described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not limit the technical solutions provided by the embodiments of the present application. A person of ordinary skill in the art can know that, as the system evolves and new service scenarios appear, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0058] The terminal can be used for:
[0059] According to the local brightness distribution and the global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a non-linear compensation model;
[0060] According to the corrected image, a multi-scale feature map is generated by using a multi-scale convolution kernel group for feature extraction;
[0061] According to the multi-scale feature map, a spatially adaptive adaptive local threshold value is calculated according to the local region mean and standard deviation;
[0062] According to the adaptive local threshold value, a non-linear enhanced enhanced feature map is obtained by residual calculation and differential operation on the multi-scale feature map;
[0063] According to the enhanced feature map, a defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features;
[0064] The defect score of the label image is calculated according to the defect score map, and defects of the label image are detected through a comparison result of the defect score and a preset threshold.
[0065] Referring to Figure 2 , Figure 2 A structural schematic diagram of a label defect detection system based on image processing provided by the present application is shown.
[0066] As Figure 2 shown, a label defect detection system based on image processing provided by an embodiment of the present application includes:
[0067] An image correction module 201 is configured to obtain a corrected image after illumination correction through a non-linear compensation model according to a local brightness distribution and global statistical parameters of an original input label image.
[0068] A feature map module 202 is configured to generate a multi-scale feature map by performing feature extraction using a multi-scale convolution kernel group according to the corrected image after illumination correction.
[0069] A threshold determination module 203 is configured to calculate a spatially adaptive adaptive local threshold according to the multi-scale feature map in combination with a local region mean and a standard deviation.
[0070] An image enhancement module 204 is configured to perform residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold to obtain an enhanced feature map after non-linear enhancement.
[0071] A defect score module 205 is configured to generate a defect score map by fusing an original enhanced feature, a spatially weighted feature and a morphological feature through multi-level fusion according to the enhanced feature map.
[0072] A defect detection module 206 is configured to calculate a defect score of the label image according to the defect score map, and detect defects of the label image through a comparison result of the defect score and a preset threshold.
[0073] In some embodiments, the image correction module 201 is further configured to:
[0074] calculate a deviation of the local brightness and the global brightness statistical parameters;
[0075] establish the non-linear compensation model according to the deviation;
[0076] dynamically adjust the brightness distribution of each pixel of the label image according to the non-linear compensation model to obtain the corrected image after illumination correction.
[0077] wherein each pixel in the label image is represented as:
[0078]
[0079] wherein, is the pixel value of the point in the original input label image, is the pixel value of the point in the corrected image after correction, is the local brightness of the point , i.e. the local brightness of the pixel point is the image average brightness, i.e. the global brightness statistical parameter, representing the average gray value of all pixels. is the brightness variance, representing the variance of the gray value of all pixels. is the first adaptive parameter, controlling the enhancement amplitude (usually set to 0.5-2). is the second adaptive parameter, controlling the influence degree of brightness difference (usually set to 0.1-1).
[0080] In a specific implementation, is the pixel value of the point in the original input label image, representing the gray value of the original image at the point , i.e. the input image pixel, generally in the range of [0, 255]. is the pixel value of the point in the corrected image after correction, representing the pixel value of the corrected image, i.e. the output image pixel, considering the result after illumination compensation. is the local brightness of the point , i.e. the local brightness of the pixel point , which is usually the average value of a small window centered at the point. is the image average brightness, i.e. the global brightness statistical parameter, representing the average gray value of all pixels. is the brightness variance, representing the variance of the gray value of all pixels. is the first adaptive parameter, controlling the enhancement amplitude (usually set to 0.5-2). is the second adaptive parameter, controlling the influence degree of brightness difference (usually set to 0.1-1).
[0081] Suppose in the label image, there are the following typical parameters:
[0082] =100, the pixel value of the point in the original image is 100;
[0083] =90, the local brightness (e.g. 5x5 neighborhood mean) of the point is 90;
[0084] =120, representing the average brightness of the whole image is 120;
[0085] =400, representing the brightness variance is 400 (i.e. standard deviation is 20);
[0086] =1.0, which can be an enhancement parameter, for example.
[0087] 0.5, for example, can be a difference sensitive parameter.
[0088] The calculation process is as follows:
[0089] 1+1.0*0.32465=1.32465;
[0090] 100*1.32465≈132.47.
[0091] Therefore, the original image pixel =100, the corrected pixel ≈132.47, that is, the pixel is brightened after illumination compensation (compensating for the problem of local brightness darkening).
[0092] In summary, the core idea of the illumination compensation method of the application is that when the local brightness of a certain pixel is lower than the average brightness of the whole image , the exponential value is close to 1, and the brightness of the pixel is enhanced. When the local brightness is close to or higher than the average brightness of the whole image, the exponential tends to 0, and there is no enhancement or slight adjustment. In this way, the brightness deficiency of the image at the edge, shadow and occlusion can be effectively compensated, and the robustness of subsequent defect detection can be improved.
[0093] In some embodiments, the feature map module 202 is further configured to:
[0094] obtain a scale and a scale attenuation factor for which a feature map is expected to be constructed;
[0095] construct a scale attenuation term according to the scale and the scale attenuation factor;
[0096] After the offset point pixel of the corrected image is extracted by the multi-scale convolution kernel group, the multi-scale feature map is obtained by combining the scale attenuation term.
[0097] wherein the multi-scale feature map is represented as:
[0098]
[0099] wherein, is a multi-scale feature map with a scale s, is a multi-scale convolution kernel weight, is a scale attenuation factor, is a pixel value of a point in the corrected image, is a pixel value of a point in the corrected image.
[0100] In the specific implementation, the formula is essentially a weighted convolution operation with a scale penalty term, which exponentially decays the scale when extracting multi-scale texture features.
[0101] F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s. F(s) represents the multi-scale feature map at scale s.
[0102] Now process an image region , the current point is =(5,5), with scale s=2, using a 3×3 convolution kernel.
[0103] Image pixel value after correction
[0104] Convolution kernel weight
[0105] Scale s=2, scale decay factor γ=0.3, calculate scale decay factor:
[0106] = ≈0.5488;
[0107] For each ) do product :
[0108]
[0109] The corresponding value is:
[0110]
[0111] After summation, it is 9.00+15.625+9.225+14.75+24.4+15.125+8.925+15.5+9.00=121.55.
[0112] F(s=2)=121.55⋅0.5488≈66.69.
[0113] For a given point (x, y), at scale s=2, its multi-scale feature value F(2)≈66.69.
[0114] In summary, the multi-scale convolution kernel of the application can simulate the responses of structures of different sizes (such as edges, defects, deformations), improving the robustness of detection; the scale attenuation factor effectively suppresses the response amplification caused by larger scales, making different scale features comparable; the final F(s) will be an important input for the next step (adaptive thresholding) and enhancement, improving the quality of local responses.
[0115] In some embodiments, the threshold determination module 203 is further configured to:
[0116] obtain the local mean and the local standard deviation of each pixel point of the multi-scale feature map;
[0117] determine the maximum value of all local standard deviations;
[0118] determine the adaptive local threshold value according to the local mean, the local standard deviation, and the maximum value of all local standard deviations.
[0119] wherein the adaptive local threshold value can be represented as:
[0120]
[0121] wherein, is the adaptive local threshold value, is the local mean of the point , is the local standard deviation of the point , is the maximum value of all local standard deviations in the entire image, is the first adjustment coefficient, is the second adjustment coefficient, is the multi-scale feature map. In specific implementations, is the local mean, which means
[0122] the average value of the gray scale of all pixels in the neighborhood range (usually a small window, such as 3x3, 5x5, etc.) of a certain pixel point (x, y) in the image, which can also be understood as the average brightness of the local area around the pixel. Assuming that a certain point is selected on the image , the local and feature information of the point is as follows:
[0123] =125, =20, =40, =66.69, =10, =0.01.
[0124] = 10 * 0.5 * 1.6669 ≈ 8.3345;
[0125] 125 + 8.3345 = 133.3345.
[0126] The final adaptive local threshold is 125 + 8.3345 = 133.3345, which means that if the gray value of the current pixel is greater than 133.33, it may be considered as a certain abnormal high response area (such as label fracture, pollution, etc.); if it is lower than the threshold, it may be a normal area.
[0127] In summary, the application fuses local statistical features and depth feature responses, which has the advantages of being sensitive to local light changes (adjusted by standard deviation); introducing multi-scale texture features F(s) to enhance the response to structural defects; the normalization design makes the threshold comparable between different images or regions; it can replace the traditional fixed threshold method and adapt to complex label background (folding, stains, printing defects, etc.).
[0128] In some embodiments, the image enhancement module 204 is also used to:
[0129] Calculate the square value of the difference between the multi-scale feature map and the adaptive local threshold;
[0130] Process the multi-scale feature map by Laplace operator to obtain the second derivative result of the multi-scale feature map;
[0131] According to the square value and the second derivative result of the multi-scale feature map, determine the enhanced feature map.
[0132] Wherein, the enhanced feature map can be represented as:
[0133]
[0134] Wherein, is the enhanced feature map, is the Laplace operator, is the first enhancement coefficient, is the second enhancement coefficient. is the second derivative result of the Laplace operator applied to .
[0135] In a specific implementation, is used to strengthen the response of the defect area, assuming that a certain point in the image is calculated, and the input data is as follows:
[0136] = 66.69, = 133.33, = 1.0, = 0.5.
[0137] The value of the neighborhood is (for the Laplacian operator):
[0138] ≈ 4440.61.
[0139]
[0140] Take the center point = 66.69, and the four neighborhood points are:
[0141] = 67, = 66, = 65, = 64.
[0142] = -266.76 + 262 = -4.76.
[0143] = 1.0 * 4440.61 + 0.5 * (-4.76) = 4440.61 - 2.38 = 4438.23.
[0144] The output of the enhanced image at this point is ≈ 4438.23 This value is significantly higher than the non-defect area (generally F ≈ T), and can be considered as a possible defect response hotspot.
[0145] In summary, the When the feature map deviates significantly from the threshold value (i.e., the defect area), the value is rapidly amplified, and the high response abnormal area is enhanced; Identify local texture changes (such as edges, mutations), and strengthen texture details; after combining the two, both brightness / texture abnormalities and background noise are detected and suppressed.
[0146] In some embodiments, the defect scoring module 205 is further configured to:
[0147] Obtain morphological features of the label image;
[0148] Process the enhanced features through a Gaussian smoothing kernel to obtain spatially weighted features;
[0149] Weighted fusion of the enhanced features, the spatially weighted features, and the morphological features to generate the defect score map.
[0150] Wherein, the defect score map can be represented as:
[0151]
[0152] wherein, is a defect score map, is a Gaussian smoothing kernel, is a morphological feature of the label image, are first, second and third weights, respectively.
[0153] In a specific implementation, may be the area of the region, the boundary density, etc., is a spatially weighted feature.
[0154] Suppose a defect score is to be calculated for a point in an image, the relevant data is as follows:
[0155] = 4438.23, Taking a 3x3 kernel as an example, the standard deviation = 1.0, then:
[0156]
[0157] The value (3x3) in the neighborhood is:
[0158]
[0159] The morphological feature = 0.85 (for example, the boundary density, which has been normalized), are 0.5, 0.4 and 0.1, respectively.
[0160] =
[0161] 4400*0.0625 + 4420*0.125 + 4410*0.0625 + 4430*0.125 + 4438.23*0.25 + 4440*0.125 + 4425*0.0625 + 4435*0.125 + 4445*0.0625 = 275 + 552.5 + 275.625 + 553.75 + 1109.56 + 555 + 276.5625 + 554.375 + 277.8125 = 4429.185.
[0162] = 2219.115 + 1771.674 + 0.085 = 3990.874.
[0163] Finally, the defect score for the point is ≈3990.87, which will be the key basis for the final judgment of defects, into the final threshold judgment.
[0164] In summary, the application can maintain the local contrast intensity of the image; smooth response while maintaining structure; introduce regional level structure information such as whether the region is closed, whether there is an edge, etc.; avoid relying only on pixels or textures, and have higher defect positioning robustness.
[0165] In some embodiments, the defect detection module 206 is also used for:
[0166] Obtaining the target area of the label image to be detected;
[0167] After integrating the defect score map, the target area is processed by quotient processing to obtain the defect score of the label image.
[0168] Wherein, the defect score can be represented as:
[0169]
[0170] Wherein, is the normalized defect score, is the target detection area, is a preset threshold.
[0171] In specific implementation, for judging whether the region has defects, representing the score of a point pixel on the defect score map, is the integral (sum) of the score value of the entire detection region to obtain the total defect score, A represents the area (pixel number) of the detection region, , indicating that there is a defect.
[0172] Suppose the detection region size is 5x5 (i.e. 25 pixels), the value in the corresponding region is as follows (unit omitted):
[0173]
[0174] Now, directly sum the above 25 D(x,y) values, the edge region sum ≈10+12+13+…≈275;
[0175] The total sum of the middle abnormal region (9 points in total):
[0176] 4000+3990+4050+3980+4020+3975+3995+4030+3985=36025.
[0177] The detection region is 5x5=25 pixels.
[0178] Assuming 100, then:
[0179] , indicating that there is a defect.
[0180] In summary, the present application normalizes the overall defect characteristics of the region by integral method; can avoid misjudgment caused by local pixel anomaly; flexible η setting, can adapt to different tolerance requirements.
[0181] Please refer to Figure 3 A flowchart of a label defect detection method based on image processing provided by the present application is provided, comprising the following steps:
[0182] Step 301, according to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after light correction is obtained through a nonlinear compensation model;
[0183] Step 302, according to the corrected image, a multi-scale feature map is generated by using a multi-scale convolution kernel group for feature extraction;
[0184] Step 303, according to the multi-scale feature map combined with local area mean and standard deviation, a spatially adaptive adaptive local threshold is calculated;
[0185] Step 304, according to the adaptive local threshold, residual calculation and differential operation are performed on the multi-scale feature map to obtain an enhanced feature map after nonlinear enhancement;
[0186] Step 305, according to the enhanced feature map, through multi-level fusion of original enhanced features, spatial weighted features and morphological features, a defect score map is generated;
[0187] Step 306, according to the defect score map, the defect score of the label image is calculated, and the defect of the label image is detected through the comparison result of the defect score and the preset threshold.
[0188] It should be noted that the specific embodiments and beneficial effects of the above steps 301-306 can be referred to the related description of the modules 201-206 described above, which will not be repeated here.
[0189] Please refer to Figure 4 , Figure 4 An embodiment schematic diagram of an electronic device provided by the present application is shown in the figure. Figure 4As shown in the figure, the embodiment of the present application provides an electronic device 400, which comprises a memory 410, a processor 420, and a computer program 411 stored in the memory 410 and capable of running on the processor 420, and the processor 420 implements the following steps when executing the computer program 411:
[0190] According to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a nonlinear compensation model;
[0191] According to the corrected image, a multi-scale feature map is generated by using a multi-scale convolution kernel group for feature extraction;
[0192] According to the multi-scale feature map combined with the local area mean and standard deviation, a spatially adaptive adaptive local threshold is calculated;
[0193] According to the adaptive local threshold, residual calculation and differential operation are performed on the multi-scale feature map to obtain an enhanced feature map after nonlinear enhancement;
[0194] According to the enhanced feature map, an defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features;
[0195] According to the defect score map, the defect score of the label image is calculated, and the defect of the label image is detected by comparing the defect score with a preset threshold.
[0196] Please refer to Figure 5 , Figure 5 An embodiment of a computer readable storage medium provided by the embodiment of the present application is shown in the figure. Figure 5 As shown in the figure, the embodiment provides a computer readable storage medium 500, which stores a computer program 411, and the computer program 411 is executed by a processor to implement the following steps:
[0197] According to the local brightness distribution and global statistical parameters of the original input label image, a corrected image after illumination correction is obtained through a nonlinear compensation model;
[0198] According to the corrected image, a multi-scale feature map is generated by using a multi-scale convolution kernel group for feature extraction;
[0199] According to the multi-scale feature map combined with the local area mean and standard deviation, a spatially adaptive adaptive local threshold is calculated;
[0200] According to the adaptive local threshold, residual calculation and differential operation are performed on the multi-scale feature map to obtain an enhanced feature map after nonlinear enhancement;
[0201] According to the enhanced feature map, a defect score map is generated by multi-level fusion of the original enhanced features, spatial weighted features and morphological features;
[0202] According to the defect score map, a defect score of the label image is calculated, and a defect of the label image is detected by comparison of the defect score with a preset threshold.
[0203] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0204] Those skilled in the art should understand that the embodiments of the present application can be provided as a system, a method, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0205] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing devices to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 a system for implementing the functions specified in one or more flows and / or blocks.
[0206] These computer program instructions can also be stored in a computer-readable memory capable of guiding a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction system, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 a system for implementing the functions specified in one or more flows and / or blocks.
[0207] These computer program instructions can also be loaded into a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1one or more processes and / or blocks Figure 1 the steps of the functions specified in the one or more blocks.
[0208] While the preferred embodiments of the application have been described, additional variations and modifications can be made to the preferred embodiments by those of skill in the art once they have the benefit of the present disclosure. Therefore, the appended claims are intended to encompass within their scope all possible variations and modifications of the preferred embodiments. The preferred embodiments of the application described herein are not meant to be limiting, but rather are meant to be illustrative only. It is therefore desired to be protected in the broadest scope of the appended claims to encompass all changes and modifications of the preferred embodiments of the application.
[0209] It is apparent that those skilled in the art can make modifications and variations to the application without departing from the scope of the application. Therefore, the application is intended to cover all such modifications and variations as fall within the scope of the claims and their equivalents.
Claims
1. An image processing based label defect detection system, characterized in that, The system comprises: An image correction module, configured to obtain a corrected image after illumination correction through a non-linear compensation model according to a local brightness distribution and global statistical parameters of an original input label image; A feature map module, configured to generate a multi-scale feature map by performing feature extraction on the corrected image after illumination correction using a multi-scale convolution kernel group; A threshold determination module, configured to calculate a spatially adaptive adaptive local threshold value according to the multi-scale feature map and a local area mean and standard deviation of a pixel point; An image enhancement module, configured to perform residual calculation and differential operation on the multi-scale feature map according to the adaptive local threshold value to obtain an enhanced feature map after non-linear enhancement; A defect scoring module, configured to generate a defect scoring map by multi-level fusion of original enhanced features, spatially weighted features and morphological features according to the enhanced feature map; A defect detection module, configured to calculate a defect score of the label image according to the defect scoring map and detect defects of the label image by comparing the defect score with a preset threshold.
2. The image processing based label defect detection system of claim 1, wherein, The image correction module is further configured to: calculate a deviation of a local brightness from a global brightness statistical parameter; establish the non-linear compensation model according to the deviation; dynamically adjust a brightness distribution of each pixel of the label image according to the non-linear compensation model to obtain a corrected image after illumination correction.
3. The image processing based label defect detection system of claim 2, wherein, The feature map module is further configured to: obtain a scale and a scale attenuation factor expected to construct a feature map; construct a scale attenuation term according to the scale and the scale attenuation factor; perform feature extraction on offset pixel points of the corrected image after illumination correction using the multi-scale convolution kernel group, and process the offset pixel points in combination with the scale attenuation term to obtain the multi-scale feature map.
4. The image processing based label defect detection system of claim 3, wherein, The threshold determination module is further configured to: obtain a local mean and a local standard deviation of each pixel point of the multi-scale feature map; determine a maximum value of all local standard deviations; determine the adaptive local threshold value according to the local mean, the local standard deviation and the maximum value of all local standard deviations.
5. The image processing based label defect detection system of claim 4, wherein, The image enhancement module is further configured to: calculate a square value of a difference between the multi-scale feature map and the adaptive local threshold value; process the multi-scale feature map by a Laplacian operator to obtain a second derivative result of the multi-scale feature map; determine the enhanced feature map according to the square value and the second derivative result of the multi-scale feature map.
6. The image processing based label defect detection system of claim 5, wherein, The defect scoring module is further configured to: obtain morphological features of the label image; process the enhanced features by a Gaussian smoothing kernel to obtain spatially weighted features; perform weighted fusion of the enhanced features, the spatially weighted features and the morphological features to generate the defect scoring map.
7. The image processing based label defect detection system as claimed in claim 6, wherein, The defect detection module is further configured to: obtain an area of a target region to be detected in the label image; perform integral processing on the defect scoring map and quotient processing on the area of the target region to be detected to obtain a defect score of the label image.
8. A label defect detection method based on image processing, performed according to the system of claim 1, characterized in that, The method comprises: obtaining a corrected image after illumination correction through a non-linear compensation model according to a local brightness distribution and global statistical parameters of an original input label image; According to the corrected image, a multi-scale convolution kernel group is used for feature extraction to generate a multi-scale feature map; According to the multi-scale feature map, a spatially adaptive adaptive local threshold is calculated according to the local region mean and standard deviation of the pixel points; According to the adaptive local threshold, residual calculation and differential operation are performed on the multi-scale feature map to obtain an enhanced feature map after nonlinear enhancement; According to the enhanced feature map, a defect score map is generated by multi-level fusion of original enhanced features, spatial weighted features and morphological features; According to the defect score map, the defect score of the label image is calculated, and the defect of the label image is detected by comparing the defect score with a preset threshold.
Citation Information
Patent Citations
High-credibility small target detection method in complex environment
CN117253117A
Image deep learning noise reduction method for low-illumination scenes such as night and tunnel
CN119107248A