License plate generation method and device, nonvolatile storage medium and computer device
Patent Information
- Application Number
- CN202211587607.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-09
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2042-12-09
AI Technical Summary
[0005]本发明实施例提供了一种车牌生成方法、装置、非易失性存储介质和计算机设备,以至少解决由于现有技术中生成的车牌的特征不确定性高且可解释性差的技术问题
[0018]在本发明实施例中,通过获取待生成车牌的特征信息;获取待生成车牌的特征信息;根据特征信息,确定解码器待输入的特征参数的多个维度参数中包括的目标维度参数的参数值,其中,解码器为预先训练的解耦表征学习模型中的解码器,特征参数的多个维度参数分别表征待生成车牌的多个特征,解耦表征学习模型为通过调整损失函数中超参数的值使特征参数的多个维度参数间的耦合度符合预定标准的模型,目标维度参数的参数值用于表征特征信息;确定特征参数的多个维度参数包括的除目标维度参数以外的待定维度参数的第一参数值;将第一参数值和目标维度参数的参数值输入解码器,生成目标车牌,达到了根据控制多个特征参数的值控制生成车牌的特征的目的,从而实现了根据特征信息生成具有对应特征的车牌的技术效果,进而解决了由于现有技术中生成的车牌的特征不确定性高且可解释性差的技术问题。
Smart Images

Figure CN116110033B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more specifically, to a method, apparatus, non-volatile storage medium, and computer device for generating license plates. Background Technology
[0002] With the continuous development of deep learning technology, it has been widely applied in various fields, improving our lives and work. However, deep learning often requires a large amount of sample data; data is, in essence, a prerequisite for deep learning. Currently, deep learning-based vehicle license plate detection is already used in our daily lives, and the development and application of these technologies all require a large number of license plate samples for training. Since license plates vary across provinces and cities in my country, collecting and labeling a large number of license plate samples is a massive undertaking. Based on this reality and demand, manually generated license plate data has become widely used.
[0003] Existing technologies use generative adversarial networks (GANs) to generate license plate images. This method can generate license plate images in batches and can produce images with different styles that resemble real license plates. However, the style and content of the generated license plates are not under human control, resulting in too much uncertainty.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a license plate generation method, apparatus, non-volatile storage medium, and computer device to at least solve the technical problem of high uncertainty and poor interpretability of license plate features generated in the prior art.
[0006] According to one aspect of the present invention, a license plate generation method is provided, comprising: acquiring feature information of a license plate to be generated; determining, based on the feature information, the parameter value of a target dimension parameter included in a plurality of dimension parameters of feature parameters to be input to a decoder, wherein the decoder is a decoder in a pre-trained decoupled representation learning model, the plurality of dimension parameters of the feature parameters respectively represent a plurality of features of the license plate to be generated, the decoupled representation learning model is a model that adjusts the values of hyperparameters in a loss function to make the coupling degree between the plurality of dimension parameters of the feature parameters conform to a predetermined standard, and the parameter value of the target dimension parameter is used to represent the feature information; determining a first parameter value of a dimension parameter to be determined other than the target dimension parameter included in the plurality of dimension parameters of the feature parameters; and inputting the first parameter value and the parameter value of the target dimension parameter into the decoder to generate the target license plate.
[0007] Optionally, the pre-trained decoupled representation learning model is a model trained through the following steps: obtaining a training dataset, wherein the training dataset includes multiple license plate samples; training the original model of the decoupled representation learning model based on the training dataset to determine the decoupled representation learning model, wherein the decoupled representation learning model includes multiple dimensional parameters of the feature parameters determined through training.
[0008] Optionally, training the original model based on the training dataset to determine the decoupled representation learning model includes: obtaining hyperparameter values of hyperparameters and determining the original model based on the hyperparameter values, wherein the hyperparameters are located in the loss function of the original model; training the original model based on the training dataset to obtain a training model, wherein the training model includes multiple dimensions of feature parameters; and determining the training model as a decoupled representation learning model if the coupling degree of the multiple dimensions of feature parameters included in the training model reaches a predetermined standard.
[0009] Optionally, the loss function for training the model is:
[0010]
[0011] Among them, L β-TC Let z be the loss function, z be the feature parameters, and j be the dimension of the feature parameters. j Let be the j-th dimension parameter of the feature parameters, n be the samples in the training dataset, KL(||) be the KL divergence function, p(n) be the distribution of the samples, q(n) be the distribution of the samples approximated by the mathematical model, and L β-TC The third item is the overall correlation item.
[0012] Optionally, before determining the training model as a decoupled representation learning model when the coupling degree of multiple undetermined parameters included in the training model reaches a predetermined standard, the method further includes: determining the value of the total correlation term in the loss function; determining the coupling degree of multiple dimensions of the feature parameters based on the value of the total correlation term, wherein the coupling degree characterizes the degree of mutual influence between the multiple dimensions of the feature parameters; and determining that the coupling degree of the multiple dimensions of the feature parameters reaches the predetermined standard when the coupling degree is less than a predetermined first threshold.
[0013] Optionally, determining the training model as a decoupled representation learning model includes: adjusting the values of multiple dimensions of the feature parameters to the second parameter value to obtain the license plate image output by the training model; determining the image quality of the license plate image; and determining the training model as a decoupled representation learning model when the image quality is greater than a predetermined second threshold.
[0014] Optionally, determining the image quality of the license plate image includes: determining the average gradient and entropy of the license plate image, wherein the average gradient characterizes the image sharpness and the entropy characterizes the amount of information contained in the license plate image; and determining the image quality based on the average gradient and entropy of the license plate image.
[0015] According to another aspect of the present invention, a license plate generation apparatus is also provided, comprising: an acquisition module for acquiring feature information of a license plate to be generated; a first determination module for determining, based on the feature information, the parameter value of a target dimension parameter included in a plurality of dimension parameters of feature parameters to be input to a decoder, wherein the decoder is a decoder in a pre-trained decoupled representation learning model, the plurality of dimension parameters of the feature parameters respectively represent a plurality of features of the license plate to be generated, the decoupled representation learning model is a model that adjusts the value of the hyperparameter in the loss function to make the coupling degree between the plurality of dimension parameters of the feature parameters conform to a predetermined standard, and the parameter value of the target dimension parameter is used to represent the feature information; a second determination module for determining a first parameter value of the undetermined dimension parameters other than the target dimension parameter included in the plurality of dimension parameters of the feature parameters; and a generation module for inputting the first parameter value and the parameter value of the target dimension parameter into the decoder to generate a target license plate.
[0016] According to another aspect of the present invention, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored program, wherein, when the program is running, the device where the non-volatile storage medium is located is controlled to execute any of the above-described license plate generation methods.
[0017] According to another aspect of the present invention, a computer device is also provided, the computer device including a processor, the processor being configured to run a program, wherein the program executes any of the above-described license plate generation methods during runtime.
[0018] In this embodiment of the invention, the following steps are taken: First, the feature information of the license plate to be generated is obtained. Then, based on the feature information, the parameter value of the target dimension parameter, which is included in the multiple dimension parameters of the feature parameters to be input to the decoder, is determined. The decoder is a decoder in a pre-trained decoupled representation learning model. The multiple dimension parameters of the feature parameters represent multiple features of the license plate to be generated. The decoupled representation learning model is a model that adjusts the values of hyperparameters in the loss function to make the coupling degree between the multiple dimension parameters of the feature parameters conform to a predetermined standard. The parameter value of the target dimension parameter is used to represent the feature information. Next, the first parameter value of the undetermined dimension parameters, excluding the target dimension parameter, is determined. Finally, the first parameter value and the parameter value of the target dimension parameter are input to the decoder to generate the target license plate. This achieves the goal of controlling the generated license plate features based on the values of multiple feature parameters, thereby realizing the technical effect of generating a license plate with corresponding features based on feature information. This solves the technical problem of high feature uncertainty and poor interpretability of license plates generated in the prior art. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0020] Figure 1 A hardware structure block diagram of a computer terminal for implementing a license plate generation method is shown.
[0021] Figure 2 This is a flowchart illustrating the license plate generation method provided in an embodiment of the present invention;
[0022] Figure 3 This is a network structure diagram of the decoupled identifier learning model provided by an optional embodiment of the present invention;
[0023] Figure 4 This is a structural block diagram of a license plate generation device provided according to an optional embodiment of the present invention. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] According to an embodiment of the present invention, a method for generating license plates is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0027] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a license plate generation method is shown. Figure 1 As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0028] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element in the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).
[0029] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the license plate generation method in this embodiment of the invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the license plate generation method of the aforementioned application. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0030] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.
[0031] Figure 2 This is a flowchart illustrating the license plate generation method provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the method includes the following steps:
[0032] Step S202: Obtain the feature information of the license plate to be generated.
[0033] In training neural network models related to license plate recognition, a large number of license plate images are typically required as sample data input. However, collecting diverse license plate images before training is challenging. Various methods can be used to obtain license plate images. This invention provides a method for generating license plate images that can generate corresponding license plate images according to different needs. (License plate image and license plate are mentioned.)
[0034] In this step, when generating a license plate image using the method provided by this invention, it is first necessary to obtain the feature information of the license plate to be generated. The license plate to be generated is the license plate that needs to be generated this time. The features of the license plate to be generated are the features of the license plate to be generated this time, such as the background color, characters, style, etc. The feature information is the information describing the features of the license plate, such as the background color of the license plate being blue, and the characters being Chinese characters, etc. Before generating the license plate, it is necessary to determine what features the license plate needs to have this time; the requirements for the license plate features are the feature information of the license plate to be generated.
[0035] Step S204: Based on the feature information, determine the parameter value of the target dimension parameter included in the multiple dimension parameters of the feature parameters to be input to the decoder. Here, the decoder is the decoder in the pre-trained decoupled representation learning model, the multiple dimension parameters of the feature parameters represent multiple features of the license plate to be generated, the decoupled representation learning model is a model that adjusts the value of the hyperparameter in the loss function to make the coupling degree between the multiple dimension parameters of the feature parameters meet the predetermined standard, and the parameter value of the target dimension parameter is used to represent the feature information.
[0036] In this step, a decoupled representation learning model is provided that can generate license plate images. The encoder of the decoupled representation learning model can extract a feature parameter from the training samples. This feature parameter includes multiple different dimensional parameters. The decoder can generate a license plate image based on the multiple dimensional parameters of the feature parameter. The encoder and decoder of the decoupled representation learning model can be trained together. The multiple dimensional parameters of the feature parameter can be parameters extracted from the training samples that control different features in the generated license plate image. When the hyperparameter values in the loss function of the decoupled representation learning model are inappropriate, there is a strong coupling between the multiple dimensional parameters of the feature parameter extracted by the decoder. That is, the values of the multiple dimensional parameters of the feature parameter influence each other, and each dimensional parameter controls more than one feature in the generated license plate image. In this case, the decoupling degree between the multiple dimensional parameters of the feature parameter extracted by the decoupled representation learning model is low, and the coupling degree is high.
[0037] After training the decoupled representation learning model, only the decoder is applied. Multiple numerical values are input as the values of the multiple dimensions of the feature parameters into the decoder. A successfully trained decoder will generate a license plate image based on the values of these multiple dimensions. The hyperparameter values in the loss function of a successfully trained decoupled representation learning model are appropriate. Appropriate hyperparameters ensure that the coupling between the multiple dimensions of the feature parameters in the decoupled representation learning model meets a predetermined standard. Ideally, in the most successful decoupled representation learning model, each dimension parameter controls one feature in the generated license plate image. However, in general, there is still coupling between the multiple dimensions of the feature parameters. The goal is to minimize this coupling, ensuring it meets the predetermined standard so that each dimension parameter primarily controls one feature in the license plate image and minimizes its impact on other features. In other words, the multiple dimensions of the feature parameters should ideally correspond one-to-one with the features they control.
[0038] The feature parameters include multiple dimensions, including the target dimension parameter. The target dimension parameter controls the features of the license plate to be generated, which are determined beforehand. After determining the feature information of the license plate to be generated, the value of the target dimension parameter needs to be adjusted according to the feature information.
[0039] Step S206: Determine the first parameter value of the undetermined dimension parameters, excluding the target dimension parameter, among the multiple dimension parameters of the feature parameters.
[0040] In this step, the multiple dimensions of the feature parameters include target dimension parameters and undetermined dimension parameters. When generating a license plate image, the value of the target dimension parameter is needed, as well as the value of each of the undetermined dimension parameters. After determining the value of the target dimension parameter, it can be assumed that the features controlled by the target dimension parameter in the generated license plate image are also determined. However, other features in the license plate image may be controlled by other undetermined dimension parameters. In this case, you can choose to randomly generate the values of the other undetermined dimension parameters as the first parameter value, or you can determine the values of the other undetermined dimension parameters as the first parameter value within a given range.
[0041] Step S208: Input the first parameter value and the target dimension parameter value into the decoder to generate the target license plate.
[0042] In this step, the parameter values of multiple undetermined dimension parameters, namely the first parameter value and the target dimension parameter value, are input into the decoder. The decoder then generates the target license plate based on the corresponding parameter values of the multiple dimension parameters of the feature parameters. The target license plate will include the features required for the license plate generated this time.
[0043] Through the above steps, the goal of generating license plate features can be achieved by controlling the values of multiple dimensions of the control feature parameters. This realizes the technical effect of generating license plates with corresponding features based on feature information, thereby solving the technical problem of high uncertainty and poor interpretability of license plate features generated in the prior art.
[0044] As an optional embodiment, the pre-trained decoupled representation learning model is a model trained through the following steps: obtaining a training dataset, wherein the training dataset includes multiple license plate samples; training the original model of the decoupled representation learning model based on the training dataset to determine the decoupled representation learning model, wherein the decoupled representation learning model includes multiple dimensional parameters of the feature parameters determined through training.
[0045] Optionally, when applying the decoupled representation learning model to actually generate license plates, the decoupled representation learning model used is a pre-trained model, so it can be directly applied and achieves the technical effect of generating license plates with corresponding features based on feature information. The model training process includes training the original model of the decoupled representation learning model using a training dataset, and finally obtaining a well-trained model with good performance as the decoupled representation learning model for application. The characteristics of a well-performing model are that it has multiple good dimensional parameters of the feature parameters determined through training. The training dataset can consist of multiple license plate samples, which can include images of different types of license plates.
[0046] As an optional implementation, training the original model based on the training dataset to determine the decoupled representation learning model can be achieved through the following steps: obtaining the hyperparameter values of the hyperparameters and determining the original model based on the hyperparameter values, wherein the hyperparameters are located in the loss function of the original model; training the original model based on the training dataset to obtain the training model, wherein the training model includes multiple dimensions of the feature parameters; and determining the training model as the decoupled representation learning model when the coupling degree of the multiple dimensions of the feature parameters included in the training model reaches a predetermined standard.
[0047] Optionally, when training the original model using the training dataset, the values of the hyperparameters in the loss function are first determined, and the original model learns the features of the training dataset based on the determined loss function. After determining the hyperparameters and the corresponding loss function, training is considered complete once the loss function stabilizes. The trained original model can then extract multiple dimensions of the feature parameters from the training dataset. At this point, the trained original model can be tested. If the test passes, the trained original model is determined to be an applicable decoupled representation learning model; if the test fails, the trained original model is discarded, and a new hyperparameter value can be obtained and the corresponding loss function determined. The original model is then trained based on the newly determined loss function. After the new loss function stabilizes, the original model trained according to the new loss function is tested to see if it meets the standard. Testing the trained original model is equivalent to testing whether the coupling degree of the multiple dimensions of the feature parameters extracted by the training model from the training sample set reaches a predetermined standard. If the coupling degree of the multiple dimensions of the feature parameters reaches the predetermined standard, the test passes; if the coupling degree of the multiple dimensions of the feature parameters does not reach the predetermined standard, the test fails.
[0048] As an optional implementation, the loss function for training the model is:
[0049]
[0050] Among them, L β-TC Let z be the loss function, z be the feature parameters, and j be the dimension of the feature parameters. j Let be the j-th dimension parameter of the feature parameters, n be the samples in the training dataset, KL(||) be the KL divergence function, p(n) be the distribution of the samples, q(n) be the distribution of the samples approximated by the mathematical model, and L β-TC The third item is the overall correlation item.
[0051] Optionally, the first term in the loss function is the reconstruction term, which characterizes the imaging quality of the generated image. A smaller value for the reconstruction term indicates better image quality. The second term in the loss function is called index-code mutual information (MI). Index-code MI is the mutual information I between data variables and feature parameters based on the empirical data distribution q(z,n). q(z;n), where q(z,n) can be written as q(n), representing the distribution of the samples approximated by the mathematical model. α, β, and γ are adjustable hyperparameters in the loss function. q(n|z) can characterize the encoder of the decoupled representation learning model, and q(z|n) can characterize the decoder. Some argue that higher mutual information leads to better disentanglement, and some even propose completely reducing the penalty for this term during optimization. Recent research on generative modeling also claims that penalizing mutual information through information bottlenecks can better encourage the generation of compact and disentangled representations. The third term of the loss function is called the total correlation term (TC), which is one of many generalizations of mutual information to two or more random variables. It is essentially a measure of the dependency between variables. Penalizing the TC term forces the model to find statistically independent factors in the data distribution. A heavier penalty to the TC term leads to a less entangled representation, which is why β-VAE is successful. The fourth term of the loss function is the dimension-level KL function term. This mainly prevents the latent dimension of individuals from deviating from the corresponding prior. As a complexity penalty for aggregate posterior, it reasonably follows ELBO's minimum description length formula.
[0052] As an optional embodiment, before determining the training model as a decoupled representation learning model, if the coupling degree of the multiple undetermined parameters included in the training model reaches a predetermined standard, the following steps can also be taken: determining the value of the total correlation term in the loss function; determining the coupling degree of multiple dimensions of the feature parameters based on the value of the total correlation term, wherein the coupling degree characterizes the degree of mutual influence between the multiple dimensions of the feature parameters; and determining that the coupling degree of the multiple dimensions of the feature parameters reaches the predetermined standard when the coupling degree is less than a predetermined first threshold.
[0053] Optionally, the coupling degree between multiple dimensions of the feature parameters extracted by the trained model can be determined through various methods. The scheme provided in this embodiment is to determine the coupling degree between multiple dimensions of the feature parameters based on the value of the loss function corresponding to the trained model. The loss function includes multiple terms, as shown in the formula above. The first term is a reconstruction term, which characterizes the effect of the model in generating license plates. The second term is a mutual information term, which characterizes the mutual information between the data variables based on the empirical data distribution q(z, n) and the feature parameters. The third term is a total correlation term, which is a generalization formula of mutual information to two or more random variables, and can measure the correlation between multiple dimensions of the feature parameters. The fourth term is a dimension-level KL divergence term, which can prevent multiple undetermined dimension parameters of an individual from deviating from the pre-established rule data distribution. Because the total correlation term can measure the correlation between multiple dimensions of the feature parameters, the coupling degree between multiple dimensions of the feature parameters can be determined by the magnitude of the total correlation term. When the coupling degree between multiple dimensions of the feature parameters is less than a predetermined first threshold, it can be determined that the coupling degree between multiple dimensions of the feature parameters has reached a predetermined standard.
[0054] The values of multiple undetermined dimensional parameters can be changed to generate license plate images using the trained model. By analyzing the generated license plate images with different values of these parameters, the coupling between the image features can be determined. When the comprehensive analysis shows that the coupling between features in the image is low, it can also be determined that the coupling between the multiple dimensional parameters corresponding to the various features in the image is low.
[0055] As an optional embodiment, determining the training model as a decoupled representation learning model can be achieved through the following steps: adjusting multiple dimensions of the feature parameters to the second parameter value to obtain the license plate image output by the training model; determining the image quality of the license plate image; and determining the training model as a decoupled representation learning model when the image quality is greater than a predetermined second threshold.
[0056] Optionally, after determining that the coupling degree between the multiple dimensions of the feature parameters meets a predetermined standard, it is also necessary to determine whether the quality of the generated license plate image meets the standard. Experimental results show that the coupling degree between the multiple dimensions of the feature parameters and the quality of the generated license plate image are mutually restrictive. When the coupling degree between the multiple dimensions of the feature parameters is very low, the quality of the generated license plate image will be poor, carrying little information and being blurry; conversely, when the quality of the generated license plate image is good, the coupling degree between the multiple dimensions of the feature parameters will increase. Therefore, when training the model, it is necessary to comprehensively consider the effects of both and obtain a suitable value so that each parameter in the multiple dimensions of the feature parameters controls a certain feature in the generated image as much as possible, while also ensuring good quality of the generated license plate image.
[0057] In this optional embodiment, the method for judging image quality is to adjust the values of multiple dimensions of the feature parameters to the second parameter value, so that the trained model outputs a license plate image. Analyzing the license plate image allows for the determination of its image quality. When the image quality is greater than a predetermined second threshold, the training model is considered successfully trained. Alternatively, image quality can be judged based on the value of the reconstruction term in the loss function; a smaller value indicates better image quality.
[0058] As an optional embodiment, determining the image quality of a license plate image can be achieved through the following steps: determining the average gradient and entropy of the license plate image, wherein the average gradient characterizes the image sharpness and the entropy characterizes the amount of information contained in the license plate image; and determining the image quality based on the average gradient and entropy of the license plate image.
[0059] Optionally, when analyzing the generation effect to determine image quality, the grayscale change rate of the license plate image can be calculated to obtain the average gradient of the image. The average gradient value of the image can characterize the image sharpness; the sharper the image, the higher the image quality. Alternatively, the bit average of the grayscale set of the license plate image can be calculated. The bit average of the grayscale set describes the average amount of information in the image source. Image entropy is a statistical form of a feature that reflects the amount of average information in the image and represents the clustering characteristics of the image's grayscale distribution. When both the average gradient and entropy values of the license plate image are high, the image quality of the license plate image is considered good.
[0060] As a specific embodiment, Figure 3 This is a network structure diagram of the decoupled identifier learning model provided by an optional embodiment of the present invention, such as... Figure 3 As shown, the decoupled representation learning model used in this invention is β-TCVAE, and the network structure diagram of the model is shown in the figure above. Where x is the input sample, x is the generated sample, and For the encoder of β-TCVAE, p θ=(x|z) is the decoder of β-TCVAE, θ and Let z be the network parameters of the encoder and decoder, respectively, and z be the latent factors, i.e., feature parameters. Here, the latent factors z are decoupled, z1, z2, z3, ..., z n These represent different dimensions of the potential factor z, i.e., multiple dimensions of the feature parameters.
[0061] The reason for choosing β-TCVAE is that it further decomposes the second term, KL divergence, based on β-VAE, clarifying the TC term that is truly related to decoupling. This is an enhancement and improvement of β-VAE, and it does not require any additional hyperparameters during training. β-TCVAE not only improves the model's decoupling ability but also does not increase the model's complexity.
[0062] The loss function of β-TCVAE is:
[0063]
[0064] Ablation experiments with different values of α and γ were conducted using β-TCVAE, and it was ultimately found that fine-tuning β yielded the best results. In β-TCVAE, α = γ = 1 was used, and only the hyperparameter β was modified. The results show that the model decoupling is mainly related to the TC term; by giving β a large value, the dimensions of q(z) are forced to satisfy independent and identically distributed (i.i.d.) conditions. Thus, q(z) possesses the property of decoupling. Ideally, each dimension of the feature parameters controls different features of the generated data; these dimensions are independent and do not affect each other. For example, the first dimension controls the background color of the license plate, the second dimension controls the numbers on the license plate, and the third dimension controls the region of the license plate, etc. We can randomly sample and combine features across each dimension to generate desired license plate images in batches according to requirements.
[0065] The main steps of training this model include: First, preparing the training data. Collect license plates of all styles as training data for the model. Second, building the model. The encoder and decoder of the β-TCVAE model are both built using convolutional neural networks. Convolutional neural networks can effectively extract features from training images, helping the model decouple. Determine the values of multiple hyperparameters β and build corresponding models for each. Third, training multiple models. Input the data prepared in the first step into the multiple models built in the second step. During the training of each model, iterate multiple times until the loss function stabilizes, obtaining the latent factor z and decoder for each model. Fourth, generating test samples. Randomly sample and assign values to the dimensions of the latent factor z obtained from each model generated in the third step, input them into the decoder obtained in the third step, check the generated image samples, check if the model is qualified, select qualified models as trained models, and apply them in practice. The loss function of β-TCVAE is the key point for the model to decouple; it further decomposes the second term, KL divergence, on the basis of β-VAE.
[0066] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0067] Through the above description of the embodiments, those skilled in the art can clearly understand that the license plate generation method according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0068] According to an embodiment of the present invention, an apparatus for implementing the above-described license plate generation method is also provided. Figure 4 This is a structural block diagram of a license plate generation device provided according to an embodiment of the present invention, such as... Figure 4 As shown, the license plate generation device includes: an acquisition module 42, a first determination module 44, a second determination module 46, and a generation module 48. The device will be described below.
[0069] The acquisition module 42 is used to acquire the feature information of the license plate to be generated.
[0070] The first determining module 44, connected to the acquiring module 42, is used to determine the parameter value of the target dimension parameter included in the multiple dimension parameters of the feature parameters to be input to the decoder based on the feature information. The decoder is the decoder in the pre-trained decoupled representation learning model. The multiple dimension parameters of the feature parameters respectively represent multiple features of the license plate to be generated. The decoupled representation learning model is a model that adjusts the value of the hyperparameter in the loss function to make the coupling degree between the multiple dimension parameters of the feature parameters meet a predetermined standard. The parameter value of the target dimension parameter is used to represent the feature information.
[0071] The second determining module 46, connected to the first determining module 44, is used to determine the first parameter value of the undetermined dimension parameters, excluding the target dimension parameters, among the multiple dimension parameters of the feature parameters.
[0072] The generation module 48, connected to the second determination module 46, is used to input the parameter values of the first parameter value and the target dimension parameter into the decoder to generate the target license plate.
[0073] It should be noted that the acquisition module 42, the first determination module 44, the second determination module 46, and the generation module 48 mentioned above correspond to steps S202 to S208 in the embodiments. Multiple modules implement the same instances and application scenarios as their corresponding steps, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of the device, can run on the computer terminal 10 provided in the embodiments.
[0074] Embodiments of the present invention may provide a computer device. Optionally, in this embodiment, the computer device may be located in at least one of a plurality of network devices in a computer network. The computer device includes a memory and a processor.
[0075] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the license plate generation method and apparatus in this embodiment of the invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby realizing the aforementioned license plate generation method. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0076] The processor can access the information and application program stored in the memory via a transmission device to perform the following steps: acquiring the feature information of the license plate to be generated; determining the parameter value of the target dimension parameter among the multiple dimension parameters of the feature parameters to be input to the decoder based on the feature information, wherein the decoder is the decoder in a pre-trained decoupled representation learning model, the multiple dimension parameters of the feature parameters respectively represent multiple features of the license plate to be generated, the decoupled representation learning model is a model that adjusts the values of hyperparameters in the loss function to make the coupling degree between the multiple dimension parameters of the feature parameters conform to a predetermined standard, and the parameter value of the target dimension parameter is used to represent the feature information; determining the first parameter value of the undetermined dimension parameter other than the target dimension parameter among the multiple dimension parameters of the feature parameters; inputting the first parameter value and the parameter value of the target dimension parameter into the decoder to generate the target license plate.
[0077] Optionally, the processor may also execute program code for the following steps: the pre-trained decoupled representation learning model is a model trained by the following steps: obtaining a training dataset, wherein the training dataset includes multiple license plate samples; training the original model of the decoupled representation learning model based on the training dataset to determine the decoupled representation learning model, wherein the decoupled representation learning model includes multiple dimensional parameters of the feature parameters determined through training.
[0078] Optionally, the processor may also execute program code for the following steps: training the original model based on the training dataset to determine the decoupled representation learning model, including: obtaining the hyperparameter values of the hyperparameters and determining the original model based on the hyperparameter values, wherein the hyperparameters are located in the loss function of the original model; training the original model based on the training dataset to obtain a training model, wherein the training model includes multiple dimensions of the feature parameters; and determining the training model as a decoupled representation learning model when the coupling degree of the multiple dimensions of the feature parameters included in the training model reaches a predetermined standard.
[0079] Optionally, the processor may also execute program code that performs the following steps: The loss function for training the model is:
[0080]
[0081] Among them, L β-TC Let z be the loss function, z be the feature parameters, and j be the dimension of the feature parameters. j Let be the j-th dimension parameter of the feature parameters, n be the samples in the training dataset, KL(||) be the KL divergence function, p(n) be the distribution of the samples, q(n) be the distribution of the samples approximated by the mathematical model, and L β-TC The third item is the overall correlation item.
[0082] Optionally, the processor may also execute program code with the following steps: before determining the training model as a decoupled representation learning model when the coupling degree of multiple undetermined parameters included in the training model reaches a predetermined standard, the processor may further include: determining the value of the total correlation term in the loss function; determining the coupling degree of multiple dimensions of the feature parameters based on the value of the total correlation term, wherein the coupling degree characterizes the degree of mutual influence between the multiple dimensions of the feature parameters; and determining that the coupling degree of the multiple dimensions of the feature parameters reaches a predetermined standard when the coupling degree is less than a predetermined first threshold.
[0083] Optionally, the processor may also execute program code for the following steps: determining the training model as a decoupled representation learning model, including: adjusting the values of multiple dimensions of the feature parameters to the second parameter value to obtain the license plate image output by the training model; determining the image quality of the license plate image; and determining the training model as a decoupled representation learning model when the image quality is greater than a predetermined second threshold.
[0084] Optionally, the processor may also execute program code for the following steps: determining the image quality of the license plate image, including: determining the average gradient and entropy of the license plate image, wherein the average gradient characterizes the image sharpness and the entropy characterizes the amount of information contained in the license plate image; and determining the image quality based on the average gradient and entropy of the license plate image.
[0085] This invention provides a license plate generation scheme. It involves acquiring feature information of the license plate to be generated; determining the parameter values of multiple undetermined parameters, including feature parameters, as input to the decoder based on the feature information. The decoder is a decoder in a pre-trained decoupled representation learning model, which adjusts the hyperparameter values in the loss function to ensure the coupling between the multiple undetermined parameters meets a predetermined standard. The parameter values of the feature parameters represent the license plate features. A first parameter value is determined for the undetermined parameters other than the feature parameters included in the multiple undetermined parameters. The first parameter value and the parameter values of the feature parameters are input to the decoder to generate the target license plate. This achieves the goal of controlling the generated license plate features based on the values of multiple feature parameters, thus realizing the technical effect of generating a license plate with corresponding features based on feature information. This solves the technical problem of high feature uncertainty and poor interpretability in license plates generated in existing technologies.
[0086] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a non-volatile storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.
[0087] Embodiments of the present invention also provide a non-volatile storage medium. Optionally, in this embodiment, the aforementioned non-volatile storage medium can be used to store the program code executed by the license plate generation method provided in the above embodiments.
[0088] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0089] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: obtaining feature information of the license plate to be generated; determining the parameter value of the target dimension parameter included in the multiple dimension parameters of the feature parameters to be input to the decoder based on the feature information, wherein the decoder is the decoder in a pre-trained decoupled representation learning model, the multiple dimension parameters of the feature parameters respectively represent multiple features of the license plate to be generated, the decoupled representation learning model is a model that adjusts the value of the hyperparameter in the loss function to make the coupling degree between the multiple dimension parameters of the feature parameters meet a predetermined standard, and the parameter value of the target dimension parameter is used to represent the feature information; determining the first parameter value of the undetermined dimension parameters other than the target dimension parameter included in the multiple dimension parameters of the feature parameters; inputting the first parameter value and the parameter value of the target dimension parameter into the decoder to generate the target license plate.
[0090] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: the pre-trained decoupled representation learning model is a model trained by the following steps: obtaining a training dataset, wherein the training dataset includes multiple license plate samples; training the original model of the decoupled representation learning model according to the training dataset to determine the decoupled representation learning model, wherein the decoupled representation learning model includes multiple dimensional parameters of feature parameters determined through training.
[0091] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: training the original model based on the training dataset to determine a decoupled representation learning model, including: obtaining hyperparameter values of hyperparameters and determining the original model based on the hyperparameter values, wherein the hyperparameters are located in the loss function of the original model; training the original model based on the training dataset to obtain a training model, wherein the training model includes multiple dimensions of feature parameters; and determining the training model as a decoupled representation learning model when the coupling degree of the multiple dimensions of feature parameters included in the training model reaches a predetermined standard.
[0092] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: the loss function for training the model is:
[0093]
[0094] Among them, L β-TC Let z be the loss function, z be the feature parameters, and j be the dimension of the feature parameters. j Let be the j-th dimension parameter of the feature parameters, n be the samples in the training dataset, KL(||) be the KL divergence function, p(n) be the distribution of the samples, q(n) be the distribution of the samples approximated by the mathematical model, and L β-TC The third item is the overall correlation item.
[0095] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: before determining the training model as a decoupled representation learning model when the coupling degree of multiple undetermined parameters included in the training model reaches a predetermined standard, the method further includes: determining the value of the total correlation term in the loss function; determining the coupling degree of multiple dimensions of the feature parameters based on the value of the total correlation term, wherein the coupling degree characterizes the degree of mutual influence between the multiple dimensions of the feature parameters; and determining that the coupling degree of the multiple dimensions of the feature parameters reaches a predetermined standard when the coupling degree is less than a predetermined first threshold.
[0096] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: adjusting the values of multiple dimensions of the feature parameters to the second parameter value to obtain the license plate image output by the training model; determining the image quality of the license plate image; and determining the training model as a decoupled representation learning model when the image quality is greater than a predetermined second threshold.
[0097] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: determining the image quality of a license plate image, including: determining the average gradient and entropy of the license plate image, wherein the average gradient characterizes the sharpness of the image and the entropy characterizes the amount of information included in the license plate image; and determining the image quality based on the average gradient and entropy of the license plate image.
[0098] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0099] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0100] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0101] The units described as separate components may or may not be physically separate. 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 units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0102] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0103] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0104] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for generating license plates, characterized in that, include: Obtain the feature information of the license plate to be generated; Based on the feature information, the parameter value of the target dimension parameter included in the multiple dimension parameters of the feature parameters to be input to the decoder is determined. The decoder is the decoder in a pre-trained decoupled representation learning model. The multiple dimension parameters of the feature parameters respectively represent multiple features of the license plate to be generated. The decoupled representation learning model is a model that adjusts the value of the hyperparameter in the loss function to make the coupling degree between the multiple dimension parameters of the feature parameters meet a predetermined standard. The parameter value of the target dimension parameter is used to represent the feature information. The first parameter value of the undetermined dimension parameters, excluding the target dimension parameter, is determined from the multiple dimension parameters of the feature parameter. The first parameter value and the parameter value of the target dimension parameter are input into the decoder to generate the target license plate; The method further includes: obtaining hyperparameter values of multiple hyperparameters and constructing multiple original models based on the multiple hyperparameter values; training the multiple original models based on a training dataset to obtain multiple trained models, wherein each trained model includes latent factors and a decoder, and the latent factors are the feature parameters; when the coupling degree of multiple dimensions of the latent factors meets the predetermined standard, randomly sampling and assigning values to multiple dimensions of the latent factors in the multiple trained models, and inputting them into the decoders corresponding to the multiple trained models respectively to obtain multiple license plate images output by the multiple trained models; determining the average gradient and entropy of the multiple license plate images, wherein the average gradient represents the sharpness of each license plate image, and the entropy represents the amount of information included in each license plate image; determining the image quality of the multiple license plate images based on the average gradient and entropy of the multiple license plate images; and selecting the training model whose image quality is greater than a predetermined second threshold as the decoupled representation learning model.
2. The method according to claim 1, characterized in that, The pre-trained decoupled representation learning model is a model trained through the following steps: Obtain a training dataset, wherein the training dataset includes multiple license plate samples; The original model of the decoupled representation learning model is trained based on the training dataset to determine the decoupled representation learning model, wherein the decoupled representation learning model includes multiple dimensional parameters of the feature parameters determined through training.
3. The method according to claim 1, characterized in that, The loss function of the trained model is: , in, Let z be the loss function, z be the feature parameter, and j be the dimension of the feature parameter. j Let be the j-th dimension parameter of the feature parameters, n be the samples in the training dataset, KL(|| ) be the KL divergence function, p(n) be the distribution of the samples, and q(n) be the distribution of the samples approximated by the mathematical model. The third term is the total relevance term, where p(n|z) represents the decoder of the decoupled representation learning model, and q(z|n) represents the encoder of the decoupled representation learning model. p(z) represents the mutual information between the sample and the feature parameters, where α, β, and γ are hyperparameters in the loss function. j ) represents the distribution of the j-th dimension parameter of the feature parameters, q(z) j Let q(z) be the distribution of the j-th dimension parameter of the feature parameters approximated by the mathematical model, and let q(z) be the distribution of the feature parameters approximated by the mathematical model, wherein each dimension of q(z) satisfies independent and identically distributed (i.i.d.) .
4. The method according to claim 3, characterized in that, Before determining the training model as the decoupled representation learning model, the method further includes: Determine the value of the total correlation term in the loss function; Based on the value of the total correlation term, the coupling degree of multiple dimensions of the feature parameter is determined, wherein the coupling degree characterizes the degree of mutual influence among the multiple dimensions of the feature parameter. When the coupling degree is less than a predetermined first threshold, it is determined that the coupling degree of multiple dimension parameters of the feature parameter reaches the predetermined standard.
5. A license plate generation device, characterized in that, include: The acquisition module is used to acquire the feature information of the license plate to be generated; The first determining module is used to determine the parameter value of the target dimension parameter included in the multiple dimension parameters of the feature parameters to be input to the decoder based on the feature information. The decoder is a decoder in a pre-trained decoupled representation learning model. The multiple dimension parameters of the feature parameters respectively represent multiple features of the license plate to be generated. The decoupled representation learning model is a model that adjusts the value of the hyperparameter in the loss function to make the coupling degree between the multiple dimension parameters of the feature parameters meet a predetermined standard. The parameter value of the target dimension parameter is used to represent the feature information. The second determining module is used to determine the first parameter value of the undetermined dimension parameters other than the target dimension parameter, which are included in the multiple dimension parameters of the feature parameters; The generation module is used to input the first parameter value and the parameter value of the target dimension parameter into the decoder to generate the target license plate; The device is further configured to acquire hyperparameter values of multiple hyperparameters and construct multiple original models based on the hyperparameter values; train the multiple original models based on a training dataset to obtain multiple trained models, wherein each trained model includes latent factors and a decoder, and the latent factors are the feature parameters; when the coupling degree of multiple dimensions of the latent factors meets the predetermined standard, randomly sample and assign values to multiple dimensions of the latent factors in the multiple trained models, and input them into the decoders corresponding to the multiple trained models respectively to obtain multiple license plate images output by the multiple trained models; determine the average gradient and entropy of the multiple license plate images, wherein the average gradient represents the sharpness of each license plate image, and the entropy represents the amount of information included in each license plate image; determine the image quality of the multiple license plate images based on the average gradient and entropy of the multiple license plate images; and select the training model whose image quality is greater than a predetermined second threshold as the decoupled representation learning model.
6. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the non-volatile storage medium to perform the license plate generation method according to any one of claims 1 to 4.
7. A computer device, characterized in that, include: Memory and processor The memory stores computer programs; The processor is configured to execute a computer program stored in the memory, wherein when the computer program is executed, the processor performs the license plate generation method according to any one of claims 1 to 4.
Citation Information
Patent Citations
License plate image generation method and system based on adaptive diffusion prior variational auto-encoder
CN115223158A