Two-dimensional code quality detection method and device and medium

By preprocessing the QR code image and image processing of the QR-DeblurGANv2 image processing model, combined with the SENet spatial attention mechanism, the problem of poor QR code quality detection in the production site environment is solved, and each QR code is processed Detailed quality inspection and accurate identification of codes.

CN118552501APending Publication Date: 2024-08-27INNER MONGOLIA KUNMING CIGARETTE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410665148.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

Existing QR code quality inspection methods are easily affected by factors such as water mist, dust, and irregular operations in the production site environment, resulting in poor image quality inspection results, and individual QR code codes with poor quality may be missed in the entire batch judgment. QR code affects detection accuracy.

Method used

Preprocessed QR code images are used and image processing is performed through the QR-DeblurGANv2 image processing model. Combined with the SENet spatial attention mechanism, feature extraction and fusion of the QR code is performed to eliminate the influence of external factors and perform secondary quality assessment to ensure the detection results. accuracy.

Benefits of technology

It achieves detailed quality inspection of each QR code, avoids the omission of unqualified QR codes caused by the entire batch of inspections, improves detection accuracy and recognition accuracy, and reduces the error rate of QR code recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118552501A
    Figure CN118552501A
Patent Text Reader

Abstract

The invention discloses a two-dimensional code quality detection method and device and a medium, and the method comprises the steps: collecting a product two-dimensional code image in a production process, carrying out the preprocessing of the product two-dimensional code image, and carrying out the image segmentation of the preprocessed product two-dimensional code image, so as to obtain a segmented two-dimensional code image; based on preset quality evaluation indexes, performing quality evaluation on the two-dimensional code image to obtain an initial index score of the two-dimensional code image under each quality evaluation index; judging whether the two-dimensional code image meets a preset production standard or not according to the initial index score; if not, carrying out image processing on the two-dimensional code image through a preset QR-DeblurGANv2 image processing model to obtain a processed target two-dimensional code image; and performing quality evaluation on the target two-dimensional code image again based on the quality evaluation index to obtain a target index score corresponding to the target two-dimensional code, and determining whether the quality of the target two-dimensional code image is qualified through the target index score.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of two-dimensional code detection, and in particular to a two-dimensional code quality detection method, device and medium. Background Art

[0002] During the product production process, image quality evaluation of the product QR code image can determine whether the QR code is clear and complete, thereby ensuring that the QR code can be accurately identified and decoded by the scanning device. This is crucial for production processes that rely on QR codes for information transmission, tracking and management, and can effectively avoid information loss or errors caused by QR code quality issues.

[0003] Most of the existing quality inspection solutions use machine vision technology to inspect the quality of QR codes, use industrial cameras to capture images of QR codes at the production site, and then evaluate the quality of the captured images. However, there may be influencing factors such as water mist and dust in the production site environment, which will cause the industrial camera lens to blur. It may also be due to the improper operation of the staff, resulting in large deviations in the shooting angle and motion blur of the QR code image. These factors will lead to poor results in the quality inspection of the QR code image and detection errors. In addition, during the inspection process, the qualification of the entire batch of QR codes is judged based on the QR code acquisition rate and the average score of the QR code of the entire batch. This method will miss individual QR codes with poor quality, affecting the detection accuracy. Summary of the invention

[0004] In order to solve the above problems, this application proposes a two-dimensional code quality detection method, including:

[0005] Collecting a two-dimensional code image of a product in a production process, preprocessing the two-dimensional code image of the product, and performing image segmentation on the preprocessed two-dimensional code image of the product to obtain a segmented two-dimensional code image;

[0006] Based on the preset quality evaluation index, the quality of the two-dimensional code image is evaluated to obtain the initial index score of the two-dimensional code image under each quality evaluation index;

[0007] According to the initial indicator score, determining whether the two-dimensional code image meets the preset production standard;

[0008] If not, the two-dimensional code image is processed by a preset QR-DeblurGANv2 image processing model to obtain a processed target two-dimensional code image; wherein the QR-DeblurGANv2 image processing model introduces the SENet spatial attention mechanism based on the DeblurGANv2 image processing model;

[0009] The target two-dimensional code image is again quality-evaluated based on the quality evaluation index to obtain a target index score corresponding to the target two-dimensional code, and whether the quality of the target two-dimensional code image is qualified is determined through the target index score.

[0010] In one implementation of the present application, judging whether the two-dimensional code image meets the preset production standard according to the initial indicator score specifically includes:

[0011] For each quality evaluation indicator, the initial indicator score corresponding to the quality evaluation indicator is compared with a preset threshold value to determine the magnitude relationship between the initial indicator score and the preset threshold value;

[0012] When the initial indicator score is not less than the preset threshold, the QR code meets the preset production standard;

[0013] When the initial indicator score is less than the preset threshold, the two-dimensional code does not meet the preset production standard.

[0014] In one implementation of the present application, the two-dimensional code image is processed by a preset QR-DeblurGANv2 image processing model to obtain a processed target two-dimensional code image, specifically including:

[0015] Input the two-dimensional code image into a preset QR-DeblurGANv2 image processing model, and extract features of the two-dimensional code through the backbone network in the QR-DeblurGANv2 image processing model to obtain feature maps corresponding to each layer;

[0016] Upsampling the first feature map at a high level in the feature map, and performing feature fusion on the upsampled first feature map and the second feature map at a second low level to obtain a corresponding fused feature map; wherein the high level refers to other layers in the backbone network excluding the second low level and the bottom level; wherein the upsampling multiples decrease in descending order according to the level of the first feature map;

[0017] Performing feature fusion and deconvolution operations on the fused feature map and the third feature map at the bottom layer to obtain a target image with the same size as the corresponding size of the two-dimensional code image;

[0018] The target image and the two-dimensional code image are subjected to feature addition to obtain a processed target two-dimensional code image.

[0019] In one implementation of the present application, the backbone network in the QR-DeblurGANv2 image processing model is used to extract features from the QR code to obtain feature maps corresponding to each layer, specifically including:

[0020] Inputting the two-dimensional code image into the backbone network, performing a convolution operation on the two-dimensional code through the bottom layer in the backbone network to obtain a first initial feature map;

[0021] Input the first initial feature map from bottom to top into other layers in the backbone network, perform feature extraction on the first initial feature map through the Ghost model and SENet attention mechanism in the other layers, and output the corresponding second initial feature map and third initial feature map respectively; wherein there are multiple third initial feature maps, and each high layer corresponds to a third initial feature map;

[0022] Starting from the highest layer in the high layers, feature fusion is performed on the first initial feature map, the second initial feature map and the third initial feature map from top to bottom, and the initial fusion features obtained after fusion of each layer are horizontally connected with the initial feature map corresponding to the layer to obtain the corresponding first feature map, second feature map and third feature map.

[0023] In one implementation of the present application, the two-dimensional code image is processed by a preset QR-DeblurGANv2 image processing model to obtain a processed target two-dimensional code image, specifically including:

[0024] Using the RMSProp optimizer as the model optimizer for the QR-DeblurGANv2 image processing model;

[0025] The learning rate of the image processing model is adjusted by the RMSProp optimizer based on the following formula:

[0026]

[0027]

[0028] Where Ht represents the exponentially weighted average of the squared gradient at the tth time step, β is the decay rate, which is usually set to 0.9. represents the gradient of the loss function l, wt is the parameter value at the tth time step, and η is the learning rate, which is used to control the step size of parameter update.

[0029] In one implementation of the present application, determining whether the quality of the target two-dimensional code image is qualified specifically includes:

[0030] For each quality evaluation index, the target index score of the target two-dimensional code image under the quality evaluation index is compared with a preset threshold to determine the magnitude relationship between the two;

[0031] When the target indicator score corresponding to any of the quality evaluation indicators is less than the preset threshold, it is determined that the quality of the target two-dimensional code image is unqualified.

[0032] In one implementation of the present application, the quality indicators include symbol contrast, modulation ratio, axial inconsistency, grid inconsistency and inherent pattern corruption.

[0033] In one implementation of the present application, based on a preset quality evaluation index, the quality of the two-dimensional code image is evaluated to obtain an initial index score of the two-dimensional code image under each quality evaluation index, specifically including:

[0034] Obtaining the grayscale value corresponding to each pixel in the two-dimensional code image, determining the maximum grayscale value and the minimum grayscale value among the grayscale values, and determining the maximum reflectivity and the minimum reflectivity corresponding to the maximum grayscale value and the minimum grayscale value, respectively;

[0035] The difference between the maximum reflectivity and the minimum reflectivity is used as the initial index score corresponding to the two-dimensional code image under the symbol contrast index;

[0036] The initial index score corresponding to the modulation ratio index of the two-dimensional code image is calculated by the following formula:

[0037]

[0038] Among them, R is the module reflectivity in the QR code, GT is the overall threshold, and SC is the symbol contrast;

[0039] The initial index score corresponding to the axial inconsistency index of the two-dimensional code image is calculated by the following formula:

[0040]

[0041] Among them, X AVG Indicates the average horizontal axis spacing, Y AVG represents the average vertical axial spacing;

[0042] The initial index score corresponding to the two-dimensional code image under the grid inconsistency index is calculated by the following formula:

[0043]

[0044] Among them, x A ( i,j ) represents the x-coordinate value of the sampling point in the i-th row and j-th column, x B ( i,j ) represents the x-coordinate value of the theoretical sampling point in the i-th row and j-th column, and y A ( i,j) represents the y coordinate value of the sampling point in the i-th row and j-th column, y B ( i,j ) represents the y-coordinate value of the theoretical sampling point in the i-th row and j-th column;

[0045] An image area in the two-dimensional code image whose corresponding modulation ratio is lower than a preset modulation ratio threshold is determined, and an initial index score of the two-dimensional code image under the inherent graphic contamination index is obtained according to the area ratio of the image area in the two-dimensional code image.

[0046] The present application provides a two-dimensional code quality detection device, the device comprising:

[0047] at least one processor;

[0048] and, a memory communicatively coupled to the at least one processor;

[0049] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a two-dimensional code quality detection method as described in any one of the above items.

[0050] The embodiment of the present application provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:

[0051] A two-dimensional code quality detection method as described in any one of the above items.

[0052] The two-dimensional code quality detection method proposed in this application can bring the following beneficial effects:

[0053] Real-time quality inspection of product QR codes during the production process can achieve inspection of each QR code, ensuring full coverage of QR code quality evaluation and avoiding the omission of unqualified QR codes caused by quality inspection of an entire batch of QR codes.

[0054] After the initial evaluation of the QR code image through the quality evaluation index, if the QR code image does not meet the production standards, the QR code image is processed through the image processing model to eliminate the negative impact of external factors on the quality evaluation results. In this way, the quality of the processed target QR code image is evaluated again to ensure the accuracy of the quality evaluation results, thereby screening out unqualified QR codes due to problems with the QR code itself and reducing the error rate of QR code recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0056] Figure 1 A schematic diagram of a flow chart of a two-dimensional code quality detection method provided in an embodiment of the present application;

[0057] Figure 2 A schematic diagram of the model architecture of a QR-DeblurGANv2 image processing model provided in an embodiment of the present application;

[0058] Figure 3 A schematic diagram of the structure of a QR code quality detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0060] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0061] like Figure 1 As shown, a two-dimensional code quality detection method provided in an embodiment of the present application includes:

[0062] S101: collecting product two-dimensional code images in the production process, preprocessing the product two-dimensional code images, and performing image segmentation on the preprocessed product two-dimensional code images to obtain segmented two-dimensional code images.

[0063] QR code technology uses the characteristic of one object and one code to assign a unique digital identity to each product. Through QR codes, products entering the market can be tracked and managed to ensure product quality. Therefore, in the product production process, not only must product quality be strictly controlled, but the quality of the QR code must also be tested to ensure the integrity and clarity of the QR code so that the QR code is readable. In the product production process, the product QR code image is collected by an industrial camera. The environment at the production site may be complex and changeable. Factors such as lighting, angle, and distance may affect the clarity and readability of the QR code image. Therefore, after the product QR code image is collected, the image needs to be pre-processed, including grayscale processing, filtering, and binarization processing, etc., to eliminate noise in the image, improve contrast, balance brightness, etc., so as to improve image quality, provide more favorable conditions for subsequent QR code reading and recognition, and increase processing speed. For the preprocessed QR code image, target detection is required to separate the QR code area from other areas in the QR code image, thereby removing the background information in the QR code image, narrowing the recognition range, removing interference factors for subsequent quality evaluation, and improving recognition efficiency.

[0064] S102: Based on preset quality evaluation indicators, the quality of the two-dimensional code image is evaluated to obtain an initial indicator score of the two-dimensional code image under each quality evaluation indicator.

[0065] After separating the QR code image from the product QR code image, the QR code image needs to be evaluated for quality to determine whether the QR code is contaminated, unevenly reflected, etc. The evaluation needs to be based on the preset quality evaluation indicators. The initial indicator score corresponding to the obtained quality evaluation indicator is used to determine whether the QR code image meets the preset production standards. The quality evaluation indicators used to evaluate the quality of the QR code include symbol contrast, modulation ratio, axial inconsistency, grid inconsistency, and inherent graphic contamination.

[0066] In one embodiment, the symbol contrast (SC) is used to measure whether the difference between the deep and shallow reflections in the two-dimensional code image is obvious. Since the two-dimensional code image has been gray-scaled during the preprocessing process, the grayscale value corresponding to each pixel in the two-dimensional code image can be obtained by scanning the processed two-dimensional code image line by line. According to the grayscale value, the maximum grayscale value and the minimum grayscale value in the entire two-dimensional code image can be determined, and the maximum reflectivity and the minimum reflectivity corresponding to the maximum grayscale value and the minimum grayscale value can be determined. The difference between the maximum reflectivity and the minimum reflectivity is the symbol contrast. By calculating the above difference, the initial index score corresponding to the two-dimensional code image under the symbol contrast index can be obtained.

[0067] Modulation ratio (MOD) is used to measure the consistency of the deep and shallow reflectivity of the QR code image. The initial index score corresponding to the modulation ratio index of the QR code image is calculated using the following formula:

[0068]

[0069] Among them, R is the module reflectivity in the QR code, GT is the overall threshold, and SC is the symbol contrast.

[0070] Axial inconsistency (AN) is used to measure the unevenness of the axial size of the QR code data module. The initial index score corresponding to the axial inconsistency index of the QR code image is calculated using the following formula:

[0071]

[0072] Among them, X AVG Indicates the average horizontal axis spacing, Y AVG Indicates the average vertical axis spacing.

[0073] Grid inconsistency (GN) is used to measure the maximum vector deviation of the grid intersection position from its ideal position. The initial index score corresponding to the QR code image under the grid inconsistency index is calculated using the following formula:

[0074]

[0075] Among them, x A ( i,j ) represents the x-coordinate value of the sampling point in the i-th row and j-th column, x B ( i,j ) represents the x-coordinate value of the theoretical sampling point in the i-th row and j-th column, and y A ( i,j ) represents the y coordinate value of the sampling point in the i-th row and j-th column, y B ( i,j ) represents the y-coordinate value of the theoretical sampling point in the i-th row and j-th column.

[0076] Intrinsic graphic contamination is used to measure the degree of influence of inherent contamination of each area of ​​the QR code on the QR code reading ability. The image area in the QR code image whose corresponding modulation ratio is lower than the preset modulation ratio threshold is determined, and the image area is regarded as the image contamination area. Then, according to the area ratio of the image area in the QR code image, the initial index score of the QR code image under the inherent graphic contamination index can be obtained.

[0077] S103: judging whether the two-dimensional code image meets the preset production standard according to the initial indicator score.

[0078] After completing the quality assessment of the QR code image, it is necessary to determine whether the QR code meets the preset production standards based on the initial index score obtained. This process is based on the preset threshold. The preset threshold is the lower limit of the QR code quality evaluation index obtained based on the data set of the historical production process. It can be changed according to actual needs, and this application does not restrict this.

[0079] Specifically, for each quality evaluation indicator, the initial indicator score corresponding to the quality evaluation indicator is compared with the preset threshold to determine the size relationship between the initial indicator score and the preset threshold. When the initial indicator score is not less than the preset threshold, the QR code meets the preset production standard; when the initial indicator score is less than the preset threshold, the QR code does not meet the preset production standard. It should be noted that the embodiment of the present application is a comprehensive evaluation of the QR code image based on multiple quality evaluation indicators. As long as the initial indicator score corresponding to any quality evaluation indicator does not meet the requirements, the QR code image will be directly identified as not meeting the production standards.

[0080] S104: If not, perform image processing on the two-dimensional code image through a preset QR-DeblurGANv2 image processing model to obtain a processed target two-dimensional code image; wherein the QR-DeblurGANv2 image processing model introduces the SENet spatial attention mechanism based on the DeblurGANv2 image processing model.

[0081] The above process makes a preliminary assessment of the quality of the QR code image. However, due to the low quality evaluation score of the QR code image caused by reasons other than the quality of the QR code itself, such as large shooting angle deviation, blurry industrial camera lens, motion blur of the QR code image, etc., it is necessary to use the preset QR-DeblurGANv2 image processing model to process the QR code image, eliminate the influence of the above factors on the quality assessment results, and obtain the processed target QR code image.

[0082] It should be noted that the QR code is mainly divided into a positioning area, a version information or data encoding information area, a main data storage area and an error correction area. In the actual production process, considering the need for real-time response and computing power allocation, more computing power resources need to be invested in the key areas of the QR code. Based on this, the QR-DeblurGANv2 image processing model provided in the embodiment of the present application introduces the SENet spatial attention mechanism based on the existing DeblurGANv2 image processing model. Through the SENet spatial attention mechanism, important features can be enhanced and unimportant features can be weakened, thereby making the extracted features more directional.

[0083] The backbone network of the existing DeblurGANv2 image processing model is a Feature Pyramid Networks (FPN) structure. Since QR code image recognition needs to achieve fast response in the actual production process, the backbone network of the QR-DeblurGANv2 image processing model mainly transforms the generator part. The backbone network removes the 1×1 convolution layer and replaces it with a lightweight network Ghost Module to improve the model processing speed and achieve fast response.

[0084] like Figure 2 The schematic diagram of the model architecture of a QR-DeblurGANv2 image processing model shown in FIG. The backbone network adopts the FPN network structure, which enables the network to extract and predict features at different scales through cross-layer connections and feature fusion. Specifically, the FPN structure consists of three main parts: the bottom-up path, which is a standard forward convolution process used to construct feature maps of different scales; the top-down path, which constructs a multi-scale feature pyramid by upsampling high-level feature maps and fusing them with lower-level feature maps; and the horizontal connection, which fuses the bottom-up feature map with the top-down upsampled feature map, so that the fused feature map contains both high-level semantic information and low-level spatial information. In this way, FPN can extract and predict features at different scales, thereby better adapting to targets of different sizes and shapes. Especially when dealing with small targets, FPN significantly improves the performance of QR code detection by fusing low-level and high-level features.

[0085] Based on this, the QR code image is input into the preset QR-DeblurGANv2 image processing model. The backbone network in the QR-DeblurGANv2 image processing model is used to extract the features of the QR code and obtain the feature maps corresponding to each layer. Among them, when dividing the network structure level, three types of levels are set, namely the bottom layer L1, the second bottom layer L2, and the high-level L3-L5 other than the above layers. It should be noted that in Figure 2There are three layers in the middle and high layers. The model network structure can be adjusted according to actual needs. Except for the bottom layer and the second bottom layer, the other layers are uniformly referred to as high layers. The feature map obtained at this time is the feature map that completes the fusion of low-level and high-level features, which are T1-T5 respectively. T1-T3 is the first feature map at the high level. After the first feature map is upsampled eight times, four times and twice respectively, the upsampled first feature map is added to the channel corresponding to the second feature map T2 at the second bottom layer and the feature fusion is performed to obtain the corresponding fused feature map. Among them, the upsampling multiple decreases in order from high to low according to the level of the first feature map. After completing the fusion of the feature maps between the above different levels, the fused feature map is upsampled, feature fused and deconvolved with the third feature map T1 at the bottom layer to obtain a target image with the same size as the QR code image. At this time, the target image obtained is added to the QR code image to obtain the processed target QR code image. The target QR code image is the QR code image obtained after eliminating the influence of external factors on the image.

[0086] It should be noted that when the backbone network extracts features from the QR code image, the bottom layer L1 in the backbone network performs a 3×3 convolution operation on the QR code to obtain the first initial feature map R1. R1 will not only be connected to the high-level fusion feature map, but will also continue to be input from bottom to top into other layers in the backbone network. Through the Ghost model and SENet attention mechanism in other layers, the first initial feature map is extracted, and the corresponding second initial feature map R2 and third initial feature maps R3-R5 are output respectively. The third initial feature map is a general term for multiple high-level output feature maps, and each high-level corresponds to a third initial feature map. After completing the bottom-up feature extraction and obtaining the initial feature maps of different scales, it is necessary to perform top-down feature fusion on the initial feature maps. Starting from the highest layer L5 in the high layer, the first initial feature map, the second initial feature map and the third initial feature map are fused from top to bottom. In other words, each layer fuses the feature map located on the upper layer. After each layer is fused to obtain the initial fused feature, the initial fused feature needs to be horizontally connected with the initial feature map corresponding to the layer, so as to obtain the corresponding first feature map, second feature map and third feature map. It should be noted that before performing the horizontal connection, the initial feature map needs to be subjected to a 1×1 convolution operation.

[0087] In one embodiment, the QR-DeblurGANv2 image processing model uses the RMSProp optimizer as the model optimizer. The RMSProp optimizer uses the exponentially weighted moving average of the squared gradient to adjust the learning rate, making the adjustment of the learning rate smoother. It tracks the squared value of the past gradient for each parameter, and then adjusts the learning rate of each parameter by these values. This method can effectively avoid the gradient vanishing and gradient exploding phenomena, improve the model convergence speed, and achieve fast model response.

[0088] Among them, the RMSProp optimizer adjusts the learning rate. The specific process is shown in the following formula:

[0089]

[0090]

[0091] Where Ht represents the exponentially weighted average of the squared gradient at the tth time step, β is the decay rate, which is usually set to 0.9. represents the gradient of the loss function l, wt is the parameter value at the tth time step, and η is the learning rate, which is used to control the step size of parameter update.

[0092] S105: re-evaluate the quality of the target two-dimensional code image based on the quality evaluation index to obtain a target index score corresponding to the target two-dimensional code, and determine whether the quality of the target two-dimensional code image is qualified through the target index score.

[0093] After the two-dimensional code image is processed by the image processing model, the impact of the quality problems of the non-two-dimensional code itself on the quality assessment results is eliminated. At this time, the quality of the two-dimensional code needs to be further evaluated to determine whether the initial index value does not meet the production standard due to the quality problems of the two-dimensional code itself. Consistent with the method adopted in the initial quality assessment, the target two-dimensional code image is again evaluated by the quality assessment index to obtain the corresponding target index score. At this time, for each quality evaluation index, the target index score of the target two-dimensional code image under the quality evaluation index is compared with the preset threshold to determine the size relationship between the two. If the target index score corresponding to any quality evaluation index is less than the preset threshold, it means that there is still a problem of substandard quality of the two-dimensional code. Since the image processing of the two-dimensional code image has been carried out at this time to eliminate the quality impact caused by the non-two-dimensional code itself, it can directly determine that the quality of the target two-dimensional code image is unqualified, thereby triggering the corresponding alarm mechanism and giving corresponding prompts to the staff to facilitate subsequent re-production.

[0094] The above are embodiments of the method proposed in this application. Based on the same idea, some embodiments of this application also provide devices and non-volatile computer storage media corresponding to the above methods.

[0095] Figure 3 A schematic diagram of the structure of a two-dimensional code quality detection device provided in an embodiment of the present application. Figure 3 As shown, including:

[0096] at least one processor;

[0097] and, a memory communicatively coupled to the at least one processor;

[0098] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor so that the at least one processor can execute a two-dimensional code quality detection method as described in any one of the above items.

[0099] The embodiment of the present application provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:

[0100] A two-dimensional code quality detection method as described in any one of the above items.

[0101] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0102] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0103] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0104] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, 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 processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0105] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0107] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0108] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0109] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0110] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0111] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A two-dimensional code quality detection method, characterized in that: The method comprises: Collecting a two-dimensional code image of a product in a production process, preprocessing the two-dimensional code image of the product, and performing image segmentation on the preprocessed two-dimensional code image of the product to obtain a segmented two-dimensional code image; Based on the preset quality evaluation index, the quality of the two-dimensional code image is evaluated to obtain the initial index score of the two-dimensional code image under each quality evaluation index; According to the initial indicator score, determining whether the two-dimensional code image meets the preset production standard; If not, the two-dimensional code image is processed by a preset QR-DeblurGANv2 image processing model to obtain a processed target two-dimensional code image; wherein the QR-DeblurGANv2 image processing model introduces the SENet spatial attention mechanism based on the DeblurGANv2 image processing model; The target two-dimensional code image is again quality-evaluated based on the quality evaluation index to obtain a target index score corresponding to the target two-dimensional code, and whether the quality of the target two-dimensional code image is qualified is determined through the target index score.

2. A two-dimensional code quality detection method according to claim 1, characterized in that: According to the initial indicator score, judging whether the two-dimensional code image meets the preset production standard specifically includes: For each quality evaluation indicator, the initial indicator score corresponding to the quality evaluation indicator is compared with a preset threshold value to determine the magnitude relationship between the initial indicator score and the preset threshold value; When the initial indicator score is not less than the preset threshold, the QR code meets the preset production standard; When the initial indicator score is less than the preset threshold, the two-dimensional code does not meet the preset production standard.

3. A two-dimensional code quality detection method according to claim 1, characterized in that: The QR-DeblurGANv2 image processing model is used to process the QR code image to obtain a processed target QR code image, which specifically includes: Input the two-dimensional code image into a preset QR-DeblurGANv2 image processing model, and extract features of the two-dimensional code through the backbone network in the QR-DeblurGANv2 image processing model to obtain feature maps corresponding to each layer; Upsampling the first feature map at a high level in the feature map, and performing feature fusion on the upsampled first feature map and the second feature map at a second low level to obtain a corresponding fused feature map; wherein the high level refers to other layers in the backbone network excluding the second low level and the bottom level; wherein the upsampling multiples decrease in descending order according to the level of the first feature map; Performing feature fusion and deconvolution operations on the fused feature map and the third feature map at the bottom layer to obtain a target image with the same size as the corresponding size of the two-dimensional code image; The target image and the two-dimensional code image are subjected to feature addition to obtain a processed target two-dimensional code image.

4. A two-dimensional code quality detection method according to claim 3, characterized in that: Through the backbone network in the QR-DeblurGANv2 image processing model, the features of the QR code are extracted to obtain the feature maps corresponding to each layer, which specifically include: Inputting the two-dimensional code image into the backbone network, performing a convolution operation on the two-dimensional code through the bottom layer in the backbone network to obtain a first initial feature map; Input the first initial feature map from bottom to top into other layers in the backbone network, perform feature extraction on the first initial feature map through the Ghost model and SENet attention mechanism in the other layers, and output the corresponding second initial feature map and third initial feature map respectively; wherein there are multiple third initial feature maps, and each high layer corresponds to a third initial feature map; Starting from the highest layer in the high layers, feature fusion is performed on the first initial feature map, the second initial feature map and the third initial feature map from top to bottom, and the initial fusion features obtained after fusion of each layer are horizontally connected with the initial feature map corresponding to the layer to obtain the corresponding first feature map, second feature map and third feature map.

5. A two-dimensional code quality detection method according to claim 1, characterized in that: The QR-DeblurGANv2 image processing model is used to process the QR code image to obtain a processed target QR code image, which specifically includes: Using the RMSProp optimizer as the model optimizer for the QR-DeblurGANv2 image processing model; The learning rate of the image processing model is adjusted by the RMSProp optimizer based on the following formula: Where Ht represents the exponentially weighted average of the squared gradient at the tth time step, β is the decay rate, which is usually set to 0.

9. represents the gradient of the loss function l, wt is the parameter value at the tth time step, and η is the learning rate, which is used to control the step size of parameter update.

6. A two-dimensional code quality detection method according to claim 1, characterized in that: Determining whether the quality of the target two-dimensional code image is qualified by the target indicator score, specifically including: For each quality evaluation index, the target index score of the target two-dimensional code image under the quality evaluation index is compared with a preset threshold to determine the magnitude relationship between the two; When the target indicator score corresponding to any of the quality evaluation indicators is less than the preset threshold, it is determined that the quality of the target two-dimensional code image is unqualified.

7. A two-dimensional code quality detection method according to claim 1, characterized in that: The quality indicators include symbol contrast, modulation ratio, axial non-uniformity, grid non-uniformity and inherent pattern corruption.

8. A two-dimensional code quality detection method according to claim 7, characterized in that: Based on the preset quality evaluation index, the quality of the two-dimensional code image is evaluated to obtain the initial index score of the two-dimensional code image under each quality evaluation index, specifically including: Obtaining the grayscale value corresponding to each pixel in the two-dimensional code image, determining the maximum grayscale value and the minimum grayscale value among the grayscale values, and determining the maximum reflectivity and the minimum reflectivity corresponding to the maximum grayscale value and the minimum grayscale value, respectively; The difference between the maximum reflectivity and the minimum reflectivity is used as the initial index score corresponding to the two-dimensional code image under the symbol contrast index; The initial index score corresponding to the modulation ratio index of the two-dimensional code image is calculated by the following formula: Among them, R is the module reflectivity in the QR code, GT is the overall threshold, and SC is the symbol contrast; The initial index score corresponding to the axial inconsistency index of the two-dimensional code image is calculated by the following formula: Among them, X AVG Indicates the average horizontal axis spacing, Y AVG represents the average vertical axial spacing; The initial index score corresponding to the two-dimensional code image under the grid inconsistency index is calculated by the following formula: Among them, x A ( i,j ) represents the x-coordinate value of the sampling point in the i-th row and j-th column, x B ( i,j ) represents the x-coordinate value of the theoretical sampling point in the i-th row and j-th column, and y A ( i,j ) represents the y coordinate value of the sampling point in the i-th row and j-th column, y B ( i,j ) represents the y-coordinate value of the theoretical sampling point in the i-th row and j-th column; An image area in the two-dimensional code image whose corresponding modulation ratio is lower than a preset modulation ratio threshold is determined, and an initial index score of the two-dimensional code image under the inherent graphic contamination index is obtained according to the area ratio of the image area in the two-dimensional code image.

9. A two-dimensional code quality detection device, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a two-dimensional code quality detection method as described in any one of claims 1-8.

10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to: A two-dimensional code quality detection method as described in any one of claims 1 to 8.

Citation Information

Cited By

  • Large-view-field two-dimensional code defect and quality grading real-time detection system

    CN121253566A