A data enhancement method based on generative adversarial network
Through generative adversarial networks and 3D reconstruction technology, generative adversarial networks and 3D reconstruction technology solve the problem of uneven distribution of computer vision model training data sets, generate new training data, and improve the performance of the vehicle Re-ID model.
Patent Information
- Application Number
- CN202110703465.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-24
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-06-24
AI Technical Summary
Existing computer vision model training data sets are unevenly distributed, resulting in poor model performance. Traditional data enhancement methods only copy the original data and cannot effectively improve performance. Especially in vehicle image-related tasks, new data is mainly concentrated on a manifold. The full sample space information cannot be supplemented.
A data enhancement method based on generative adversarial networks is used to extract image features, generate a 3D skeleton, perform perspective regression and three-dimensional affine transformation, generate a 2D image from a new perspective, and fine-tune the image repair model to ensure attribute invariance and generate new training data.
Through the feature extraction and 3D reconstruction of the generative adversarial network, new training samples are generated, which supplements the perspective dimension information, improves the performance of the vehicle Re-ID model, provides a more comprehensive training data set, and enhances the model performance.
Smart Images

Figure CN113487715B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision and image generation, and in particular relates to a data enhancement method based on a generative adversarial network. Background Art
[0002] When training computer vision models, poor model performance is often caused by insufficient training data sets. The reason is that the training set is unevenly distributed in the entire sample space and is only on a special manifold in the entire sample space. The training sample cannot "perfectly summarize" the entire sample space, resulting in incomplete information received by the model, which in turn affects its performance. In order to reduce this effect, some scholars have begun to try data enhancement.
[0003] Traditional data augmentation methods are limited to some common intuitive means such as image translation, rotation, flipping, adding noise, etc. In theory, this data augmentation method only "copies" the original training set and does not add new training data information, which has little effect on improving the performance of the model.
[0004] For visual tasks related to vehicle images, a large amount of new vehicle image data is generated in each city every day. Although the data is large, it is basically concentrated in a manifold. Either the city does not change, or the distribution of different vehicles in different cities remains fixed (for example, in heavy industrial cities, there will be more large trucks). Summary of the invention
[0005] The purpose of the present invention is to provide a data enhancement method based on a generative adversarial network to address the deficiencies of the prior art.
[0006] The objective of the present invention is achieved through the following technical solutions: A data enhancement method based on a generative adversarial network, comprising: first extracting image features and encoding them into a feature space. Then generating a 3D skeleton, integrating the extracted image features into the 3D skeleton, and rendering to generate a 3D frame. Then performing perspective regression of the 3D frame. Then using a three-dimensional affine transformation, generating a 3D frame of a new perspective. Further reducing the dimension of the 3D frame and projecting it into a 2D image. Finally, fine-tuning the image restoration model to obtain the final generated new perspective image.
[0007] Furthermore, the method specifically includes the following steps:
[0008] (1) Given the original image x to be processed ori , through a feature extraction module consisting of a convolutional layer, to obtain its high-order feature attr ori :
[0009] attr ori =Encoder(x ori )
[0010] (2) Build a 3D skeleton, whose network layer is composed of 3D convolutions, and the input is a learnable 3D tensor input, aiming to reconstruct a positive 3D skeleton from the input. ori Fusion rendering into the 3D skeleton to form a 3D framework of the input image x 3D-ori :
[0011] x 3D-ori =3Dmodel(attr ori )
[0012] (3) 3D frame x 3D-ori Input the perspective regression model and perform the perspective regression task to obtain θ1:
[0013] θ1=viewregression(x 3D-ori )
[0014] Since the initially generated perspective is expected to be a positive perspective (0, 90, 90), a loss penalty loss is given oriview :
[0015]
[0016] (4) Select the new target angle θ target , perform three-dimensional affine transformation to generate a new perspective 3D frame c 3D-new :
[0017] x 3D-new =Affine(x 3D-ori θ target )
[0018] At the same time, enter x 3D-new Perform perspective regression on the regression model to obtain θ2:
[0019] θ2=viewregression(x 3D-new )
[0020] Give a new perspective on the loss penalty loss newview :
[0021]
[0022] (5) Perform a 3D-to-2D projection operation from a new perspective to generate image x new :
[0023] x new =Projection(x 3D-new )
[0024] Then connect an image restoration model to generate image fine-tuning, and finally generate a new perspective image x newview :
[0025] x newview =Repairmode(x new )
[0026] (6) In order to ensure the invariance of other attributes, the image x newview Input it again into the feature extraction module in step (1) to extract the high-order feature attr newview :
[0027] attr newview =Encoder(x newview )
[0028] Given feature reconstruction loss loss attr :
[0029]
[0030] The final total loss is:
[0031] loss=loss oriview +loss newview +loss attr +loss adversarial
[0032] Among them, loss adversarial Refers to the adversarial loss of the Generative Adversarial Network.
[0033] Furthermore, in step (2), the input is used as a learnable parameter and not as a formal input to the model.
[0034] Furthermore, the 3D skeleton is a rough skeleton, which can form a corresponding 3D frame only after being fused with the extracted image features, and the fusion method adopts feature splicing or adaptive regularization method, etc.
[0035] The beneficial effects of the present invention are as follows: the present invention renders the deep features of the vehicle image onto a given three-dimensional structure through feature extraction of a generative adversarial network, completes the reconstruction of a two-dimensional image into a three-dimensional structure, and then performs three-dimensional monocular projection to obtain its two-dimensional image at the desired viewing angle, thereby completing the generation of vehicle images at different viewing angles. The present invention makes a correction attempt based on the prior art noise-to-image, so that it completes the conversion from noise-to-image to image-to-image, after which it can modify a specific attribute (vehicle viewing angle, etc.) in a targeted manner to generate an image from a new viewing angle. The enhanced data set of the present invention can be used to serve the existing Re-ID model to enhance its performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention.
[0037] Figure 1 Generate a model framework diagram for the entire model.
[0038] Figure 2 This is a flow chart of a data enhancement method based on a generative adversarial network of the present invention. DETAILED DESCRIPTION
[0039] The present invention will be described in detail below with reference to the accompanying drawings.
[0040] The popularity of image generation based on generative adversarial networks (GANs) in the field of image generation also shows the value of its existence. We use GANs not at the copying level, but to fit the sampling probability of training samples, and then sample new samples from the overall sample space. The new image obtained in this way is not simply a "copy" of the original image, but provides a brand new training sample, increasing the training sample capacity.
[0041] The present invention starts from the perspective. Due to the change of camera position in urban roads, many vehicle images with different perspectives are generated. In order to complete the information of perspective dimension, we have made an enhancement method for perspective generation. On the premise of keeping the original attributes unchanged, a data enhancement method for image feature editing is provided to perform controllable feature editing of images.
[0042] In the new perspective generation task, since the vehicle pixels physically shift before and after the perspective is generated, we perform 3D reconstruction of the image based on the high-order feature loss of the image. With the 3D model, we can generate a projection image with controllable perspective. This ensures that the image after feature editing is still the object of the original image, but the perspective is changed, and its high-order features do not change significantly. Its feature preservation loss attribute for:
[0043]
[0044] Among them, x real-abstract 、x reconst-abstract They represent the high-order features extracted from the original input image and the high-order features of the generated image after feature editing, Represents the square of the 1-norm. At this point, we need to build a feature extraction model Encoder, which is used to extract high-order features of the image.
[0045] We did not choose to directly generate a 3D reconstruction model of the image, but first generated a forward rough skeleton, and then integrated the features of the original image into the 3D skeleton to perform 3D reconstruction of the image. To this end, we established a 3D convolutional neural network to reconstruct a 3D skeleton framework through a low-dimensional 3D tensor. During the reconstruction process, we incorporated the extracted high-order features of the image in an adaptive instance normalization manner (or feature splicing). In the process of modeling the 3D image, we gradually integrated the features and fine-tuned the details of the 3D model until the 3D modeling was completed.
[0046] In order to perform controllable feature editing, we need to install a regressor after the 3D reconstruction model to perform perspective prediction regression. The classification branch is not selected because perspective classification will cause inevitable errors because there is still a range of sample perspectives in the category. Then, we perform three-perspective regression of the 3D vehicle model. That is, assuming that a three-dimensional rectangular coordinate system is established with the forward direction as the positive axis, its three perspectives are the angles between the vehicle and the three coordinate axes. With the accurate regression of the three perspectives, the controllability of the perspective of the vehicle image is guaranteed.
[0047] Having completed 3D modeling and perspective regression, we will now make a controllable perspective transformation. With a forward 3D framework, we need to introduce a 3D affine transformation matrix A, whose elements are determined by the three perspectives we need to transform. We will not expand on this here. It is worth mentioning that a 3D affine transformation with coincident origins only requires a 3*3 matrix. With the addition of a bias term, we use a 3*4 matrix for affine transformation of 3D images:
[0048] x 3D-new =A*x 3D-original
[0049] Among them, x 3D-new 、x 3D-original Represents the affine transformed 3D image and its original image.
[0050] After completing the affine transformation of the original 3D frame, we need to perform a 3D to 2D projection operation to transform back to the 2D image space for new perspective image generation.
[0051] Preferably, in order to prevent the appearance of the blocked part of the original image after the perspective change, resulting in unnecessary holes or blur in the generated image, the present invention connects an image repair module (fine-grained image correction) after the projection is completed, aiming to extract long-distance pixel information for image repair and restoration, making it more realistic.
[0052] like Figure 1 and Figure 2As shown, the present invention provides a data enhancement method based on a generative adversarial network, comprising the following steps:
[0053] Step 1: Given the original image x to be processed ori , through a feature extraction module Encoder composed of a convolutional layer, obtain its high-order feature attr ori :
[0054] attr ori =Encoder(x ori )
[0055] Among them, image feature extraction can be used to limit the conservation of features of the generated image except for the modified features.
[0056] Step 2: Build a 3D reconstruction model whose network layer is composed of 3D convolutions and whose input is a learnable 3D tensor input. The purpose is to reconstruct the positive 3D skeleton from the input (the input is a learnable parameter and not a formal input of the model). In the process of 3D reconstruction, an adaptive normalization layer is introduced to speed up the model training and reduce the uneven scale of each dimension. At the same time, the high-order feature attr extracted by the encoder is converted into ori Rendered into the 3D skeleton, forming a 3D model x belonging to the input image 3D-ori :
[0057] x 3D-ori =3Dmodel(attr ori )
[0058] Among them, 3Dmodel is attr ori Function representation of the rendered 3D skeleton.
[0059] Step 3: X the 3D frame 3D-ori The input is given to the view regression model, and the view regression task is performed to obtain θ1:
[0060] θ1=viewregression(x 3D-ori )
[0061] Among them, viewregression is the function representation of view regression.
[0062] Since the initially generated perspective is expected to be a positive perspective, the three perspectives are (0, 90, 90), and we give a loss penalty loss oriview :
[0063]
[0064] Step 4: Select a three-view combination θtarget , perform affine transformation to generate a new perspective 3D frame x 3D-new :
[0065] x 3D-new =Affine(x 3D-ori θ target )
[0066] Affine is the function representation of affine transformation. The three-dimensional affine transformation here is introduced as a traditional mathematical method, the method is fixed and is not used as a training module.
[0067] At the same time, enter x 3D-new Perform perspective regression on the regression model to obtain θ2:
[0068] θ2=viewregression(x 3D-new )
[0069] Give a new perspective on the loss penalty loss newview :
[0070]
[0071] Step 5: Perform a 3D-to-2D projection operation from a new perspective to generate image x new :
[0072] x new =Projection(x 3D-new )
[0073] Among them, Projection is the function representation of the projection operation.
[0074] Then connect an image restoration model to generate image fine-tuning:
[0075] x newview =Repairmode(x new )
[0076] Among them, Repairmode is the function representation of image repair. The output x newview That is the new viewing angle image finally generated by the present invention.
[0077] Step 6: In order to ensure the invariance of other attributes, we generate the image x newview Input into Encoder again for high-order feature attr newview extract:
[0078] attr newview =Encoder(x newview )
[0079] Given feature reconstruction loss lossattr :
[0080]
[0081] Finally, the total loss of the entire model is:
[0082] loss=loss oriview +loss newview +loss attr +loss adversarial
[0083] Among them, the last loss adversarial The loss function designed by the present invention can ensure the invariance of other unmodified attributes and the view change restriction of the controllable view.
Claims
1. A data enhancement method based on generative adversarial network, characterized in that: include: First, extract image features and encode them into feature space; Then generate a 3D skeleton, merge the extracted image features into the 3D skeleton, and render to generate a 3D frame; then perform perspective regression of the 3D frame; then use three-dimensional affine transformation to generate a 3D frame with a new perspective; further reduce the dimension of the 3D frame and project it into a 2D image; finally, fine-tune the image restoration model to obtain the final generated image with a new perspective; The specific steps include: (1) Given the original image x to be processed ori , through a feature extraction module consisting of a convolutional layer, to obtain its high-order feature attr ori : attr ori =Encoder(x ori ) (2) Build a 3D skeleton, whose network layer is composed of 3D convolutions and takes as input a learnable 3D tensor input, aiming to reconstruct a positive 3D skeleton from the input; transform the high-order feature attr extracted in step (1) into ori Fusion rendering into the 3D skeleton to form a 3D framework of the input image x 3D-ori : x 3D-ori =3Dmodlel(attr ori ) (3) 3D frame x 3D-ori Input the view regression model and perform the view regression task to obtain θ1: θ1=viewregression(x 3D-ori ) Since the initially generated perspective is expected to be a positive perspective (0, 90, 90), a loss penalty loss is given oriview : (4) Select the new target angle θ target , perform three-dimensional affine transformation to generate a new perspective 3D frame x 3D-new : x 3D-new =Affine(x 3D-ori ;θ target ) At the same time, enter x 3D-new Perform perspective regression on the regression model to obtain θ2: θ2=viewregression(x 3D-new ) Give a new perspective on the loss penalty loss newview : (5) Perform a 3D-to-2D projection operation from a new perspective to generate image x new : x new =Projection(x 3D-new ) Then connect an image restoration model to generate image fine-tuning, and finally generate a new perspective image x newview : x newview =Repairmode(x new ) (6) In order to ensure the invariance of other attributes, the image x newview Input it again into the feature extraction module in step (1) to extract the high-order feature αttr newview : attr newview =Encoder(x newview ) Given feature reconstruction loss loss attr : The final total loss is: loss=loss oriview +loss newview +loss attr +loss adversarial Among them, loss adversarial Refers to the adversarial loss of the Generative Adversarial Network.
2. The data enhancement method based on generative adversarial network according to claim 1, characterized in that: In step (2), the input is used as a learnable parameter and not as a formal input to the model.
3. The data enhancement method based on generative adversarial network according to claim 1, characterized in that: The 3D skeleton is a rough skeleton, which can form a corresponding 3D frame only after being fused with the extracted image features. The fusion method adopts feature splicing or adaptive regularization method.
