Training method and device of image enhancement model, computer device and storage medium
By determining the first and second quality evaluation parameters in the information code image enhancement model and adjusting the model parameters to generate the target model reward, the problem that general image enhancement methods cannot improve the information code decoding rate is solved, and efficient decoding of information code images is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN SMARTMORE TECH CO LTD
- Filing Date
- 2022-09-19
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, common image enhancement methods cannot effectively improve the probability of information code images being correctly decoded, resulting in the inability to successfully decode information when there are problems with the quality of the information code images.
By determining the first quality assessment parameter of the information code sample image, an enhanced information code image is generated using the initial enhancement model. Based on the difference between the decoding result and the second quality assessment parameter, a target model reward is generated. The parameters of the initial enhancement model are then adjusted to obtain the information code image enhancement model, thereby improving the decoding success rate in a targeted manner.
This effectively increases the probability of the information code image being correctly decoded, ensuring that the correct information can be successfully decoded even when there are quality issues with the information code image.
Smart Images

Figure CN116051393B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a training method, apparatus, computer device, and storage medium for an image enhancement model. Background Technology
[0002] An information code is a readable code generated by processing information through encoding technology, such as common one-dimensional barcodes and two-dimensional barcodes. Users can scan the information code image using a scanning device such as a smartphone to decode the information, such as account information, multimedia information, or advertising information.
[0003] The quality of the information code in the image directly determines whether the corresponding information can be decoded. When the scanned information code image has image quality problems for various reasons, such as blurry images or reflections, it will be impossible to successfully decode the information corresponding to the information code.
[0004] The main approach in related technologies is to use common image enhancement methods to improve the quality of the acquired information code images. However, this image enhancement method cannot effectively improve the probability of the information code being correctly decoded. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a training method, apparatus, computer device, and storage medium for an image enhancement model. The image enhancement model can perform image enhancement processing on information code images to facilitate the correct decoding of information, effectively increasing the probability that the information code is correctly decoded.
[0006] The embodiments of this application provide the following technical solutions:
[0007] Firstly, a training method for an image enhancement model is provided, including:
[0008] Determine the first quality assessment parameter for the information code in the sample image of the information code;
[0009] Based on the information code sample image and the first quality assessment parameters, an enhanced information code image corresponding to the information code sample image is generated through the initial enhancement model;
[0010] Determine the decoding result of the enhanced information code image and the second quality evaluation parameter for the information code in the enhanced information code image;
[0011] Based on the decoding results and the parameter differences between the first and second quality assessment parameters, a target model reward is generated.
[0012] The model parameters of the initial enhancement model are adjusted according to the target model reward to obtain the information code image enhancement model. The information code image enhancement model is used to perform image enhancement processing on the information code image to be processed that has not been successfully decoded.
[0013] Secondly, a training device for an image enhancement model is provided, comprising:
[0014] The first determining unit is used to determine the first quality assessment parameter for the information code in the information code sample image;
[0015] An enhancement unit is used to generate an enhanced information code image corresponding to the information code sample image based on the information code sample image and the first quality assessment parameters through an initial enhancement model.
[0016] The second determining unit is used to determine the decoding result of the enhanced information code image and the second quality evaluation parameter for the information code in the enhanced information code image;
[0017] The generation unit is used to generate the target model reward based on the decoding result and the parameter difference between the first quality assessment parameter and the second quality assessment parameter.
[0018] The adjustment unit is used to adjust the model parameters of the initial enhancement model according to the target model reward to obtain the information code image enhancement model. The information code image enhancement model is used to perform image enhancement processing on the information code image to be processed that has not been successfully decoded.
[0019] Thirdly, a computer device is provided, which includes a processor and a memory. The memory stores a computer program, and when the processor executes the computer program, it implements the steps in the above-mentioned training method for the image enhancement model.
[0020] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps in the above-described training method for the image enhancement model.
[0021] Fifthly, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps in the training method for the aforementioned image enhancement model.
[0022] As can be seen from the above technical solution, determining the first quality evaluation parameter for the information code in the information code sample image is crucial. Since the first quality evaluation parameter can quantify the quality of the information code in the information code sample image, it can serve as a guide for how to enhance the code quality during the process of image enhancement of the information code sample image using the initial enhancement model to obtain the corresponding enhanced information code image. After determining the decoding result of the enhanced information code image and the second quality evaluation parameter for the information code in the enhanced information code image, the parameter difference between the first and second quality evaluation parameters represents the enhancement direction and degree of the initial enhancement model on the information code. This decoding result can serve as a standard to measure whether the enhancement direction of the initial enhancement model on the information code sample image is reasonable. The target model reward generated by combining the above parameter difference and decoding result can serve as an accurate guide for adjusting the model parameters. The resulting information code image enhancement model can effectively improve the probability of the information code image being correctly decoded by performing image enhancement processing on the information code in the information code image that is conducive to decoding the correct information. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A flowchart illustrating a training method for an image enhancement model provided in this application embodiment;
[0025] Figure 2 A flowchart of the information code enhancement model training process provided in this application embodiment;
[0026] Figure 3 A flowchart illustrating the practical application of the information code image enhancement model provided in this application embodiment;
[0027] Figure 4 A schematic diagram of a training apparatus for an image enhancement model provided in another embodiment of this application;
[0028] Figure 5 A structural diagram of a terminal device provided in an embodiment of this application;
[0029] Figure 6 A structural diagram of a server provided in an embodiment of this application;
[0030] Figure 7 This is a schematic diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation
[0031] The embodiments of this application will now be described with reference to the accompanying drawings.
[0032] In practical applications of information code images, image quality issues can sometimes prevent successful decoding of the corresponding information. Related technologies primarily employ general image enhancement methods to improve image quality. While these general enhancement methods can improve image quality to some extent, they do not effectively increase the probability of successful decoding.
[0033] In view of this, embodiments of this application provide a training method, apparatus, computer device, and storage medium for an image enhancement model. The information code image enhancement model can perform image enhancement processing on information code images to facilitate the decoding of correct information, effectively increasing the probability that the information code is correctly decoded.
[0034] The following describes a training method for an image enhancement model provided in this application through method embodiments, such as... Figure 1 As shown, Figure 1 A flowchart illustrating a training method for an image enhancement model provided in this application embodiment, the method comprising the following steps:
[0035] S101, The computer equipment determines the first quality assessment parameter for the information code in the information code sample image.
[0036] Specifically, an information code refers to a readable code generated after information is processed through encoding technology, and the information generated by the information code can be decoded in a corresponding way.
[0037] An information code image refers to an image of an information code that carries an information code, which is obtained through a scanning device and used to decode and obtain the information that generated the information code. For example, an information code can be obtained by scanning the information code with a smartphone.
[0038] Information code sample images refer to the training samples of information code images used to determine the information code image enhancement model. In order to improve the generalization of the model, information code images can be blurred, reflected, or otherwise noise-added to obtain information code sample images. This allows the information code sample images to reflect various image quality problems of information code images in actual use, thereby improving the generalization degree of the information code image enhancement model determined based on the information code images.
[0039] The first quality assessment parameter is a quantitative assessment of the code quality of the information code in the information code sample image. This code quality is used to measure the quality of the part of the information code used for recognition and decoding. The quality of this part directly affects or even determines whether the information code can be successfully decoded. The embodiments of this application do not limit the dimensions from which the first quality assessment parameter quantifies the code quality of the information code. For example, it can be the display quality of the information code in the information code sample image, the clarity of key parts, etc.
[0040] Since the information code in the information code image is the part that plays a substantial role in the information code image (providing information through decoding), whether the information code can be successfully decoded is particularly important for the actual use of the information code image. Therefore, by determining the first quality evaluation parameter for the information code in the information code sample image in S101, the relevant quality of whether the information code can be successfully decoded can be quantitatively evaluated.
[0041] In some embodiments, the computer device determines a first quality assessment parameter for an information code in an information code sample image, including:
[0042] The computer device acquires an information code sample image and candidate region parameters. The candidate region parameters are used to identify the region where the information code is located in the information code sample image.
[0043] The computer device determines the first quality assessment parameter of the information code in the information code sample image corresponding to the image region identified by the candidate region parameter in the information code sample image.
[0044] In the process of decoding the information code image to obtain the information for generating the information code, since the information code image usually carries information unrelated to the information code, such as objects unrelated to the information code that may be scanned around the information code during the acquisition of the information code image, the position of the information code in the information code image can be identified first, and then the information code image after positioning can be decoded.
[0045] Based on this, the candidate region refers to the region in the information code image where the information code is located after the position of the information code in the information code image is identified. Correspondingly, the candidate region parameter is used to identify the region in the information code image where the information code is located.
[0046] As mentioned earlier, the first quality assessment parameter refers to the quantitative assessment of the code quality of the information code in the information code sample image. Therefore, the quantitative assessment of information unrelated to the information code carried in the information code sample image is not useful for determining the first quality assessment parameter, and may even reduce the reliability of the first quality assessment parameter. Therefore, the first quality assessment parameter corresponding to the information code can be accurately determined for the image region identified by the candidate region parameter in the information code sample image, that is, the region where the information code is located in the information code image.
[0047] In some embodiments, the first quality assessment parameter and the second quality assessment parameter are determined based on the target quality assessment dimension. In the actual use of information codes, information codes include multiple types to adapt to different application scenarios. In order for the first quality assessment parameter to accurately quantify and assess different types of information codes, the computer device can determine the information code type of the information code in the information code sample image; and determine the target quality assessment dimension corresponding to the information code type from the set of quality assessment dimensions.
[0048] Specifically, to adapt to different application scenarios, information codes include various types, including not only the common one-dimensional and two-dimensional barcodes, but also three-dimensional codes, four-dimensional codes, and so on. Three-dimensional codes can be simply referred to as two-dimensional codes with a layer of color image or other elements superimposed on them. Three-dimensional codes are more suitable for human-machine recognition applications than two-dimensional codes. Four-dimensional codes can be simply referred to as three-dimensional codes that change over time. Although four-dimensional codes cannot be printed and used, they carry a large amount of information.
[0049] The quality assessment dimension refers to the assessment dimension used to determine the first quality assessment parameter of the information code. For the different types of information codes mentioned above, it is obviously impossible to accurately obtain the corresponding first quality assessment parameter by using a uniform quality assessment dimension. Therefore, we can first determine the information code type of the information code in the information code sample image, and then determine the target quality assessment dimension that matches the information code type from the quality assessment dimension set, so as to accurately determine the first quality assessment parameter of the information code in the information code sample image based on the target quality assessment dimension.
[0050] It should be noted that corresponding quality assessment dimensions can be pre-set based on existing information code types to obtain a set of quality assessment dimensions; if it is necessary to assess a completely new information code type, the corresponding quality assessment dimensions can be added to the set of quality assessment dimensions.
[0051] In some embodiments, QR codes are a common type of information code with a wide range of applications. When the information code type is a QR code, the target quality assessment dimensions include at least one of the following: QR code area brightness difference, QR code area brightness modulation, axial non-uniformity, and grid non-uniformity.
[0052] Specifically, a QR code image refers to an image carrying a QR code, and a QR code region refers to the portion of the image containing the QR code within the candidate region.
[0053] The brightness difference of a QR code region is used to quantitatively evaluate the difference between the highest and lowest reflectivity within a QR code region. A QR code region exhibits two reflectivity states: bright and dark. The sufficiency of these states within the QR code region can affect whether the QR code can be successfully decoded. The brightness difference of the QR code region can be calculated by comparing the highest and lowest brightness values within the candidate region of the original grayscale image corresponding to the QR code. The original grayscale image refers to an image where white and black are divided into several levels of gray according to a logarithmic relationship.
[0054] Brightness modulation of QR code regions is used to quantitatively evaluate the reflectivity uniformity of bright and dark modules within a QR code region. Bright modules are those with a bright reflectivity, and dark modules are those with a dark reflectivity. In practical QR code use, factors such as printing growth (or loss), substrate optical characteristics, and printing inhomogeneity can reduce the difference between the reflectivity of modules in the QR code region and the global threshold. Insufficient brightness modulation in the QR code region may increase the likelihood of modules in the region being incorrectly identified as either dark or bright, thus affecting whether the QR code region can be successfully decoded. The reflectivity of each module in the QR code region needs to be determined based on the original grayscale image. Brightness modulation of the QR code region can be calculated as the ratio of twice the difference between the brightness value of each module and the global grayscale threshold to the brightness difference of the QR code region.
[0055] Axial non-uniformity is used to quantify the non-uniformity of the QR code scaling ratio in a QR code region. Because the scaling ratio of QR codes acquired from certain abnormal viewpoints may be uneven, this can reduce the readability of the QR code in that region, potentially affecting whether the QR code can be successfully decoded. In the process of decoding a QR code image to obtain the information for generating the QR code, the QR code region can be determined first, and then the decoding operation can be performed on the QR code within the located region. During the decoding operation, the decoding algorithm needs to obtain the intersection points of the partitioning networks of each module in the QR code region. Axial non-uniformity can be determined using the following formula:
[0056]
[0057] Where T represents axial non-uniformity, Xavg represents the average distance between intersections in the X-axis direction, and Yavg represents the average distance between intersections in the Y-axis direction.
[0058] Grid non-uniformity is used to quantitatively evaluate the maximum quality deviation between the intersection points determined by the decoding algorithm and their ideal theoretical positions. Grid non-uniformity represents the unevenness of the QR code within the grid in a QR code area, and this value may affect whether the QR code area can be successfully decoded. After the decoding algorithm determines the position of the intersection points, the actual position of the intersection point is compared with the ideal grid position of the same specification. The grid non-uniformity is calculated by dividing the maximum vector distance between the actual and theoretical positions of each intersection point by the theoretical grid cell size, where the theoretical grid is an equally spaced grid under the code system determined by the decoding algorithm.
[0059] In summary, the aforementioned QR code region brightness difference, QR code region brightness modulation, axial non-uniformity, and grid non-uniformity can, to a certain extent, quantify and evaluate the reflectivity and specification of QR codes under various conditions. That is, they can, to a certain extent, measure the quality of the part of the QR code that is being recognized and decoded. Therefore, when the information code type is a QR code, at least one of the following can be selected to determine the target quality evaluation dimension: QR code region brightness difference, QR code region brightness modulation, axial non-uniformity, and grid non-uniformity. In order to accurately determine the first quality evaluation parameter that reflects the quality of the QR code based on the target quality evaluation dimension, the target quality evaluation dimension can be used to determine the quality evaluation parameter.
[0060] S102. The computer equipment generates an enhanced information code image corresponding to the information code sample image through an initial enhancement model based on the information code sample image and the first quality assessment parameters.
[0061] The relevant technologies mainly use common image enhancement methods to improve the quality of information code images. Common image enhancement methods mainly enhance the image clarity. For example, image enhancement methods based on image contrast can effectively improve the image contrast, thereby improving the image clarity. However, without targeted enhancement of the code quality itself, improving the clarity of the information code image cannot effectively increase the probability of the information code being successfully decoded.
[0062] The initial enhancement model refers to an enhancement model that can perform targeted enhancement of the information code in the information code sample image based on the first quality assessment parameter.
[0063] The first quality assessment parameter in S101 refers to a quantitative assessment that reflects the quality of the information code, which is equivalent to providing guidance for the initial enhancement model on which dimensions to enhance the quality of the information code.
[0064] Therefore, under the guidance of the first quality assessment parameter, the initial enhancement model enhances the information code sample image to obtain an enhanced information code image. That is, the enhancement dimension of the information code by the initial enhancement model in S102 is determined based on the first quality assessment parameter, which can play a targeted role in improving the probability of the enhanced information code image being successfully decoded.
[0065] S103, The computer device determines the decoding result of the enhanced information code image and the second quality assessment parameters for the information code in the enhanced information code image.
[0066] Specifically, the decoding result of the enhanced information code image refers to the result after the information code in the enhanced information code image is decoded. It may be successful decoding, partial decoding, or decoding failure. As mentioned above, the essential function of the information code image is the information provided by the decoded information code. The purpose of enhancing the information code sample image is to increase the probability that the enhanced information code image will provide correct information after decoding. Therefore, the decoding result can reflect whether the information code sample image can meet the above purpose after being enhanced by the initial enhancement model. In turn, it can be used as a standard to measure whether the enhancement direction of the initial enhancement model for the information code sample image is reasonable.
[0067] Both the second quality assessment parameter and the aforementioned first quality assessment parameter are quality assessment parameters capable of quantitatively evaluating code quality. In other words, the second quality assessment parameter is a quantitative assessment of the code quality of the information code in the enhanced information code image. It is important to note that, in order to accurately represent the enhancement direction of the information code in the enhanced information code image relative to the information code in the sample information code image, the quality assessment dimensions of the first and second quality parameters should be consistent.
[0068] S104. The computer device generates a target model reward based on the decoding result and the parameter difference between the first quality assessment parameter and the second quality assessment parameter.
[0069] Specifically, model rewards refer to incentives generated for the model based on relevant metrics. They are mainly used in reinforcement learning, which involves real-time interaction with the environment and influences the environment through actions. Since there is no correct label in reinforcement learning to clearly determine which actions are good and which are bad, model incentives can be used to guide the actions of reinforcement learning.
[0070] Based on the foregoing explanation of the first quality assessment parameter and the second quality assessment parameter, the parameter difference between the first quality assessment parameter and the second quality assessment parameter can indicate the direction and degree of enhancement of the code quality of the information code sample image by using the initial enhancement model in S102. For example, through the initial enhancement model, which assessment dimensions are enhanced to what extent.
[0071] The decoding result reflects whether the information code sample image, after enhancement by the initial enhancement model, can be decoded correctly. It can serve as a standard to measure the rationality of the initial enhancement model's enhancement direction for the information code sample image. In other words, the decoding result reflects whether the initial enhancement model's enhancement direction for the information code is conducive to decoding the correct information. Therefore, based on this decoding result indicator and combined with parameter differences, a target model reward can be generated for the initial enhancement model. This target model reward accurately reflects whether the enhancement direction and degree of enhancement are reasonable for decoding the correct information. Thus, under the guidance of this target model reward, the initial enhancement model can be effectively adjusted so that its model parameters are adjusted in a direction conducive to decoding the correct information.
[0072] In some embodiments, the computer device generates a target model reward based on the decoding result and the parameter difference between the first quality assessment parameter and the second quality assessment parameter, including:
[0073] The computer equipment determines the target weight corresponding to the decoding result based on whether the decoding was successful, and the target weight is used to identify the degree of influence of parameter differences on the model reward.
[0074] The computer equipment determines the target model reward based on the target weight and the parameter differences between the first quality assessment parameter and the second quality assessment parameter.
[0075] Specifically, the target weight is used to identify the degree of influence of parameter differences on the model reward. The larger the target weight value, the greater the influence on the model reward. As mentioned earlier, parameter differences can represent the direction and degree of enhancement of the initial enhancement model on the code sample image. The decoding result can serve as a standard for whether the enhancement direction and degree are reasonable. The target weight can quantify the reasonableness of the enhancement direction and degree obtained from the decoding result. For example, the more reasonable the enhancement direction and degree represented by the parameter differences reflected in the decoding result, the larger the corresponding target weight value, and the greater the influence of parameter differences on the determined model reward. The target weight is used to quantify the reasonableness of the enhancement direction and degree reflected in the decoding result, so as to determine the target model reward based on the target weight and parameter differences.
[0076] In some embodiments, the computer device determines the target weight corresponding to the decoding result based on whether the decoding was successful, as indicated by the decoding result identifier, including:
[0077] In response to the decoding result indicating decoding failure, the computer device sets the weight value of the target weight corresponding to the decoding result as the first value; or,
[0078] In response to the decoding result indicating successful decoding, the computer device determines the weight value of the target weight corresponding to the decoding result as the second value, which is greater than the first value.
[0079] Specifically, as mentioned earlier, the decoding result serves as a standard for determining the reasonableness of the enhancement direction and degree. The target weight quantifies the reasonableness of the enhancement direction and degree reflected in the decoding result. When the decoding result indicates decoding failure, it means that the initial enhancement model's enhancement direction and degree cannot effectively enhance the likelihood that the information code image will provide correct information after decoding; that is, the enhancement direction and degree are relatively unreasonable. The corresponding first value of the target weight should be small to reduce the impact of the corresponding parameter differences on the model reward. When the decoding result indicates successful decoding, it means that the enhancement direction and degree are relatively reasonable. The corresponding second value of the target weight should be large to increase the impact of the corresponding parameter differences on the model reward. By setting a smaller first value of the target weight corresponding to decoding failure and a larger second value of the target weight corresponding to decoding success, the purpose of determining the corresponding target weight based on whether the decoding result indicates successful decoding is achieved.
[0080] In some embodiments, the information code sample image is generated based on target information, and the computer device determines the target weight corresponding to the decoding result based on whether the decoding was successful, as indicated by the decoding result identifier, including:
[0081] The computer device responds to the decoding result indicator that decoding was successful and receives pending information when decoding was successful.
[0082] Computer equipment determines the consistency between the information to be determined and the target information;
[0083] The computer equipment determines the weight value of the target weight corresponding to the decoding result based on the consistency level, and the weight value is positively correlated with the consistency level.
[0084] Specifically, the decoding result includes not only whether the decoding was successful, but also the consistency between the pending information and the target information obtained when the decoding was successful. The pending information refers to the information obtained after successful decoding, and the target information refers to the information generated by the information code.
[0085] In actual decoding, after successful decoding, the acquired pending information may not necessarily match the target information. Therefore, the consistency between the pending and target information reflects the rationality of the initial model's enhancement direction and degree. Higher consistency indicates a more reasonable enhancement direction and degree, and the target weight should be larger. Conversely, lower consistency indicates a less reasonable enhancement direction and degree, and the target weight should be smaller. In other words, the target weight is positively correlated with the degree of consistency. Determining the target weight corresponding to the decoding result by using the consistency between the pending and target information reflected in the decoding result allows for a more accurate quantification of the rationality of the enhancement direction and degree reflected in the decoding result, thereby generating a more accurate target model reward.
[0086] In some embodiments, the method further includes:
[0087] The computer equipment determines the original decoding result of the information code sample image;
[0088] The computer equipment determines the target weight corresponding to the decoding result based on whether the decoding was successful, including:
[0089] The computer device determines the target weight corresponding to the decoding result based on whether the decoding result identifier indicates successful decoding and whether the original decoding result identifier indicates successful decoding.
[0090] Although the information code sample images are training samples obtained after some noise processing of the information code images, the original decoding result of the information image samples may still be successfully decoded. If the original decoding result is successful, and the decoded result is also successful, then simply referring to the decoded result is insufficient to accurately analyze whether the corresponding enhancement direction and degree effectively enhance the likelihood that the information code image provides the correct information after decoding. Therefore, comprehensively analyzing the differences between the original decoding result and the decoded result can more accurately reflect the rationality of the enhancement direction and effect of the initial enhancement model, that is, to more accurately obtain the target weights corresponding to the decoded result.
[0091] S105. The computer equipment adjusts the model parameters of the initial enhancement model according to the target model reward to obtain the information code image enhancement model. The information code image enhancement model is used to perform image enhancement processing on the information code image to be processed that has not been successfully decoded.
[0092] Since the target model reward can adjust the initial augmentation model in a direction that favors decoding the correct information, the target model reward can serve as an accurate guide for adjusting the model parameters of the initial augmentation model to obtain an information code image augmentation model. This model can perform image augmentation processing on the information code in the information code image in a way that facilitates decoding the correct information. In other words, using this information code image augmentation model to perform image augmentation processing on the undecoded information code image can effectively increase the probability of the information code image being correctly decoded.
[0093] The following section explains the process for determining the information code enhancement model, such as... Figure 2 As shown, Figure 2 This is a flowchart illustrating the training process of the information code enhancement model provided in an embodiment of this application.
[0094] Obtain information code sample images; as mentioned before, in order to improve the generalization of the model, the information code images can be processed to obtain information code sample images.
[0095] The localization algorithm is used to identify the region where the information code is located in the information code sample image, and the candidate region parameter is used to identify the region where the information code is located in the information code image.
[0096] The quality assessment algorithm is used to assess the image region identified by the candidate region parameter in the information code sample image, and the first quality assessment parameter of the information code in the information code sample image is determined.
[0097] The enhancement model performs targeted enhancement on the image regions identified by the candidate region parameters in the information code sample image based on the first quality assessment parameter, resulting in an enhanced information code image.
[0098] The image regions identified by the candidate region parameters in the enhanced information code image are decoded to obtain the decoding results.
[0099] The quality assessment algorithm is used to evaluate the image region identified by the candidate region parameter in the enhanced information code image, and the second quality assessment parameter of the information code in the enhanced information code image is determined.
[0100] The enhanced image evaluation unit generates a target model reward for the enhanced model based on the decoding result, which is a standard for measuring whether the enhancement direction of the enhancement model to the information code sample image is reasonable, and in combination with the parameter difference between the first quality evaluation parameter and the second quality evaluation parameter.
[0101] Adjust the target model parameters of the augmented model based on the model reward, so that the augmented model is adjusted in a direction that is conducive to decoding the correct information.
[0102] In some embodiments, after determining the information code image enhancement model, the method further includes:
[0103] The computer device acquires an image of the information code to be processed, but the image of the information code to be processed is not successfully decoded.
[0104] The computer equipment performs image enhancement processing based on the image of the information code to be processed, using the information code image enhancement model, to obtain the corresponding enhanced image;
[0105] The computer device decodes the enhanced image to obtain the information corresponding to the image of the information code to be processed.
[0106] For the image containing the information code to be processed, image enhancement processing can be performed using an information code image enhancement model to obtain the corresponding enhanced image. Specifically, such as... Figure 3 As shown, Figure 3 A flowchart illustrating the practical application of the information code image enhancement model provided in this application embodiment.
[0107] In the actual process of decoding an information code image to obtain the information used to generate the information code, the position of the information code in the image can be identified first, and then the image after positioning can be decoded. Figure 3 A portion of the information code images can be successfully decoded directly, yielding the decoding result without enhancement processing. Another portion of the information code images cannot be successfully decoded; these undecoded information code images are the information code images to be processed. After decoding failure, the information code images to be processed are first evaluated by a quality assessment algorithm to obtain the corresponding quality assessment parameters. Then, an enhancement model enhances the information code images to be processed based on these quality assessment parameters, resulting in the enhanced image. It is important to note that the enhancement model used in practice is an adjusted information code image enhancement model based on the initial enhancement model. This model can perform image enhancement processing on the information codes in the information code images to be processed, which is conducive to decoding the correct information. Finally, the information codes in the enhanced information code images to be processed located in the candidate region parameters are decoded again. By applying the information code enhancement model determined in this application to the undecoded information code images to be processed, image enhancement processing is performed on the information code images to be processed, which is conducive to decoding the correct information, effectively increasing the probability of the information code images being correctly decoded.
[0108] In summary, this application provides a method for determining an information code image enhancement model. It determines a first quality assessment parameter for the information code in an information code sample image. Since this first quality assessment parameter can quantify the quality of the information code in the sample image, it serves as a guide for enhancing the information code quality during the process of enhancing the information code sample image using an initial enhancement model to obtain the corresponding enhanced information code image. After determining the decoding result of the enhanced information code image and the second quality assessment parameter for the information code in the enhanced image, the parameter difference between the first and second quality assessment parameters represents the enhancement direction and degree of the initial enhancement model. This decoding result can serve as a standard to measure whether the enhancement direction of the initial enhancement model for the information code sample image is reasonable. The target model reward generated by combining the above parameter difference and decoding result can serve as an accurate guide for adjusting the model parameters. The resulting information code image enhancement model can effectively improve the probability of the information code image being correctly decoded by performing image enhancement processing on the information code in the information code image that is conducive to decoding the correct information.
[0109] The following describes a training apparatus for an image enhancement model provided in this application through an embodiment of the apparatus. Figure 4 As shown, Figure 4 This is a schematic diagram of a training apparatus for an image enhancement model according to another embodiment of this application. The apparatus includes:
[0110] The first determining unit 401 is used to determine the first quality assessment parameter for the information code in the information code sample image;
[0111] Enhancement unit 402 is used to generate an enhanced information code image corresponding to the information code sample image based on the information code sample image and the first quality assessment parameters through an initial enhancement model;
[0112] The second determining unit 403 is used to determine the decoding result of the enhanced information code image and the second quality evaluation parameters for the information code in the enhanced information code image;
[0113] The generation unit 404 is used to generate a target model reward based on the decoding result and the parameter difference between the first quality assessment parameter and the second quality assessment parameter.
[0114] The adjustment unit 405 is used to adjust the model parameters of the initial enhancement model according to the target model reward to obtain the information code image enhancement model. The information code image enhancement model is used to perform image enhancement processing on the information code image to be processed that has not been successfully decoded.
[0115] In some embodiments, in generating the target model reward based on the decoding result and the parameter difference between the first quality assessment parameter and the second quality assessment parameter, the generation unit 404 is specifically used for:
[0116] Based on whether the decoding was successful, the target weight corresponding to the decoding result is determined. The target weight is used to identify the degree of influence of parameter differences on the model reward.
[0117] The target model reward is determined based on the target weight and the parameter differences between the first quality assessment parameter and the second quality assessment parameter.
[0118] In some embodiments, in determining the target weight corresponding to the decoding result based on whether the decoding was successful, the generation unit 404 is specifically used for:
[0119] In response to the decoding result indicating decoding failure, the weight value of the target weight corresponding to the decoding result is set to the first value; or,
[0120] In response to the decoding result indicating successful decoding, the weight value of the target weight corresponding to the decoding result is determined as the second value, which is greater than the first value.
[0121] In some embodiments, the information code sample image is generated based on target information. Regarding determining the target weight corresponding to the decoding result based on whether the decoding was successful (identified by the decoding result), the generation unit 404 is specifically used for:
[0122] In response to the decoding result indicating successful decoding, the pending information for successful decoding is obtained;
[0123] Determine the consistency between the information to be determined and the target information;
[0124] The weight value of the target weight corresponding to the decoding result is determined based on the consistency level, and the weight value is positively correlated with the consistency level.
[0125] In some embodiments, the training apparatus for the image enhancement model further includes a third determining unit for determining the original decoding result of the information code sample image.
[0126] In determining the target weight corresponding to the decoding result based on whether the decoding was successful, the generation unit 404 is specifically used for:
[0127] The target weight corresponding to the decoding result is determined based on whether the decoding of the decoding result identifier was successful and whether the decoding of the original decoding result identifier was successful.
[0128] In some embodiments, the first quality assessment parameter and the second quality assessment parameter are determined based on the target quality assessment dimension. The training device for the image enhancement model further includes a fourth determining unit, used to determine the information code type of the information code in the information code sample image; and to determine the target quality assessment dimension corresponding to the information code type from the set of quality assessment dimensions.
[0129] In some embodiments, when the information code type is a QR code, the target quality assessment dimension includes at least one of the following: QR code area brightness difference, QR code area brightness modulation, axial non-uniformity, and grid non-uniformity.
[0130] In some embodiments, the first determining unit 401 is specifically configured to: determine a first quality assessment parameter for an information code in an information code sample image;
[0131] Obtain the information code sample image and candidate region parameters. The candidate region parameters are used to identify the region where the information code is located in the information code sample image.
[0132] Based on the image region identified by the candidate region parameter in the information code sample image, determine the first quality assessment parameter of the information code in the information code sample image corresponding to the image region.
[0133] In some embodiments, the training apparatus for the image enhancement model further includes a processing unit for acquiring an information code image to be processed, wherein the information code image to be processed has not been successfully decoded; performing image enhancement processing on the information code image to be processed using the information code image enhancement model to obtain a corresponding enhanced image; and decoding the enhanced image to obtain information corresponding to the information code image to be processed.
[0134] The image enhancement model training method provided in this application can be implemented using a computer device, which can be a terminal device or a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitations on this connection.
[0135] This application also provides a computer device, which is the computer device described above and may include a terminal device or a server. The computer device will now be described in conjunction with the accompanying drawings.
[0136] If the computer device is a terminal device, please refer to Figure 5 As shown, this application provides a terminal device, taking a mobile phone as an example:
[0137] Figure 5 This diagram illustrates a partial structural representation of a mobile phone related to the terminal device provided in this embodiment. (Reference) Figure 5 The mobile phone includes components such as a radio frequency (RF) circuit 1410, a memory 1420, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a Wi-Fi module 1470, a processor 1480, and a power supply 1490. Those skilled in the art will understand that... Figure 5 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0138] The following is combined Figure 5 A detailed introduction to each component of a mobile phone:
[0139] The RF circuit 1410 can be used to receive and transmit signals during information transmission or calls. In particular, it receives downlink information from the base station and processes it with the processor 1480; in addition, it transmits uplink data to the base station.
[0140] The memory 1420 can be used to store software programs and modules. The processor 1480 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1420. The memory 1420 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0141] The input unit 1430 can be used to receive input numeric or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1430 may include a touch panel 1431 and other input devices 1432.
[0142] The display unit 1440 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1440 may include a display panel 1441.
[0143] The mobile phone may also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors.
[0144] Audio circuitry 1460, speaker 1461, and microphone 1462 provide an audio interface between the user and the mobile phone.
[0145] WiFi is a short-range wireless transmission technology. Through the WiFi module 1470, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access.
[0146] The processor 1480 is the control center of the mobile phone. It connects to various parts of the mobile phone through various interfaces and lines. It performs various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 1420 and calling data stored in the memory 1420.
[0147] The mobile phone also includes a power supply 1490 (such as a battery) that powers the various components.
[0148] In some embodiments, the processor 1480 included in the terminal device further has the following functions:
[0149] Determine the first quality assessment parameter for the information code in the sample image of the information code;
[0150] Based on the information code sample image and the first quality assessment parameters, an enhanced information code image corresponding to the information code sample image is generated through the initial enhancement model;
[0151] Determine the decoding result of the enhanced information code image and the second quality evaluation parameter for the information code in the enhanced information code image;
[0152] Based on the decoding results and the parameter differences between the first and second quality assessment parameters, a target model reward is generated.
[0153] The model parameters of the initial enhancement model are adjusted according to the target model reward to obtain the information code image enhancement model. The information code image enhancement model is used to perform image enhancement processing on the information code image to be processed that has not been successfully decoded.
[0154] If the computer device is a server, this application embodiment also provides a server; please refer to [link to relevant documentation]. Figure 6 As shown, Figure 6This is a structural diagram of a server 1500 provided in an embodiment of this application. The server 1500 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1522 (e.g., one or more processors) and a memory 1532, and one or more storage media 1530 (e.g., one or more mass storage devices) for storing application programs 1542 or data 1544. The memory 1532 and storage media 1530 can be temporary or persistent storage. The program stored in the storage media 1530 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 1522 may be configured to communicate with the storage media 1530 and execute the series of instruction operations in the storage media 1530 on the server 1500.
[0155] Server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input / output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0156] The steps performed by the server in the above embodiments can be based on Figure 6 The server structure shown.
[0157] In addition, embodiments of this application also provide a computer-readable storage medium, such as... Figure 7 As shown, Figure 7 This is a structural diagram of a computer-readable storage medium provided in an embodiment of this application. A computer program 920 is stored in the computer-readable storage medium 900. When the computer program is executed by a processor, it implements the steps in the method provided in the above embodiment.
[0158] This application also provides a computer program product, which, when executed by a processor, implements the steps in the methods provided in the above embodiments.
[0159] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk, or optical disk, etc., and other media capable of storing program code.
[0160] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0161] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Moreover, based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A training method for an image enhancement model, characterized in that, include: Obtain an information code sample image and candidate region parameters, wherein the candidate region parameters are used to identify the region where the information code is located in the information code sample image; Based on the image region identified by the candidate region parameter in the information code sample image, determine the first quality evaluation parameter of the information code in the information code sample image corresponding to the image region; Based on the information code sample image and the first quality assessment parameter, an enhanced information code image corresponding to the information code sample image is generated through an initial enhancement model; Determine the decoding result of the enhanced information code image and the second quality assessment parameter for the information code in the enhanced information code image, wherein the first quality assessment parameter and the second quality assessment parameter are determined based on the target quality assessment dimension; Based on whether the decoding was successful, the target weight corresponding to the decoding result is determined. The target weight is used to identify the degree of influence of parameter differences on the model reward. Based on the target weight, the parameter difference between the first quality assessment parameter and the second quality assessment parameter, the target model reward is determined; the model parameters of the initial enhancement model are adjusted according to the target model reward to obtain the information code image enhancement model, which is used to perform image enhancement processing on the undecoded information code image to be processed. The target quality assessment dimensions were determined in the following manner: Determine the information code type of the information code in the information code sample image; From the set of quality assessment dimensions, determine the target quality assessment dimension corresponding to the information code type.
2. The method according to claim 1, characterized in that, The step of determining the target weight corresponding to the decoding result based on whether the decoding was successful, as indicated by the decoding result identifier, includes: In response to the decoding result indicating decoding failure, the weight value of the target weight corresponding to the decoding result is determined to be a first value; or, In response to the decoding result indicating successful decoding, the weight value of the target weight corresponding to the decoding result is determined as a second value, which is greater than the first value.
3. The method according to claim 1, characterized in that, The information code sample image is generated based on the target information. Determining the target weight corresponding to the decoding result based on whether the decoding was successful, as indicated by the decoding result, includes: In response to the decoding result indicating successful decoding, pending information is obtained when decoding is successful. Determine the consistency between the pending information and the target information; The weight value of the target weight corresponding to the decoding result is determined based on the magnitude of the consistency, and the weight value is positively correlated with the magnitude of the consistency.
4. The method according to claim 1, characterized in that, The method further includes: Determine the original decoding result of the information code sample image; The step of determining the target weight corresponding to the decoding result based on whether the decoding was successful, as indicated by the decoding result identifier, includes: The target weight corresponding to the decoding result is determined based on whether the decoding of the decoding result identifier was successful and whether the decoding of the original decoding result identifier was successful.
5. The method according to claim 1, characterized in that, When the information code type is a QR code, the target quality assessment dimension includes at least one of the following: QR code area brightness difference, QR code area brightness modulation, axial non-uniformity, and grid non-uniformity.
6. The method according to claim 1, characterized in that, The method further includes: The image of the information code to be processed was obtained, but the image of the information code to be processed was not successfully decoded. Based on the information code image to be processed, image enhancement processing is performed through the information code image enhancement model to obtain the corresponding enhanced image; The enhanced image is decoded to obtain the information corresponding to the information code image to be processed.
7. A training device for an image enhancement model, characterized in that, include: The first determining unit is used to acquire an information code sample image and candidate region parameters, wherein the candidate region parameters are used to identify the region where the information code is located in the information code sample image. Based on the image region identified by the candidate region parameter in the information code sample image, determine the first quality evaluation parameter of the information code in the information code sample image corresponding to the image region; The enhancement unit is configured to generate an enhanced information code image corresponding to the information code sample image based on the information code sample image and the first quality assessment parameters using an initial enhancement model. The second determining unit is used to determine the decoding result of the enhanced information code image and the second quality evaluation parameter for the information code in the enhanced information code image, wherein the first quality evaluation parameter and the second quality evaluation parameter are determined based on the target quality evaluation dimension. The generation unit is used to determine the target weight corresponding to the decoding result based on whether the decoding was successful, and the target weight is used to identify the degree of influence of parameter differences on the model reward. The target model reward is determined based on the target weight, the parameter difference between the first quality assessment parameter and the second quality assessment parameter; An adjustment unit is used to adjust the model parameters of the initial enhancement model according to the target model reward to obtain an information code image enhancement model, which is used to perform image enhancement processing on the undecoded information code image to be processed. The fourth determining unit is used to determine the information code type of the information code in the information code sample image; and to determine the target quality assessment dimension corresponding to the information code type from the quality assessment dimension set.
8. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-6.