CN109255772B - License plate image generation method, device, equipment and medium based on style migration - Google Patents
License plate image generation method, device, equipment and medium based on style migration Download PDFInfo
- Publication number
- CN109255772B CN109255772B CN201810978822.5A CN201810978822A CN109255772B CN 109255772 B CN109255772 B CN 109255772B CN 201810978822 A CN201810978822 A CN 201810978822A CN 109255772 B CN109255772 B CN 109255772B
- Authority
- CN
- China
- Prior art keywords
- license plate
- image
- plate image
- initial
- style
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000013508 migration Methods 0.000 title claims abstract description 69
- 230000005012 migration Effects 0.000 title claims abstract description 69
- 238000000034 method Methods 0.000 title claims abstract description 50
- 238000007781 pre-processing Methods 0.000 claims abstract description 17
- 230000006870 function Effects 0.000 claims description 33
- 238000004422 calculation algorithm Methods 0.000 claims description 32
- 238000004590 computer program Methods 0.000 claims description 18
- 238000000605 extraction Methods 0.000 claims description 16
- 238000012545 processing Methods 0.000 claims description 16
- 238000005070 sampling Methods 0.000 claims description 15
- 238000009826 distribution Methods 0.000 claims description 11
- 238000004364 calculation method Methods 0.000 claims description 10
- 238000013527 convolutional neural network Methods 0.000 claims description 8
- 238000005260 corrosion Methods 0.000 claims description 7
- 230000007797 corrosion Effects 0.000 claims description 7
- 238000012800 visualization Methods 0.000 claims description 7
- 230000003094 perturbing effect Effects 0.000 claims description 5
- 230000015572 biosynthetic process Effects 0.000 claims description 4
- 230000006835 compression Effects 0.000 claims description 4
- 238000007906 compression Methods 0.000 claims description 4
- 238000003786 synthesis reaction Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 238000012549 training Methods 0.000 description 3
- 230000000007 visual effect Effects 0.000 description 3
- 239000003086 colorant Substances 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003628 erosive effect Effects 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000005530 etching Methods 0.000 description 1
- 230000004438 eyesight Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 210000002569 neuron Anatomy 0.000 description 1
- 239000000049 pigment Substances 0.000 description 1
- 238000011176 pooling Methods 0.000 description 1
- 238000001228 spectrum Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000009827 uniform distribution Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/60—Editing figures and text; Combining figures or text
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
- G06V10/23—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition based on positionally close patterns or neighbourhood relationships
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/24—Aligning, centring, orientation detection or correction of the image
- G06V10/245—Aligning, centring, orientation detection or correction of the image by locating a pattern; Special marks for positioning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/46—Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
- G06V10/462—Salient features, e.g. scale invariant feature transforms [SIFT]
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a license plate image generation method, a device, computer equipment and a storage medium based on style migration, wherein the method comprises the following steps: after receiving an instruction for generating a license plate image, acquiring the license plate type contained in the instruction, generating a random license plate number according to a preset license plate number structure corresponding to the license plate type, selecting a character image corresponding to characters contained in the license plate number from a preset font library, generating an initial license plate image according to the character image and the license plate number, preprocessing the generated initial license plate image and performing style migration, efficiently and quickly generating a simulated license plate image close to a real license plate image, improving the acquisition efficiency of the license plate image, ensuring higher authenticity and simultaneously guaranteeing the high-quality requirement of the license plate image.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a license plate image generating method, device, equipment and medium based on style migration.
Background
With the rapid development of national economy in China, china becomes the country with the fastest construction speed of highway infrastructure in the world today, and is the country with the fastest traffic demand growth, the maintenance amount of people and motor vehicles is greatly increased, and the scale of motor vehicles is also gradually increased. The number of motor vehicles in China is increased by more than 15% in years, and along with the rapid increase of the number of motor vehicles in China, traffic problems caused by the rapid increase of the number of motor vehicles in China are more serious, so that license plate images of vehicles passing through roads are shot by cameras in many places, license plate numbers are identified by using a license plate image identification algorithm, and vehicles are managed and controlled.
At present, a machine learning algorithm is generally used in the license plate image recognition algorithm, and a large number of license plate image samples are required in the training process of the machine learning algorithm. The acquisition difficulty of the real license plate image sample is high and is influenced by factors such as country, province, vehicle type and the like, and the coverage rate of the license plate image sample is low, so that how to acquire a large number of real license plate images with training values is a difficult problem.
Currently, most industry manufacturers still use cameras to collect license plate image samples. The manual acquisition mode is high in acquisition cost, low in efficiency and poor in practicality, and meanwhile, the manual acquisition can also cause the problem of unstable picture quality.
Disclosure of Invention
The embodiment of the invention provides a license plate image generation method based on style migration, which aims to solve the problems of low license plate image sample collection efficiency, poor practicability and unstable quality.
In a first aspect, an embodiment of the present invention provides a license plate image generating method based on style migration, including:
If an instruction for generating license plate images is received, acquiring license plate types contained in the instruction;
generating a random license plate number according to a license plate number structure corresponding to the license plate type;
selecting a character image corresponding to characters contained in the license plate number from a preset font library, and generating an initial license plate image according to the character image and the license plate number;
Performing image preprocessing on the initial license plate image to obtain a simulated license plate image;
And performing style migration on the simulated license plate image by using a style migration algorithm to obtain a target license plate image.
In a second aspect, an embodiment of the present invention provides a license plate image generating device based on style migration, including:
the type acquisition module is used for acquiring license plate types contained in the instruction if the instruction for generating the license plate image is received;
the number generation module is used for generating random license plate numbers according to license plate number structures corresponding to the license plate types;
The image synthesis module is used for selecting a character image corresponding to characters contained in the license plate number from a preset font library, and generating an initial license plate image according to the character image and the license plate number;
The image preprocessing module is used for carrying out image preprocessing on the initial license plate image to obtain a simulated license plate image;
And the style migration module is used for performing style migration on the simulated license plate image by using a style migration algorithm to obtain a target license plate image.
In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the license plate image generating method based on style migration when the processor executes the computer program.
In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium storing a computer program, where the computer program when executed by a processor implements the steps of the license plate image generation method based on style migration described above.
According to the license plate image generation method, device, computer equipment and storage medium based on style migration, after receiving the instruction for generating the license plate image, the license plate type contained in the instruction is obtained, the random license plate number is generated according to the preset license plate number structure corresponding to the license plate type, the character image corresponding to the characters contained in the license plate number is selected from the preset font library, the initial license plate image is generated according to the character image and the license plate number, and the generated initial license plate image is preprocessed and style migrated, so that the simulated license plate image close to the real license plate image is generated efficiently and rapidly, the license plate image acquisition efficiency is improved, the reality is higher, and meanwhile, the high-quality requirement of the license plate image is guaranteed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of an application environment of a license plate image generating method based on style migration according to an embodiment of the present invention;
FIG. 2 is a flowchart of an implementation of a license plate image generation method based on style migration provided by an embodiment of the present invention;
fig. 3 is a flowchart of implementation of step S50 in the license plate image generating method based on style migration according to the embodiment of the present invention;
fig. 4 is a flowchart of implementation of step S55 in the license plate image generating method based on style migration according to the embodiment of the present invention;
Fig. 5 is a flowchart of implementation of step S40 in the license plate image generating method based on style migration according to the embodiment of the present invention;
fig. 6 is a flowchart of implementation of step S41 in the license plate image generating method based on style migration according to the embodiment of the present invention;
Fig. 7 is a flowchart of implementation of step S43 in the license plate image generating method based on style migration according to the embodiment of the present invention;
Fig. 8 is a schematic diagram of a license plate image generating device based on style migration according to an embodiment of the present invention;
fig. 9 is a schematic diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 illustrates an application environment of a license plate image generating method based on style migration according to an embodiment of the present invention. The license plate image generation method based on style migration is applied to a license plate image generation scene of a motor vehicle. The generation scene comprises a server and a client, wherein the server and the client are connected through a network, a user generates a random license plate number image and performs preprocessing and style migration on the image by sending a request for generating the license plate image of a specified type to the server, the client can be particularly but not exclusively a variety of personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server can be particularly realized by a server cluster formed by independent servers or a plurality of servers.
Referring to fig. 2, fig. 2 shows a license plate image generating method based on style migration according to an embodiment of the present invention, and the method is applied to the server in fig. 1 for illustration, and is described in detail as follows:
S10: and if the instruction for generating the license plate image is received, acquiring the license plate type contained in the instruction.
Specifically, a user sends an instruction for generating license plate images to a server through a client, and the server acquires license plate types contained in the instruction after receiving the instruction.
License plate types include, but are not limited to: license plate base color and license plate number variety, etc., license plate base color includes, but is not limited to: blue, yellow, white, black, green, etc., license plate number categories include, but are not limited to: civil automobile license plates, new energy automobile license plates, government department license plates, new army license plates and the like.
For example, in a specific embodiment, the server obtains the license plate type from the instruction for generating the license plate image sent by the user: the bottom color is blue license plate of civil automobile.
S20: and generating a random license plate number according to a license plate number structure corresponding to the license plate type.
Specifically, as can be seen from step S10, the license plate types include license plate number types, different license plate numbers correspond to different license plate number structures, and in the background database of the server side, the generation modes of the license plate numbers corresponding to the different license plate number structures are prestored, so that the generation modes of the license plate numbers corresponding to the license plate number structures can be obtained according to the license plate number structures corresponding to the license plate types, and then the random license plate numbers corresponding to the license plate types can be generated by using the generation modes, so that the random license plate numbers of the user demand types can be obtained.
For example, in one embodiment, the license plate type included in the instruction is: and in another specific embodiment, the license plate type contained in the instruction is a new military license plate with black ground color, and the license plate number generation mode corresponding to the new military license plate is obtained to generate a random new military license plate KU 13256.
S30: and selecting a character image corresponding to each character in the license plate number from a preset font library, and combining the character images into an initial license plate image.
Specifically, after the license plate number is obtained, a license plate picture corresponding to the license plate number needs to be generated, and the font of the license plate number is a special font and cannot be directly output through a computer, so that the method adopted by the embodiment of the invention is as follows: a corresponding character image is set for each character in the license plate number in advance, the character images corresponding to each character in the license plate number are obtained, the character images are combined according to the sequence of the characters in the license plate number, and the background color is used as the background color to generate an initial license plate image.
Wherein, a character image contains a character, and the font is a special font used by the license plate number.
The preset font library comprises the following components: 10 Arabic numerals 0 to 9, 26 English capital letters, 34 Chinese provinces, direct administration cities and regions, and 70 preset character images in total.
For example, in a specific embodiment, the generated random license plate number is "wan a305Y6", the ground color is blue, 7 character images of "wan", "a", "3", "0", "5", "Y" and "6" are selected from a preset font library, and are combined in the order of "wan", "a", "3", "0", "5", "Y" and "6", and finally the initial license plate image is generated with the blue as the ground color.
It should be noted that the character images are transparent images, i.e., images without ground color.
S40: and carrying out image preprocessing on the initial license plate image to obtain a simulated license plate image.
Specifically, since the license plate is subjected to some erosion pollution in the natural environment, the pixel value distribution can generate some changes, and after the initial license plate image is obtained, in order to enable the image to be more similar to the real license plate image, image preprocessing is required to be carried out on the image to obtain a simulated license plate image, so that the simulated license plate image is more natural and is more similar to the real license plate image.
Wherein the image preprocessing includes, but is not limited to: pixel value random perturbation, gaussian blurring and sharpening, etc.
S50: and performing style migration on the simulated license plate image by using a style migration algorithm to obtain a target license plate image.
Specifically, the style of the real license plate image is migrated to the simulated license plate image through a style migration algorithm, and a target license plate image with the same style as the real license plate image is obtained.
The style in the embodiment of the invention refers to texture venation of the image, and generally has strong homogeneity and regularity.
The style migration algorithm is to extract the style characteristics of the real license plate image and the content characteristics of the simulated license plate image through a convolutional neural network, and fuse the style characteristics of the real license plate image and the content characteristics of the simulated license plate image to obtain a new image with the style of the real license plate image and the content of the simulated license plate image, namely the target license plate image.
It is worth to say that in the convolutional neural network, the lower convolutional layer has obvious style characteristics, the higher convolutional layer has obvious content characteristics, so that when the style characteristics are extracted, the lower convolutional layer can be used for extracting the style characteristics of all the convolutional layers, namely, the style characteristics of all the convolutional layers are not required to be extracted, and when the content characteristics are extracted, the higher convolutional layer can be used for extracting the content characteristics of all the convolutional layers, namely, the style characteristics and the content characteristic extraction efficiency are not required to be extracted, which is beneficial to reducing the calculation amount and improving the style characteristics and the content characteristic extraction efficiency.
In this embodiment, after receiving an instruction for generating a license plate image, a license plate type included in the instruction is acquired, a random license plate number is generated according to a preset license plate number structure corresponding to the license plate type, a character image corresponding to characters included in the license plate number is selected from a preset font library, an initial license plate image is generated according to the character image and the license plate number, and the generated initial license plate image is preprocessed and style migrated, so that a simulated license plate image close to a real license plate image is generated efficiently and rapidly, the license plate image acquisition efficiency is improved, the authenticity is higher, and meanwhile, the high quality requirement of the license plate image is also ensured.
Based on the corresponding embodiment of fig. 2, a detailed description is given below of a specific implementation method for performing style migration on the simulated license plate image to obtain the target license plate image by using a style migration algorithm mentioned in step S50 through a specific embodiment.
Referring to fig. 3, fig. 3 shows a specific implementation flow of step S50 provided in the embodiment of the present invention, which is described in detail below:
s51: and acquiring a preset real license plate image.
Specifically, after the simulated license plate image is generated, the simulated license plate image needs to be subjected to style migration, namely, the style of the real license plate image is migrated to the simulated license plate image, so that the simulated license plate image is closer to the real license plate image, and therefore, one real license plate image needs to be selected from a preset real license plate image set to serve as an image for extracting style characteristics.
It is worth to say that the real image sample required by the preset real image sample set is not very large, and is to perform style migration on the simulated license plate image, and the purpose of style migration is to extract style features from the real license plate image and migrate the style features to the simulated license plate image, so that the simulated license plate image has the style features of the real license plate image, namely is closer to the real license plate image, and therefore, the content in the real license plate image is not consistent with the content in the simulated license plate image.
S52: and respectively extracting features of the real license plate image and the simulated license plate image by adopting a convolutional neural network VGG-NET model to obtain an initial image feature set of each convolutional layer of the real license plate image in the VGG-NET model and an initial image feature set of each convolutional layer of the simulated license plate image in the VGG-NET model.
Specifically, image features of a real license plate image and an analog license plate image are respectively extracted through a convolutional neural network VGG-NET model, so that an initial image feature set of each convolutional layer of the real license plate image and an initial image feature set of each convolutional layer of the analog license plate image are obtained.
The VGG-NET (Visual Geometry Group NET) model is a deep neural network model, and the network structure comprises: 5 convolution layers, 5 pooling layers and 3 full connection layers, wherein the 5 convolution layers are a first convolution layer, a second convolution layer, a third convolution layer, a fourth convolution layer and a fifth convolution layer, respectively.
S53: and selecting the image features of the first preset layer from the initial image feature set of the simulated license plate image as content features.
Specifically, in an initial image feature set of the simulated license plate image, selecting image features of a first preset layer as content features.
The first preset layer is set according to actual needs, and is generally set as a high-level convolution layer because the reserved content features of the higher convolution layer are more detailed.
It will be appreciated that the first predetermined layer may be one convolution layer or may be a plurality of convolution layers.
For example, in a specific embodiment, the first preset layer is a third convolution layer, a fourth convolution layer, and a fifth convolution layer, and further, in the initial image feature set of the simulated license plate image, the simulated license plate image features extracted by the third convolution layer, the fourth convolution layer, and the fifth convolution layer are selected as the content features.
S54: and selecting image features of a second preset layer from the initial image feature set of the real license plate image to perform inner product operation to obtain style features.
Specifically, in an initial image feature set of a real license plate image, selecting image features of a first preset layer, performing inner product operation on the images, and taking the obtained result as style features.
The second preset layer is set according to actual needs, and is generally set as a lower-layer convolution layer because the reserved content features of the lower-layer convolution layer are more detailed.
The inner product operation is to perform three-three multiplication between the image features extracted by the first preset layer.
It should be noted that the style feature is a commonality that extends over the entire picture, and the commonality is more obvious in the lower convolution layers, and the feature of the lower convolution layers is subjected to inner product operation, so that the extraction of the commonality is realized, and the style feature is obtained.
It will be appreciated that the second predetermined layer may be one convolution layer or may be a plurality of convolution layers.
For example, in a specific embodiment, the second preset layer is a first convolution layer and a second convolution layer, so that in the initial image feature set of the real license plate image, the real license plate image features extracted by the first convolution layer and the second convolution layer are selected as style features.
It should be noted that, the step S53 and the step S54 are not necessarily executed sequentially, and may be executed in parallel, which is not limited herein.
S55: and adopting DEEPDREAM algorithm to perform image feature visualization processing on the style features and the content features to generate a target license plate image.
Specifically, the extracted style characteristics and content characteristics are fused through DEEPDREAM algorithm, and a visual image is generated to obtain a target license plate image.
The DEEPDREAM algorithm is an artificial intelligence algorithm of Google on source for classifying and sorting images, the DEEPDREAM algorithm mainly comprises 10 to 30 artificial neuron pairs stacked, each image is stored in an input layer and then communicated with the next layer until finally reaching an output layer, and an answer which is wanted by training an artificial neural network is obtained. Likewise, one hierarchy may be selected and the network commanded to enhance any content that is monitored, so the network will be more sensitive to the visual recognition of our commands in the next hierarchy until the image that we want is displayed.
In the embodiment, the method comprises the steps of obtaining a preset real license plate image, carrying out feature extraction on the real license plate image and a simulated license plate image by adopting a convolutional neural network VGG-NET model to obtain an initial image feature set of each convolutional layer of the real license plate image in the VGG-NET model and an initial image feature set of each convolutional layer of the simulated license plate image in the VGG-NET model, further, selecting image features of a first preset layer from the initial image feature set of the simulated license plate image as content features, selecting image features of a second preset layer from the initial image feature set of the real license plate image to carry out inner product operation to obtain style features, carrying out image feature visualization processing on the style features and the content features by adopting DEEPDREAM algorithm to generate a target license plate image, so that the generated target license plate image has the style of the real license plate image, the authenticity of the target license plate image is enhanced, and the quality of the target license plate image is improved.
Based on the corresponding embodiment of fig. 3, a detailed description is given below of a specific implementation method for generating the target license plate image by performing image feature visualization processing on the style features and the content features by using the DEEPDREAM algorithm mentioned in step S55 through a specific embodiment.
Referring to fig. 4, fig. 4 shows a specific implementation flow of step S55 provided in the embodiment of the present invention, which is described in detail below:
S551: the method comprises the steps of obtaining a white noise image with the same size as a simulated license plate image as an initial image, inputting the initial image into a VGG-NET model for feature extraction, and obtaining the image features of each convolution layer of the initial image in the VGG-NET model.
Specifically, a white noise image with the same size as the simulated license plate image is obtained, and the white noise image is used as an initial image to be input into a VGG-NET model for feature extraction, so that the image features of each convolution layer of the initial image in the VGG-NET model are obtained.
The white noise image is an image with amplitude distribution obeying Gaussian distribution and power spectrum density obeying uniform distribution, and the white noise image is selected as an initial image because the white noise image can reduce interference on content characteristics and style characteristics as much as possible.
It should be noted that, the VGG-NET model used in this step is the same model as the VGG-NET model in step S52, so as to ensure that each parameter of the network model is consistent in the feature extraction process.
S552: determining content feature weights for each convolution layer of an initial image in the VGG-NET model using the formulaAnd style feature weight/>:
Wherein,As a total loss function,/>For the loss function of image features at each layer of the initial image relative to the content features,/>For the loss function of image features at each layer of the initial image relative to the style features,/>And/>Calculated by a preset loss function calculation formula, and/>+/>=1,/>And/>Is a non-negative number,/>Representing a simulated license plate image,/>Representing a real license plate image,/>Representing the initial image.
Specifically, the image feature of the initial image extracted in step S551 in each convolution layer, and the style feature and the content feature extracted in step S53 and step S54 are calculated by the above formula, so as to obtain the content feature weight and the style feature weight that minimize the total loss function.
Wherein the loss function calculation formula includes, but is not limited to: 0-1 loss function and absolute value loss function, log loss function, square loss function, exponential loss function, and range loss function, etc.
Preferably, the loss function calculation formula adopted in the embodiment of the invention is a log-log loss function.
S553: and obtaining the updated image characteristics of the initial image according to the content characteristics, the style characteristics, the content characteristic weight of each convolution layer and the style characteristic weight of each convolution layer.
Specifically, in each convolution layer, the content feature is multiplied by the content feature weight, the style feature is multiplied by the style feature weight, and then the two calculation results are spliced together, so that the image feature of the layer after the initial image update can be obtained.
S554: and inputting the updated image characteristics into the VGG-NET model, and returning to the execution step S552 until the execution times reach the preset iteration times, so as to obtain target image characteristics.
Specifically, after the image feature after the initial image update is obtained in step S553, the image feature after the initial image update is input into the calculation formula in step S552, and is used as the image feature of the initial image, the content feature weight and the style feature weight of the initial image in each convolution layer are recalculated, and are iteratively performed until reaching the preset times, and the image feature after the last update is used as the target image feature.
It is worth to say that, the more the iteration times are increased, the more the style characteristics are close to those of the real license plate image, but the more and more the content characteristics of the simulated license plate image are gradually lost, and the requirements of the target license plate image required by the embodiment of the invention are that: the style of the real license plate image is similar, but the content characteristics cannot be lost excessively, so that the preferred iteration number of the embodiment of the invention is 300. In practice, the number of iterations may be set according to the effect to be obtained for the image, and is not particularly limited here.
S555: and generating a target license plate image according to the target image characteristics.
Specifically, according to the target image feature determined in step S554, the VGG-NET model is reversely updated to obtain each pixel value corresponding to the target image feature, and the pixel value on the white noise image is updated to obtain the target license plate image.
In this embodiment, a white noise image with the same size as a simulated license plate image is obtained as an initial image, the initial image is input into a VGG-NET model for feature extraction, the image feature of each convolution layer of the initial image in the VGG-NET model is obtained, further, the content feature weight and the style feature weight of each convolution layer of the initial image in the VGG-NET model are calculated, the updated image feature of the initial image is obtained according to the content feature, the style feature, the content feature weight of each convolution layer and the style feature weight of each convolution layer, then the updated image feature is input into the VGG-NET model, and the step of calculating the content feature weight and the style feature weight of each convolution layer is returned until the execution times reach the preset iteration times, so that a target image feature is obtained, and a target license plate image is generated according to the target image feature, so that the target license plate image is closer to the style of a real license plate image, the content of the target license plate image is more reserved, and the authenticity of the target license plate image is enhanced, and the quality of the target license plate image is improved.
Based on the corresponding embodiment of fig. 2, the specific implementation method for performing image preprocessing on the initial license plate image mentioned in step S40 to obtain the simulated license plate image is described in detail below through a specific embodiment.
Referring to fig. 5, fig. 5 shows a specific implementation flow of step S40 provided in the embodiment of the present invention, which is described in detail below:
s41: and randomly disturbing the pixel values of the pixel points in the initial license plate image to obtain a first license plate image with randomly distributed pixel values.
Specifically, in the actual photographed real license plate image, due to different purities of new and old license plate images, the pixel values of the license plate surface can change somewhat, so that the obtained license plate image is closer to the real license plate image, the pixel values of the initial license plate image need to be randomly disturbed, and then the first license plate image with randomly distributed pixel values is obtained.
The random disturbance is to randomly change the pixel value of each point by the pointer according to a preset mode.
For example, in one embodiment, the preset manner is: random perturbation is performed according to the range of the perturbation range of [ -20,20] per se, wherein the RGB pixel value of a certain pixel point is (6, 12, 230), and the pixel point becomes (8, 12, 226) after random perturbation in the preset mode.
It should be noted that the range of each pigment in the pixel value is [0,255], that is, the maximum value is 255 and the minimum value is 0 after the disturbance.
S42: and carrying out corrosion expansion treatment on the first car image to obtain a second car image.
Specifically, after the random perturbation of the pixel values is performed in step S41, some pixels having larger deviations between the pixel values and the surrounding pixel values may appear, so that the first vehicle image is more natural by performing the image erosion and expansion processing on the first vehicle image.
The corrosion is used for eliminating boundary points of objects, so that the targets are reduced, and noise points smaller than structural elements can be eliminated; the expansion has the effect of merging all background points in contact with the object into the object, enlarging the object and filling in the holes in the object. The operation of the image processing is a process of etching before expanding, which can eliminate tiny noise on the image and smooth the boundary of the object. The process of expanding and then corroding during the closing operation in the image processing can fill the tiny holes in the object and smooth the boundary of the object.
Preferably, the embodiment of the invention adopts an open operation mode to smooth the image, namely, the expansion operation is performed after the corrosion operation is performed.
S43: and carrying out fuzzy processing on the second license plate image through a Gaussian fuzzy algorithm to obtain a simulated license plate image.
Specifically, due to the influence of environmental factors and shooting factors, the shot real license plate image has some thermal noise, shot noise and the like, and Gaussian white noise is added to the image by using a Gaussian blur algorithm aiming at the second license plate image, so that a simulated license plate image is obtained, and the simulated license plate image is more similar to the real license plate image.
Wherein, gaussian in Gaussian white noise (White Gaussian Noise) means that probability distribution is Gaussian distribution, white noise means that the second moment of the white noise is uncorrelated, the first moment is constant, and the correlation of successive signals in time is carried out.
In this embodiment, the pixel values of the pixel points in the initial license plate image are randomly disturbed to obtain a first license plate image with randomly distributed pixel values, and then the first license plate image is subjected to corrosion expansion processing to obtain a second license plate image, and then the second license plate image is subjected to fuzzy processing through a gaussian fuzzy algorithm to obtain a simulated license plate image, so that the obtained fuzzy license plate image is closer to a real license plate image than the initial license plate image, and the quality of the simulated license plate image is improved.
Based on the corresponding embodiment of fig. 5, a detailed description will be given below of a specific implementation method of the first license plate image with randomly distributed pixel values obtained by randomly perturbing the pixel values of the pixel points in the initial license plate image mentioned in step S41 by a specific embodiment.
Referring to fig. 6, fig. 6 shows a specific implementation flow of step S41 provided in the embodiment of the present invention, which is described in detail below:
S411: randomly selecting a preset number of pixel points from a preset real license plate image to serve as sampling points.
Specifically, in order to make the initial license plate image approach to the real license plate image as much as possible, a plurality of pixel points are randomly selected from the photographed real license plate image to serve as sampling points, and then the pixel values of the pixel points in the initial license plate image are randomly disturbed according to the pixel change ranges of the sampling points.
For example, in a specific embodiment, a preset 50 real license plate images with blue base color are selected, 10 pixel points are randomly obtained from each real license plate image as sampling points, and 500 sampling points are obtained.
S412: and acquiring RGB color values of each sampling point, and determining target amplitude for randomly disturbing the pixel values according to the distribution range of the RGB color values.
Specifically, RGB color values of each sampling point are obtained, a distribution range of the RGB color values of the sampling points is determined according to the RGB color values, and the distribution range is used as a target amplitude of random disturbance of pixel values.
The RGB color is a color standard in industry, and various colors are obtained by changing three color channels of red, green and blue and overlapping the three color channels, RGB is a color representing the three color channels of red, green and blue, the standard almost comprises all colors perceived by human eyesight, and the RGB color value is one of the most widely used color systems at present, and comprises a red channel value, a green channel value and a blue channel value.
It should be noted that the disturbance ranges of the values of the red channel, the green channel and the blue channel may be the same or different.
S413: and randomly selecting pixel points in the initial license plate image as target pixel points, and randomly changing pixel values of the target pixel points in the range of target amplitude to obtain a first license plate image with randomly distributed pixel values.
Specifically, after determining a target amplitude for randomly perturbing the pixel values, randomly selecting the pixel points from the initial license plate image as target pixel points, randomly perturbing the target pixel points within the target amplitude range, and further obtaining a first license plate image with randomly distributed pixel values.
Wherein, random perturbation refers to making random changes to pixel values.
It should be noted that, the pixel point selected as the target pixel point may be a part of the pixel points in the license plate image, or may be all the pixel points in the initial license plate image, which may be selected according to the actual situation.
Preferably, in the embodiment of the invention, some pixel points are randomly selected from the pixel points around the license plate number character as target pixel points.
In this embodiment, a preset number of pixel points are randomly selected from a preset real license plate image to serve as sampling points, RGB color values of each sampling point are obtained, a target amplitude for randomly disturbing the pixel values is determined according to a distribution range of the RGB color values, then the pixel points in an initial license plate image are randomly selected to serve as target pixel points, the pixel values of the target pixel points are randomly changed within the range of the target amplitude, and a first license plate image with randomly distributed pixel values is obtained, so that the pixel values of the first license plate image are randomly disturbed to be closer to the real license plate image, and the quality of the simulated license plate image is improved.
On the basis of the corresponding embodiment of fig. 5, a specific implementation method for obtaining the simulated license plate image by blurring the second license plate image by the gaussian blur algorithm mentioned in step S43 is described in detail below by a specific embodiment.
Referring to fig. 7, fig. 7 shows a specific implementation flow of step S43 provided in the embodiment of the present invention, which is described in detail below:
S431: and acquiring a pixel value of each pixel point in the second vehicle image.
Specifically, the pixel value of each pixel point in the second card image is sequentially read.
S432: for each pixel point, updating the pixel value of each pixel point by adopting the following formula to obtain a temporary pixel value of each pixel point:
Wherein, For the temporary pixel value of each pixel, x is the pixel value of each pixel,/>Is a preset average value,/>Is a preset standard deviation,/>Is the circumference ratio,/>Is based on natural constant e, so that/>Is the value of an exponential function of the exponent.
Specifically, for each pixel point, a provisional pixel value obtained by performing gaussian transformation is calculated by the above formula.
Wherein,The acquisition mode is as follows: according to the pixel value of each pixel point in the preset real license plate image, calculating the standard deviation of the pixel points in the preset real license plate image, and taking the standard deviation as the preset standard deviation/>。
Wherein,Is a preset average value, and the acquisition method and the preset standard deviation/>In the same way, the repetition is avoided and will not be repeated here.
S433: and scaling the temporary pixel value of each pixel point to between 0 and 255 according to a preset compression mode to obtain a target pixel value of each pixel point.
Specifically, after gaussian transformation, the pixel value is too large or too small, and at this time, the pixel value needs to be compressed, that is, the pixel value is scaled to be between 0 and 255, specifically: and obtaining the maximum pixel value, calculating the ratio of the maximum pixel value to 255 as a scaling ratio, and dividing the pixel value of all pixels by the scaling ratio to obtain the target pixel value of each pixel point.
It should be noted that, three channels of pixel values, each of which obtains a maximum value as the maximum value of the pixel value in the channel, further performs the calculation of the scaling of the channel.
For example, in one embodiment, the pixel value of a pixel is (116, 52, 296), the pixel value of the blue channel of the pixel is the maximum pixel value of all blue channels, thus the 296/255 value is used as the scaling of the blue channel, and meanwhile, the pixel value of the blue channel of each pixel is divided by the 296/255 value, so as to obtain the target pixel value of the pixel in the blue channel, and similarly, the target pixel values of the red channel and the green channel can be obtained.
S434: and updating the second license plate image by using the target pixel value of each pixel point to obtain a simulated license plate image.
Specifically, the target pixel value calculated in step S433 is used to replace the pixel value in the second license plate image, so as to obtain the simulated license plate image.
In this embodiment, a pixel value of each pixel in the second license plate image is obtained, and then a gaussian blur is used to update the pixel value of each pixel in the second license plate image to obtain a temporary pixel value, and the temporary pixel value of each pixel is scaled to between 0 and 255 according to a preset compression mode to obtain a target pixel value of each pixel, and the target pixel value of each pixel is used to update the second license plate image to obtain a simulated license plate image, so that the simulated license plate image is closer to a real license plate image, and stability of quality of the simulated license plate image is ensured.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
In an embodiment, a license plate image generating device based on style migration is provided, where the license plate image generating device based on style migration corresponds to the license plate image generating method based on style migration in the above embodiment one by one. As shown in fig. 8, the license plate image generating device based on style migration includes a type acquisition module 10, a number generation module 20, an image synthesis module 30, an image preprocessing module 40 and a style migration module 50. The functional modules are described in detail as follows:
The type acquisition module 10 is configured to acquire a license plate type included in the instruction if the instruction for generating the license plate image is received;
the number generation module 20 is configured to generate a random license number according to a license number structure corresponding to a license type;
the image synthesis module 30 is configured to select a character image corresponding to each character in the license plate number from a preset font library, and combine the character images into an initial license plate image;
The image preprocessing module 40 is used for performing image preprocessing on the initial license plate image to obtain a simulated license plate image;
the style migration module 50 is configured to perform style migration on the simulated license plate image by using a style migration algorithm, so as to obtain a target license plate image.
Further, the image preprocessing module 40 includes:
The random disturbance unit 41 is configured to randomly disturb pixel values of pixel points in the initial license plate image to obtain a first license plate image with randomly distributed pixel values;
A corrosion expansion unit 42, configured to perform corrosion expansion processing on the first tile image to obtain a second tile image;
and the Gaussian blur unit 43 is used for performing blur processing on the second license plate image through a Gaussian blur algorithm to obtain a simulated license plate image.
Further, the random perturbation module 41 includes:
A sampling point obtaining subunit 411, configured to randomly select a preset number of pixel points from a preset real license plate image, as sampling points;
A range determining subunit 412, configured to obtain an RGB color value of each sampling point, and determine a target amplitude for randomly perturbing the pixel value according to a distribution range of the RGB color value;
and the pixel disturbing sub-unit 413 is configured to randomly select a pixel point in the initial license plate image as a target pixel point, and randomly change a pixel value of the target pixel point within a range of a target amplitude, so as to obtain a first license plate image with randomly distributed pixel values.
Further, the gaussian blur module 43 includes:
A pixel value obtaining subunit 431, configured to obtain a pixel value of each pixel point in the second board image;
A pixel value updating subunit 432, configured to update, for each pixel point, the pixel value of each pixel point by using the following formula, to obtain a temporary pixel value of each pixel point:
Wherein, For the temporary pixel value of each pixel, x is the pixel value of each pixel,/>Is a preset average value,/>Is a preset standard deviation,/>Is the circumference ratio,/>Is based on natural constant e, so that/>A value that is an exponential function of the exponent;
A pixel value compressing subunit 433, configured to scale the temporary pixel value of each pixel point to between 0 and 255 according to a preset compression manner, so as to obtain a target pixel value of each pixel point;
the image updating subunit 434 is configured to update the second license plate image by using the target pixel value of each pixel point, so as to obtain a simulated license plate image.
Further, the style migration module 50 includes:
An image acquisition unit 51, configured to acquire a preset real license plate image;
The feature extraction unit 52 is configured to perform feature extraction on the real license plate image and the simulated license plate image by using a convolutional neural network VGG-NET model, so as to obtain an initial image feature set of each convolutional layer of the real license plate image in the VGG-NET model, and an initial image feature set of each convolutional layer of the simulated license plate image in the VGG-NET model;
A content feature determining unit 53, configured to select, from an initial image feature set of the simulated license plate image, an image feature of a first preset layer as a content feature;
The style characteristic determining unit 54 is configured to select image characteristics of a second preset layer from an initial image characteristic set of the real license plate image to perform inner product operation, so as to obtain style characteristics;
and the image generating unit 55 is used for performing image feature visualization processing on the style features and the content features by adopting DEEPDREAM algorithm to generate a target license plate image.
Further, the image generation unit 55 includes:
The feature acquisition subunit 551 is configured to acquire a white noise image with the same size as the simulated license plate image as an initial image, and input the initial image into the VGG-NET model for feature extraction, so as to obtain image features of each convolution layer of the initial image in the VGG-NET model;
a weight determining subunit 552 for determining the content feature weight of each convolution layer of the initial image in the VGG-NET model using the following formula And style feature weight/>:
Wherein,As a total loss function,/>For the loss function of image features at each layer of the initial image relative to the content features,/>For the loss function of image features at each layer of the initial image relative to the style features,/>And/>Calculated by a preset loss function calculation formula, and/>+/>=1,/>And/>Is a non-negative number,/>Representing a simulated license plate image,/>Representing a real license plate image,/>Representing an initial image;
A feature updating subunit 553, configured to obtain an image feature after the initial image update according to the content feature, the style feature, the content feature weight of each convolution layer, and the style feature weight of each convolution layer;
A loop iteration subunit 554 for inputting the updated image features into the VGG-NET model and returning to perform the determination of the content feature weights of each convolution layer of the initial image in the VGG-NET model using the following formula And style feature weight/>Until the execution times reach the preset iteration times, obtaining the target image characteristics;
The image determining subunit 555 is configured to generate a target license plate image according to the target image features.
For specific limitations of the license plate image generation device based on style migration, reference may be made to the above limitation of the license plate image generation method based on style migration, and no further description is given here. The modules in the license plate image generating device based on style migration can be all or partially realized by software, hardware and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing a preset license plate number structure and a character library. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a license plate image generation method.
In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the steps of the license plate image generation method based on style migration of the above embodiment, such as steps S10 to S50 shown in fig. 2. Or the processor when executing the computer program implements the functions of each module/unit of the license plate image generating device based on style migration in the above embodiment, such as the functions of the modules 10 to 50 shown in fig. 8. To avoid repetition, no further description is provided here.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, where the computer program when executed by a processor implements the method for generating a license plate image based on style migration in the above method embodiment, or where the computer program when executed by a processor implements the functions of each module/unit in the license plate image generating device based on style migration in the above device embodiment. To avoid repetition, no further description is provided here.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.
Claims (7)
1. The license plate image generation method based on style migration is characterized by comprising the following steps of:
If an instruction for generating license plate images is received, acquiring license plate types contained in the instruction;
generating a random license plate number according to a license plate number structure corresponding to the license plate type;
selecting a character image corresponding to characters contained in the license plate number from a preset font library, and generating an initial license plate image according to the character image and the license plate number;
Performing image preprocessing on the initial license plate image to obtain a simulated license plate image;
performing style migration on the simulated license plate image by using a style migration algorithm to obtain a target license plate image;
performing style migration on the simulated license plate image by using a style migration algorithm to obtain a target license plate image, wherein the step of obtaining the target license plate image comprises the following steps:
acquiring a preset real license plate image;
The method comprises the steps of respectively carrying out feature extraction on a real license plate image and a simulated license plate image by adopting a convolutional neural network VGG-NET model to obtain an initial image feature set of each convolutional layer of the real license plate image in the VGG-NET model and an initial image feature set of each convolutional layer of the simulated license plate image in the VGG-NET model;
Selecting image features of a first preset layer from the initial image feature set of the simulated license plate image as content features;
selecting image features of a second preset layer from the initial image feature set of the real license plate image to perform inner product operation to obtain style features;
performing image feature visualization processing on the style features and the content features by adopting DEEPDREAM algorithm to generate the target license plate image;
performing image feature visualization processing on the style features and the content features by adopting DEEPDREAM algorithm, wherein generating the target license plate image comprises:
Acquiring a preset white noise image with the same size as the simulated license plate image as an initial image, inputting the initial image into the VGG-NET model for feature extraction, and obtaining the image features of each convolution layer of the initial image in the VGG-NET model;
determining content feature weights for each convolution layer of an initial image in the VGG-NET model using the formula And style feature weight/>:
Wherein,As a total loss function,/>For the loss function of image features at each layer of the initial image relative to the content features,/>For the loss function of image features at each layer of the initial image relative to the style features,/>And/>Calculated by a preset loss function calculation formula, and/>+/>=1,/>And/>Is a non-negative number,/>Representing a simulated license plate image,/>Representing a real license plate image,/>Representing an initial image;
Obtaining updated image features of the initial image according to the content features, the style features, the content feature weights of each convolution layer and the style feature weights of each convolution layer;
Inputting the updated image features into the VGG-NET model, and returning to perform the determining of the content feature weights of the initial image at each convolution layer in the VGG-NET model using the following formula And style feature weight/>Until the execution times reach the preset iteration times, obtaining the target image characteristics;
and generating the target license plate image according to the target image characteristics.
2. The license plate image generation method based on style migration as claimed in claim 1, wherein the performing image preprocessing on the initial license plate image to obtain a simulated license plate image comprises:
Randomly disturbing pixel values of pixel points of the initial license plate image to obtain a first license plate image with randomly distributed pixel values;
Carrying out corrosion expansion treatment on the first car plate image to obtain a second car plate image;
and carrying out Gaussian blur on the second license plate image through a Gaussian blur algorithm to obtain a simulated license plate image.
3. The license plate image generation method based on style migration as claimed in claim 2, wherein the randomly perturbing the pixel values of the pixels of the initial license plate image to obtain the first license plate image with randomly distributed pixel values includes:
randomly selecting a preset number of pixel points from a preset real license plate image to serve as sampling points;
Acquiring RGB color values of each sampling point, and determining a target amplitude for randomly disturbing pixel values according to the distribution range of the RGB color values;
And randomly selecting pixel points in the initial license plate image as target pixel points, and randomly changing pixel values of the target pixel points in the range of the target amplitude to obtain the first license plate image with randomly distributed pixel values.
4. The method for generating a license plate image based on style migration as claimed in claim 2, wherein said performing gaussian blur on the second license plate image by a gaussian blur algorithm to obtain a simulated license plate image comprises:
acquiring a pixel value of each pixel point in the second vehicle image;
for each pixel point, updating the pixel value of the pixel point by adopting the following formula to obtain a temporary pixel value:
Wherein, For the temporary pixel value, x is the pixel value of the pixel point,/>Is a preset average value,/>Is a preset standard deviation,/>Is the circumference ratio,/>Is based on natural constant e, so that/>A value that is an exponential function of the exponent;
scaling the temporary pixel value to 0-255 according to a preset compression mode to obtain a target pixel value;
And updating the second license plate image based on the target pixel value of each pixel point to obtain the simulated license plate image.
5. A license plate image generation device based on style migration, characterized in that the license plate image generation device based on style migration includes:
the type acquisition module is used for acquiring license plate types contained in the instruction if the instruction for generating the license plate image is received;
the number generation module is used for generating random license plate numbers according to license plate number structures corresponding to the license plate types;
The image synthesis module is used for selecting a character image corresponding to characters contained in the license plate number from a preset font library, and generating an initial license plate image according to the character image and the license plate number;
The image preprocessing module is used for carrying out image preprocessing on the initial license plate image to obtain a simulated license plate image;
The style migration module is used for performing style migration on the simulated license plate image by using a style migration algorithm to obtain a target license plate image;
the style migration module comprises:
the image acquisition unit is used for acquiring a preset real license plate image;
The feature extraction unit is used for carrying out feature extraction on the real license plate image and the simulated license plate image by adopting a convolutional neural network VGG-NET model to obtain an initial image feature set of each convolutional layer of the real license plate image in the VGG-NET model and an initial image feature set of each convolutional layer of the simulated license plate image in the VGG-NET model;
the content feature determining unit is used for selecting image features of a first preset layer from the initial image feature set of the simulated license plate image as content features;
the style characteristic determining unit is used for selecting image characteristics of a second preset layer from the initial image characteristic set of the real license plate image to perform inner product operation to obtain style characteristics;
The image generation unit is used for carrying out image feature visualization processing on the style features and the content features by adopting DEEPDREAM algorithm to generate the target license plate image;
the image generation unit includes:
The feature acquisition subunit is used for acquiring a white noise image with the same size as the simulated license plate image as an initial image, inputting the initial image into the VGG-NET model for feature extraction, and obtaining the image features of each convolution layer of the initial image in the VGG-NET model;
A weight determination subunit for determining the content feature weight of each convolution layer of the initial image in the VGG-NET model by using the following formula And style feature weight/>:
Wherein,As a total loss function,/>For the loss function of image features at each layer of the initial image relative to the content features,/>For the loss function of image features at each layer of the initial image relative to the style features,/>And/>Calculated by a preset loss function calculation formula, and/>+/>=1,/>And/>Is a non-negative number,/>Representing a simulated license plate image,/>Representing a real license plate image,/>Representing an initial image;
the feature updating subunit is used for obtaining the image feature updated by the initial image according to the content feature, the style feature, the content feature weight of each convolution layer and the style feature weight of each convolution layer;
A loop iteration subunit for inputting the updated image features into the VGG-NET model and returning to perform the determination of the content feature weights of each convolution layer of the initial image in the VGG-NET model using the following formula And style feature weight/>Until the execution times reach the preset iteration times, obtaining the target image characteristics;
and the image determining subunit is used for generating a target license plate image according to the target image characteristics.
6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of license plate image generation based on style migration of any one of claims 1 to 4 when the computer program is executed.
7. A computer-readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the style migration-based license plate image generation method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810978822.5A CN109255772B (en) | 2018-08-27 | 2018-08-27 | License plate image generation method, device, equipment and medium based on style migration |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810978822.5A CN109255772B (en) | 2018-08-27 | 2018-08-27 | License plate image generation method, device, equipment and medium based on style migration |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109255772A CN109255772A (en) | 2019-01-22 |
CN109255772B true CN109255772B (en) | 2024-05-03 |
Family
ID=65049611
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810978822.5A Active CN109255772B (en) | 2018-08-27 | 2018-08-27 | License plate image generation method, device, equipment and medium based on style migration |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109255772B (en) |
Families Citing this family (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110009028B (en) * | 2019-03-28 | 2021-04-02 | 北京科技大学 | Microscopic image data enhancement method and device |
CN110211119B (en) * | 2019-06-04 | 2021-06-04 | 厦门美图之家科技有限公司 | Image quality evaluation method and device, electronic equipment and readable storage medium |
CN110503716B (en) * | 2019-08-12 | 2022-09-30 | 中国科学技术大学 | Method for generating motor vehicle license plate synthetic data |
CN112396076A (en) * | 2019-08-15 | 2021-02-23 | 杭州海康威视数字技术股份有限公司 | License plate image generation method and device and computer storage medium |
CN112464924A (en) * | 2019-09-06 | 2021-03-09 | 华为技术有限公司 | Method and device for constructing training set |
CN110782391B (en) * | 2019-09-10 | 2022-06-03 | 腾讯科技(深圳)有限公司 | Image processing method and device in driving simulation scene and storage medium |
CN111626124B (en) * | 2020-04-24 | 2024-06-11 | 平安国际智慧城市科技股份有限公司 | OCR image sample generation and printing experience verification method, device, equipment and medium |
CN113971627B (en) * | 2020-07-23 | 2023-07-18 | 华为技术有限公司 | License plate picture generation method and device |
CN111986302A (en) * | 2020-07-23 | 2020-11-24 | 北京石油化工学院 | Image style migration method and device based on deep learning |
CN111784569B (en) * | 2020-09-04 | 2020-12-04 | 平安国际智慧城市科技股份有限公司 | Method, device, medium, and apparatus for generating paired license plate images and vehicle images |
CN112489165B (en) * | 2020-11-06 | 2024-02-06 | 中科云谷科技有限公司 | Method, device and storage medium for synthesizing characters |
CN112419186B (en) * | 2020-11-20 | 2024-03-26 | 北京易华录信息技术股份有限公司 | Batch generation method and device for license plate images and computer equipment |
CN113469969B (en) * | 2021-06-29 | 2024-07-02 | 深圳中科飞测科技股份有限公司 | Image generation method, image generation device, detection apparatus, and readable storage medium |
CN114529467A (en) * | 2022-02-07 | 2022-05-24 | 山东极视角科技有限公司 | License plate data enhancement method based on style migration |
CN117236284A (en) * | 2023-11-13 | 2023-12-15 | 江西师范大学 | Font generation method and device based on style information and content information adaptation |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100855450B1 (en) * | 2007-06-04 | 2008-09-01 | 에스케이 텔레콤주식회사 | Method for transferring motion style of movie object and apparatus applied to the same |
CN104504744A (en) * | 2014-12-31 | 2015-04-08 | 深圳市捷顺科技实业股份有限公司 | License plate image composition simulating method and device |
CN107180410A (en) * | 2017-04-11 | 2017-09-19 | 中国农业大学 | The stylized method for reconstructing and device of a kind of image |
CN107689035A (en) * | 2017-08-30 | 2018-02-13 | 广州华多网络科技有限公司 | A kind of homography matrix based on convolutional neural networks determines method and device |
CN108446700A (en) * | 2018-03-07 | 2018-08-24 | 浙江工业大学 | A kind of car plate attack generation method based on to attack resistance |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106709532B (en) * | 2017-01-25 | 2020-03-10 | 京东方科技集团股份有限公司 | Image processing method and device |
-
2018
- 2018-08-27 CN CN201810978822.5A patent/CN109255772B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100855450B1 (en) * | 2007-06-04 | 2008-09-01 | 에스케이 텔레콤주식회사 | Method for transferring motion style of movie object and apparatus applied to the same |
CN104504744A (en) * | 2014-12-31 | 2015-04-08 | 深圳市捷顺科技实业股份有限公司 | License plate image composition simulating method and device |
CN107180410A (en) * | 2017-04-11 | 2017-09-19 | 中国农业大学 | The stylized method for reconstructing and device of a kind of image |
CN107689035A (en) * | 2017-08-30 | 2018-02-13 | 广州华多网络科技有限公司 | A kind of homography matrix based on convolutional neural networks determines method and device |
CN108446700A (en) * | 2018-03-07 | 2018-08-24 | 浙江工业大学 | A kind of car plate attack generation method based on to attack resistance |
Non-Patent Citations (2)
Title |
---|
Stylized Adversarial AutoEncoder for Image Generation;Yiru Zhao et al.;proceedings of the 2017 ACM on multimedia conference;第244-251页 * |
卷积神经网络的风格迁移算法在场景处理中的应用;黄建茂;宜宾学院学报.http://kns.cnki.net/kcms/detail/51.1630.Z.20180517.1717.002.html;第1-7页 * |
Also Published As
Publication number | Publication date |
---|---|
CN109255772A (en) | 2019-01-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109255772B (en) | License plate image generation method, device, equipment and medium based on style migration | |
CN110163235B (en) | Training of image enhancement model, image enhancement method, device and storage medium | |
CN106778928B (en) | Image processing method and device | |
CN112750140B (en) | Information mining-based disguised target image segmentation method | |
CN109147011B (en) | License plate image generation method, license plate image generation device, computer equipment and storage medium | |
CN112330685B (en) | Image segmentation model training method, image segmentation device and electronic equipment | |
CN107358262B (en) | High-resolution image classification method and classification device | |
CN111353512B (en) | Obstacle classification method, obstacle classification device, storage medium and computer equipment | |
CN109886077B (en) | Image recognition method and device, computer equipment and storage medium | |
CN109325989A (en) | License plate image generation method, device, equipment and medium | |
CN110516541B (en) | Text positioning method and device, computer readable storage medium and computer equipment | |
Samat et al. | Classification of VHR multispectral images using extratrees and maximally stable extremal region-guided morphological profile | |
CN114092833B (en) | Remote sensing image classification method and device, computer equipment and storage medium | |
CN109472193A (en) | Method for detecting human face and device | |
CN112966685B (en) | Attack network training method and device for scene text recognition and related equipment | |
CN109165654B (en) | Training method of target positioning model and target positioning method and device | |
CN109242796A (en) | Character image processing method, device, electronic equipment and computer storage medium | |
CN111680675A (en) | Face living body detection method, system, device, computer equipment and storage medium | |
CN112001285B (en) | Method, device, terminal and medium for processing beauty images | |
CN110580507B (en) | City texture classification and identification method | |
CN113469092A (en) | Character recognition model generation method and device, computer equipment and storage medium | |
CN110414516B (en) | Single Chinese character recognition method based on deep learning | |
CN116844052A (en) | Method, device and equipment for resisting attack by deployable patches facing remote sensing image | |
CN111368889A (en) | Image processing method and device | |
CN112464924A (en) | Method and device for constructing training set |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |