WO2021139120A1 - 网络训练方法及装置、图像生成方法及装置 - Google Patents

网络训练方法及装置、图像生成方法及装置 Download PDF

Info

Publication number
WO2021139120A1
WO2021139120A1 PCT/CN2020/099953 CN2020099953W WO2021139120A1 WO 2021139120 A1 WO2021139120 A1 WO 2021139120A1 CN 2020099953 W CN2020099953 W CN 2020099953W WO 2021139120 A1 WO2021139120 A1 WO 2021139120A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
network
training
discriminant
generation
Prior art date
Application number
PCT/CN2020/099953
Other languages
English (en)
French (fr)
Inventor
潘新钢
詹晓航
戴勃
林达华
罗平
Original Assignee
北京市商汤科技开发有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 北京市商汤科技开发有限公司 filed Critical 北京市商汤科技开发有限公司
Priority to KR1020227024492A priority Critical patent/KR20220116015A/ko
Publication of WO2021139120A1 publication Critical patent/WO2021139120A1/zh
Priority to US17/853,816 priority patent/US20220327385A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/088Non-supervised learning, e.g. competitive learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/047Probabilistic or stochastic networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4046Scaling of whole images or parts thereof, e.g. expanding or contracting using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/60Image enhancement or restoration using machine learning, e.g. neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Definitions

  • the present disclosure relates to the field of computer technology, in particular to a network training method and device, and an image generation method and device.
  • Deep Image Prior proposes that a randomly initialized convolutional neural network has low-level image priors, which can be used to achieve super-resolution and image completion.
  • the present disclosure proposes a technical solution for network training and image generation.
  • a network training method including: inputting latent vectors into a pre-trained generation network to obtain a first generated image, and the generation network is trained against the discrimination network through multiple natural images. Performing degradation processing on the first generated image to obtain a first degraded image of the first generated image; training the latent vector and the generated image according to the first degraded image and the second degraded image of the target image Network, wherein the trained generation network and the trained latent vector are used to generate the reconstructed image of the target image.
  • training the latent vector and the generation network according to the first degraded image and the second degraded image of the target image includes: combining the first degraded image and the second degraded image of the target image The two degraded images are respectively input into the pre-trained discriminant network for processing to obtain the first discriminant feature of the first degraded image and the second discriminant feature of the second degraded image; according to the first discriminant feature and the second discriminant feature Discriminating features, training the hidden vector and the generating network.
  • the discriminant network includes a multi-level discriminant network block
  • the first degraded image and the second degraded image of the target image are respectively input into a pre-trained discriminant network for processing to obtain the first degraded image and the second degraded image of the target image.
  • the first discriminant feature of the degraded image and the second discriminant feature of the second degraded image include: inputting the first degraded image into the discriminant network for processing to obtain the output of the multi-level discriminant network block of the discriminant network A plurality of first discriminant features; input the second degraded image into the discriminant network for processing to obtain a plurality of second discriminant features output by the multi-level discriminant network block of the discriminant network.
  • training the latent vector and the generating network according to the first discriminant feature and the second discriminant feature includes: according to the first discriminant feature and the second discriminant feature The distance between the features determines the network loss of the generation network; according to the network loss of the generation network, the hidden vector and the generation network are trained.
  • the generation network includes N-level generation network blocks
  • training the latent vector and the generation network according to the network loss of the generation network includes: training the latent vector and the generation network according to the n-1th round of training The network loss of the generating network, training the first n-level generating network blocks of the generating network, and obtaining the generating network after the nth round of training, 1 ⁇ n ⁇ N, n and N are integers.
  • the method further includes: inputting a plurality of initial latent vectors into a pre-trained generation network to obtain a plurality of second generated images; according to the target image and the plurality of second generated images The difference information between, the hidden vector is determined from the plurality of initial hidden vectors.
  • the method further includes: inputting the target image into a pre-trained coding network, and outputting the hidden vector.
  • the method further includes: inputting the trained latent vector into the trained generation network to obtain a reconstructed image of the target image, wherein the reconstructed image includes a color image, and the target The second degraded image of the image includes a grayscale image; or the reconstructed image includes a complete image, and the second degraded image includes a missing image; or the resolution of the reconstructed image is greater than the resolution of the second degraded image.
  • an image generation method including: performing perturbation processing on a first latent vector by random jitter information to obtain a perturbed first latent vector; and inputting the perturbed first latent vector Process in the first generation network to obtain a reconstructed image of the target image.
  • the position of the object in the reconstructed image is different from the position of the object in the target image, wherein the first latent vector and the first generation network are based on The above network training method is trained.
  • an image generation method including: inputting a second latent vector and category features of a preset category into a second generation network for processing to obtain a reconstructed image of a target image, the second generation network It includes a conditional generation network, the category of the object in the reconstructed image includes the preset category, and the category of the object in the target image is different from the preset category, wherein the second latent vector and the second generation The network is trained according to the above-mentioned network training method.
  • an image generation method including: performing interpolation processing on a third hidden vector, a fourth hidden vector, a parameter of a third generation network, and a parameter of a fourth generation network, respectively, to obtain at least one interpolation value Latent vectors and at least one parameter of the interpolation generating network, the third generating network is used to generate the reconstructed image of the first target image according to the third latent vector, and the fourth generating network is used to generate the reconstructed image of the second target image according to the fourth latent vector ;
  • Each interpolation hidden vector is input into the corresponding interpolation generation network to obtain at least one deformed image, the posture of the object in the at least one deformed image is in the posture of the object in the first target image and the object in the second target image.
  • a network training device including: a first generation module, configured to input latent vectors into a pre-trained generation network to obtain a first generated image, and the generation network is connected to the discriminant network.
  • a natural image confrontation training ; a degradation module, used to perform degradation processing on the first generated image to obtain a first degraded image of the first generated image; a training module, used to perform a degradation process based on the first degraded image and For the second degraded image of the target image, the latent vector and the generating network are trained, wherein the trained generating network and the trained latent vector are used to generate the reconstructed image of the target image.
  • the training module includes: a feature acquisition sub-module, configured to input the first degraded image and the second degraded image of the target image into a pre-trained discriminant network for processing, to obtain the The first discriminant feature of the first degraded image and the second discriminant feature of the second degraded image; a first training sub-module for training the hidden vector according to the first discriminant feature and the second discriminant feature And the generating network.
  • the discriminant network includes a multi-level discriminant network block
  • the feature acquisition submodule includes: a first acquisition submodule, configured to input the first degraded image into the discrimination network for processing To obtain a plurality of first discriminant features output by the multi-level discriminant network block of the discriminant network; the second acquisition sub-module is used to input the second degraded image into the discriminant network for processing to obtain the discriminant network Multiple second discriminant features output by the multi-level discriminant network block.
  • the first training sub-module includes: a loss determination sub-module, configured to determine the distance between the first discriminant feature and the second discriminant feature Network loss; a second training sub-module for training the latent vector and the generation network according to the network loss of the generation network.
  • the generative network includes N-level generative network blocks
  • the second training sub-module is used to train the generative network according to the network loss of the generative network after the n-1th round of training
  • the first n levels of the generated network block are obtained, and the generated network after the nth round of training is obtained, 1 ⁇ n ⁇ N, and n and N are integers.
  • the device further includes: a second generation module, configured to input a plurality of initial latent vectors into the pre-trained generation network to obtain a plurality of second generated images; and a first vector determination module, using According to the difference information between the target image and the plurality of second generated images, the hidden vector is determined from the plurality of initial hidden vectors.
  • a second generation module configured to input a plurality of initial latent vectors into the pre-trained generation network to obtain a plurality of second generated images
  • a first vector determination module using According to the difference information between the target image and the plurality of second generated images, the hidden vector is determined from the plurality of initial hidden vectors.
  • the device further includes: a second vector determining module, configured to input the target image into a pre-trained coding network, and output the hidden vector.
  • the device further includes: a first reconstruction module, configured to input the trained latent vector into the trained generation network to obtain a reconstructed image of the target image, wherein the reconstructed image Including a color image, the second degraded image of the target image includes a grayscale image; or the reconstructed image includes a complete image, and the second degraded image includes a missing image; or the resolution of the reconstructed image is greater than that of the second The resolution of the degraded image.
  • a first reconstruction module configured to input the trained latent vector into the trained generation network to obtain a reconstructed image of the target image, wherein the reconstructed image Including a color image, the second degraded image of the target image includes a grayscale image; or the reconstructed image includes a complete image, and the second degraded image includes a missing image; or the resolution of the reconstructed image is greater than that of the second The resolution of the degraded image.
  • an image generation device including: a disturbance module, configured to perform disturbance processing on a first latent vector by random jitter information to obtain a disturbed first latent vector; and a second reconstruction module, using The first latent vector after the disturbance is input into the first generation network for processing to obtain a reconstructed image of the target image.
  • the position of the object in the reconstructed image is different from the position of the object in the target image.
  • a latent vector and the first generation network are obtained by training according to the above-mentioned network training device.
  • an image generation device including: a third reconstruction module, configured to input the second latent vector and the category features of the preset category into the second generation network for processing to obtain a reconstructed image of the target image
  • the second generation network includes a conditional generation network, the category of the object in the reconstructed image includes the preset category, the category of the object in the target image is different from the preset category, and the second hidden
  • the vector and the second generation network are obtained by training according to the above-mentioned network training device.
  • an image generation device including: an interpolation module for performing interpolation processing on the third hidden vector and the fourth hidden vector, the parameters of the third generation network and the parameters of the fourth generation network, respectively , Obtain at least one interpolation hidden vector and at least one parameter of the interpolation generation network, the third generation network is used to generate the reconstructed image of the first target image according to the third hidden vector, and the fourth generation network is used to generate the second image according to the fourth hidden vector A reconstructed image of the target image; a deformed image acquisition module for inputting each interpolation hidden vector into a corresponding interpolation generation network to obtain at least one deformed image, and the posture of the object in the at least one deformed image is in the first target image Between the posture of the object and the posture of the object in the second target image, wherein the third hidden vector and the third generation network, the fourth hidden vector and the fourth generation network are based on the above Trained by a network training device.
  • an electronic device including: a processor; a memory for storing executable instructions of the processor; wherein the processor is configured to call the instructions stored in the memory to execute the foregoing method.
  • a computer-readable storage medium having computer program instructions stored thereon, and the computer program instructions implement the above-mentioned method when executed by a processor.
  • a computer program including computer readable code, and when the computer readable code runs in an electronic device, a processor in the electronic device executes the above-mentioned image processing method.
  • the generated image can be obtained through the pre-trained generation network, and the latent vector and the generation network are trained at the same time according to the difference between the degraded image of the generated image and the degraded image of the original image, thereby improving the training effect of the generated network , To achieve more accurate image reconstruction.
  • Fig. 1 shows a flowchart of a network training method according to an embodiment of the present disclosure.
  • Fig. 2 shows a schematic diagram of a training process of a generative network according to an embodiment of the present disclosure.
  • Fig. 3 shows a block diagram of a network training device according to an embodiment of the present disclosure.
  • Fig. 4 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • Fig. 5 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • image restoration and image editing applications or software it is usually necessary to reconstruct the target image to achieve image restoration and/or image manipulation tasks such as colorization, image completion, super-resolution, confrontation defense, and image deformation.
  • image reconstruction the generative network in Generative Adversarial Networks (GAN for short) learned from large-scale natural images can be used as a general image prior, and the hidden vectors and generator parameters can be optimized for image reconstruction.
  • GAN Generative Adversarial Networks
  • Fig. 1 shows a flowchart of a network training method according to an embodiment of the present disclosure. As shown in Fig. 1, the network training method includes:
  • step S11 the latent vector is input to the pre-trained generation network to obtain the first generated image, and the generation network is obtained by training against the discriminant network through multiple natural images;
  • step S12 performing degradation processing on the first generated image to obtain a first degraded image of the first generated image
  • step S13 the latent vector and the generating network are trained according to the first degraded image and the second degraded image of the target image, wherein the trained generating network and the trained latent vector are used to generate the The reconstructed image of the target image.
  • the network training method can be executed by electronic equipment such as a terminal device or a server, and the terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, or a cordless
  • UE user equipment
  • PDAs personal digital assistants
  • the method can be implemented by a processor invoking computer-readable instructions stored in a memory.
  • the method can be executed by a server.
  • the adversarial generative network is a widely used generative model, which includes a generative network G (Generator) and a discriminant network D (Discriminator).
  • the generative network G is responsible for mapping the latent vector to the generated image
  • the discriminating network D is responsible for distinguishing Generate images and real images.
  • the hidden vector can be sampled from a multivariate Gaussian distribution, for example.
  • the generation network G and the discriminant network D are trained through adversarial learning. After the training is completed, the generated network G can be used to sample the synthesized image.
  • a plurality of natural images can be used to counter-train the generation network and the discrimination network, and the natural image can be an image that objectively reflects a natural scene. Taking a large number of natural images as samples can make the generation network and the discriminant network learn more general image prior information. After confrontation training, a pre-trained generation network and a discriminant network can be obtained.
  • the present disclosure does not limit the selection of natural images and the specific training methods of confrontation training.
  • x is the original natural image (which can be called the target image)
  • a degraded image an image that has lost some information (for example: loss of color, loss of image blocks, loss of resolution, etc., this type of image is referred to as a degraded image below).
  • the type of loss information which can be regarded as the result of degrading the target image (that is, through Obtained), where ⁇ is the corresponding degenerate transformation (for example, ⁇ can be a grayscale transformation such that a color image becomes a grayscale image).
  • the degraded image can be Perform image reconstruction in the degraded space.
  • the latent vector may be input into the pre-trained generation network in step S11 to obtain the first generated image.
  • the hidden vector may be, for example, a hidden vector initialized randomly, which is not limited in the present disclosure.
  • the first generated image may be degraded in step S12 to obtain the first degraded image of the first generated image.
  • the manner of the degradation processing is the same as the manner of degrading the target image, for example, gray-scale processing.
  • step S13 based on the difference (such as similarity or distance) between the first degraded image of the first generated image and the second degraded image of the target image, the latent vector and the generated network Conduct training.
  • the training goal of the generative network can be expressed as:
  • can represent the parameters of the generating network G
  • z can represent the hidden vector to be trained
  • G(z, ⁇ ) represents the first generated image
  • ⁇ (G(z, ⁇ )) represents the first generated image
  • the degraded image of the image may be called the first degraded image
  • Represents the degraded image of the target image may be referred to as the second degraded image
  • L represents the similarity measure between the first degraded image and the second degraded image.
  • z* can represent the hidden vector after training
  • ⁇ * can represent the parameters of the generated network after training
  • x* can represent the reconstructed image of the target image.
  • the network loss can be determined according to the similarity between the first degraded image and the second degraded image, and the hidden vector and the parameters of the generated network can be iterated to optimize the hidden vector and generate the parameters of the network according to the network loss to make the network loss converge and obtain the hidden hidden after training.
  • Vector sum generative network The latent vector after the training and the generation network are used to generate a reconstructed image of the target image and restore the image information in the target image. Since the generation network G has learned the distribution of natural images, the reconstructed x* will recover The missing natural image information. For example, if It is a grayscale image, and x* is the matching color image.
  • the parameters of the hidden vector and the generation network can be adjusted through the backpropagation algorithm and the ADAM (adaptive moment estimation) optimization algorithm. There are no restrictions on training methods.
  • the generated image can be obtained through the pre-trained generation network, and the latent vector and the generation network can be trained at the same time according to the difference between the degraded image of the generated image and the degraded image of the original image, thereby improving the training effect of the generated network , To achieve more accurate image reconstruction.
  • the hidden vector to be trained may be determined first.
  • the hidden vector can be obtained directly, for example, by random sampling from a multivariate Gaussian distribution, or can be obtained in other ways.
  • the method further includes: inputting a plurality of initial latent vectors into a pre-trained generation network to obtain a plurality of second generated images; according to the target image and the plurality of second generated images The difference information between, the hidden vector is determined from the plurality of initial hidden vectors.
  • multiple initial latent vectors can be randomly sampled, and each initial latent vector is input into the pre-trained generation network G to obtain multiple second generated images.
  • the difference information between the original target image and each second generated image can be obtained, for example, the similarity (such as L1 distance) between the target image and each second generated image can be calculated, and the one with the smallest difference (that is, the largest similarity) can be determined
  • the second generated image, and the initial hidden vector corresponding to the second generated image may be determined as the hidden vector to be trained. In this way, the determined hidden vector can be made closer to the image information of the target image, thereby improving the training efficiency.
  • the method further includes: inputting the target image into a pre-trained coding network, and outputting the hidden vector.
  • a coding network for example, a convolutional neural network
  • the coding network can be pre-trained through sample images to obtain a pre-trained coding network.
  • the sample image is input into the coding network to obtain the hidden vector, and then the hidden vector is input into the pre-trained generation network to obtain the generated image; the coding network is trained according to the difference between the generated image and the sample image, and the present disclosure does not limit the specific training method .
  • the target image can be input to the pre-trained coding network, and the hidden vector to be trained is output. In this way, the determined hidden vector can be made closer to the image information of the target image, thereby improving the training efficiency.
  • step S13 may include:
  • the generation network can be trained according to the discriminant network corresponding to the generation network.
  • the first degraded image and the second degraded image of the target image can be separately input into the pre-trained discriminant network for processing, and the first discriminant feature of the first degraded image and the second discriminative feature of the second degraded image are output; according to the first The discriminant feature and the second discriminant feature are used to train the hidden vector and the generating network.
  • the L1 distance between the first discriminant feature and the second discriminant feature is used to determine the network loss of the generated network, and then the hidden vector and the parameters of the generated network are adjusted according to the network loss. In this way, the authenticity of the reconstructed image can be better preserved.
  • the discriminant network includes a multi-level discriminant network block
  • the first degraded image and the second degraded image of the target image are respectively input into a pre-trained discriminant network for processing to obtain the first discriminant feature of the first degraded image and the second discriminative feature of the second degraded image, include:
  • the second degraded image is input into the discriminant network for processing, and multiple second discriminant features output by the multi-level discriminant network block of the discriminant network are obtained.
  • the discriminant network may include multi-level discriminant network blocks.
  • Each discriminant network block may be, for example, a residual block.
  • Each residual block includes, for example, at least one residual layer, a fully connected layer, and a pooling layer.
  • the present disclosure does not limit the specific structure of each discriminating network block.
  • the first degraded image can be input into the discriminant network for processing, and the first discriminant features output by the discriminant network blocks at all levels can be obtained; similarly, the second degraded image can be input into the discriminant network for processing. Obtain the second discriminant feature output by the discriminant network block at all levels. In this way, the characteristics of different depths of the discriminating network can be obtained, so that the subsequent similarity measurement is more accurate.
  • the step of training the latent vector and the generating network may include:
  • the network loss of the generation network is determined; and the hidden vector and the generation network are trained according to the network loss of the generation network.
  • the L1 distance between multiple first discriminant features and multiple second discriminant features can be determined:
  • x 1 can represent the first degraded image
  • x 2 can represent the second degraded image
  • D(x 1 ,i) and D(x 2 ,i) can respectively represent the output of the i-th discriminant network block
  • the first discriminant feature and the second discriminant feature, I represents the number of stages of the discriminant network block, 1 ⁇ i ⁇ I, i, I are integers.
  • the L1 distance can be directly used as the network loss of the generating network; the L1 distance can also be combined with other loss functions to jointly use the network loss of the generating network. And then train and generate the network according to the network loss.
  • the present disclosure does not limit the selection and combination of loss functions.
  • this method can better preserve the authenticity of the reconstructed picture and improve the training effect of the generated network.
  • the generating network includes N-level generating network blocks
  • the step of training the hidden vector and the generating network includes:
  • train the first n levels of generation network blocks of the generation network to obtain the generation network after the nth round of training, 1 ⁇ n ⁇ N, and n and N are integers.
  • the generation network may include N levels of generation network blocks, and each level of generation network block may include, for example, at least one convolutional layer.
  • the present disclosure does not limit the specific structure of each level of generation network block.
  • a progressive parameter optimization method can be used for network training.
  • the first level generation network block of the generation network can be trained to obtain the generation network after the first round of training; according to the network loss of the generation network after the first round of training, training Generate network blocks of the first and second levels of the generative network to obtain the generative network after the second round of training; and so on, train the first level of the generative network according to the network loss of the generated network after the N-1 round of training Go to the Nth level to generate network blocks, and obtain the generated network after the Nth round of training, as the final generated network.
  • Fig. 2 shows a schematic diagram of a training process of a generative network according to an embodiment of the present disclosure.
  • the generation network 21 may, for example, include a 4-level generation network block
  • the discriminant network 22 may, for example, include a 4-level discriminative network block.
  • the hidden vector (not shown) is input into the generating network 21 to obtain the generated image 23; the generated image 23 is input to the discriminant network 22 to obtain the output characteristics of the 4-level discriminant network block of the discriminant network 22, and the output characteristics of the 4-level discriminant network block As the network loss of the generation network 21.
  • the training process of the generative network 21 can be divided into four rounds. The first round trains the first level to generate network blocks; the second round trains the first and second levels to generate network blocks; ...; the fourth round of training from level 1 to level 2 Generate the network block at level 4, and get the generated network after training.
  • the method further includes:
  • the reconstructed image includes a complete image, and the second degraded image includes a missing image;
  • the resolution of the reconstructed image is greater than the resolution of the second degraded image.
  • the hidden vector and the generating network after training can be obtained.
  • the image restoration (image restoration) task can be realized through the trained latent vector and the generation network, that is, the trained latent vector is input into the trained generation network to obtain a reconstructed image of the target image.
  • the present disclosure does not limit the types of tasks included in the image restoration task.
  • the second degraded image of the target image is a grayscale image (the corresponding degradation function includes grayscale), and the reconstructed image generated by the generation network is a color image.
  • the second degraded image of the target image is a missing image, that is, there is a partial loss in the second degraded image
  • m represents the binary mask corresponding to the image completion task
  • represents dot multiplication
  • the reconstructed image generated by the generation network is a complete image.
  • the second degraded image of the target image is a blurred image (the corresponding degradation function includes downsampling), and the reconstructed image generated by the generation network is a clear image, that is, reconstruction
  • the resolution of the image is greater than the resolution of the second degraded image.
  • the generation network can restore the information not contained in the target image, and the restoration effect of the image restoration task is significantly improved.
  • an image manipulation (image manipulation) task (also referred to as an image editing task) can also be implemented through the trained latent vector and the generation network.
  • image manipulation image manipulation
  • the present disclosure does not limit the types of tasks included in the image manipulation task. The following describes the processing procedures of several image manipulation tasks.
  • an image generation method which includes:
  • the first latent vector and the first generation network are obtained by training according to the above-mentioned network training method.
  • the trained latent vector and the generation network (herein referred to as the first latent vector and the first generation network) can be obtained by training, and randomization can be achieved through the first latent vector and the first generation network.
  • Random jittering can be set, and the random jitter information can be, for example, a random vector or a random number, which is not limited in the present disclosure.
  • perturbation processing can be performed on the first latent vector by using the random jitter information, for example, the random jitter information and the first latent vector are superimposed to obtain the disturbed first latent vector. Then input the disturbed first latent vector into the first generation network for processing to obtain a reconstructed image of the target image.
  • the position of the object in the reconstructed image is different from the position of the object in the target image, thereby realizing random shaking of the object in the image. In this way, the processing effect of image manipulation tasks can be improved.
  • an image generation method which includes:
  • the second latent vector and the category features of the preset category are input into a second generation network for processing to obtain a reconstructed image of the target image.
  • the second generation network includes a conditional generation network, and the category of the object in the reconstructed image includes the predetermined Assuming a category, the category of the object in the target image is different from the preset category, wherein the second latent vector and the second generation network are obtained by training according to the above-mentioned network training method.
  • the trained latent vector and the generating network (herein referred to as the second latent vector and the second generating network) can be obtained by training, and the object can be realized through the second latent vector and the second generating network.
  • the category transfer (category transfer).
  • the second generation network may be a generation network in a conditional GAN, and its input includes latent vectors and category features.
  • multiple categories may be preset, and each preset category has a corresponding category feature.
  • Input the second hidden vector and the category features of the preset category into the second generation network for processing, and a reconstructed image of the target image can be obtained.
  • the category of the object in the reconstructed image is the preset category, and the category of the object in the original target image is compared with the preset category.
  • Set the categories to be different For example, when the object is an animal, the animal in the target image is a dog, and the animal in the reconstructed image is a cat; when the object is a vehicle, the vehicle in the target image is a bus, and the vehicle in the reconstructed image is a truck.
  • an image generation method which includes:
  • Each interpolation hidden vector is input into the corresponding interpolation generation network to obtain at least one deformed image.
  • the posture of the object in the at least one deformed image is between the posture of the object in the first target image and that of the object in the second target image. Between postures,
  • the third hidden vector and the third generation network, the fourth hidden vector and the fourth generation network are obtained by training according to the above-mentioned network training method.
  • two or more hidden vectors and generating networks can be trained to achieve continuous transition between two images through these hidden vectors and generating networks, that is, image morphing (image morphing). ).
  • the third latent vector and the third generation network, the fourth latent vector and the fourth generation network can be trained, and the third generation network is used to generate the reconstruction of the first target image according to the third latent vector Image, the fourth generation network is used to generate a reconstructed image of the second target image according to the fourth latent vector.
  • the third hidden vector and the fourth hidden vector, the parameters of the third generation network and the parameters of the fourth generation network can be interpolated respectively to obtain at least one interpolated hidden vector and at least one interpolated generator
  • the parameters of the network, that is, the corresponding sets of interpolated hidden vectors and the interpolated generation network are obtained.
  • the present disclosure does not limit the specific difference method.
  • each interpolation hidden vector may be input into a corresponding interpolation generation network to obtain at least one deformed image.
  • the posture of the object in the at least one deformed image is between the posture of the object in the first target image and the posture of the object in the second target image. In this way, the obtained one or more deformed images can realize the transition between the two images.
  • the reconstructed image of the first target image, multiple deformed images, and the reconstructed image of the second target image can also be used as video frames to form a video, from discrete images to continuous videos Transformation between.
  • the generative network in the Generative Adversarial Networks (GAN for short) learned from large-scale natural images is used as a general image prior, and the hidden vectors and generator parameters are optimized for image processing.
  • Reconstruction can restore information outside the target image, such as the color of grayscale images; it can learn the manifold of the image, and realize the manipulation of the high-level semantics of the image.
  • the L1 distance against the characteristics of the discriminant network in the generation network is used as the similarity metric for image reconstruction, and the optimization of the parameters of the generation network can be performed in a progressive manner.
  • the training effect of the network is further improved, and more accurate image reconstruction can be achieved.
  • the method according to the embodiments of the present disclosure can be applied to image restoration, image editing applications or software, effectively realizing the reconstruction of various target images, and realizing a series of image restoration tasks and image manipulation (image manipulation).
  • Tasks including but not limited to: colorization (colorization), image completion (inpainting), super-resolution (super-resolution), adversarial defense, random jittering, image morphing , Category transfer, etc.
  • the user can use this method to restore the color of grayscale pictures, convert low-resolution images into high-resolution images, and restore image blocks lost in the picture; they can also manipulate the content of the picture, such as turning the dog in the picture into a cat , Change the posture of the dog in the picture, realize the continuous transition of two pictures, etc.
  • the present disclosure also provides network training devices, image generation devices, electronic equipment, computer-readable storage media, and programs, all of which can be used to implement any of the network training methods and image generation methods provided in the present disclosure, and the corresponding technical solutions and Description and refer to the corresponding records in the method section, and will not repeat them.
  • Fig. 3 shows a block diagram of a network training device according to an embodiment of the present disclosure. As shown in Fig. 3, the device includes:
  • the first generation module 31 is configured to input the latent vector into a pre-trained generation network to obtain a first generated image, and the generation network is obtained by training against the discrimination network through a plurality of natural images;
  • the degradation module 32 is configured to perform degradation processing on the first generated image to obtain a first degraded image of the first generated image
  • the training module 33 is configured to train the latent vector and the generation network according to the first degraded image and the second degraded image of the target image, wherein the trained generation network and the trained latent vector are used to generate the The reconstructed image of the target image.
  • the training module includes: a feature acquisition sub-module, configured to input the first degraded image and the second degraded image of the target image into a pre-trained discriminant network for processing, to obtain the The first discriminant feature of the first degraded image and the second discriminant feature of the second degraded image; a first training sub-module for training the hidden vector according to the first discriminant feature and the second discriminant feature And the generating network.
  • the discriminant network includes a multi-level discriminant network block
  • the feature acquisition submodule includes: a first acquisition submodule, configured to input the first degraded image into the discrimination network for processing To obtain a plurality of first discriminant features output by the multi-level discriminant network block of the discriminant network; the second acquisition sub-module is used to input the second degraded image into the discriminant network for processing to obtain the discriminant network Multiple second discriminant features output by the multi-level discriminant network block.
  • the first training sub-module includes: a loss determination sub-module, configured to determine the distance between the first discriminant feature and the second discriminant feature Network loss; a second training sub-module for training the latent vector and the generation network according to the network loss of the generation network.
  • the generative network includes N-level generative network blocks
  • the second training sub-module is used to train the generative network according to the network loss of the generative network after the n-1th round of training
  • the first n levels of the generated network block are obtained, and the generated network after the nth round of training is obtained, 1 ⁇ n ⁇ N, and n and N are integers.
  • the device further includes: a second generation module, configured to input a plurality of initial latent vectors into the pre-trained generation network to obtain a plurality of second generated images; and a first vector determination module, using According to the difference information between the target image and the plurality of second generated images, the hidden vector is determined from the plurality of initial hidden vectors.
  • a second generation module configured to input a plurality of initial latent vectors into the pre-trained generation network to obtain a plurality of second generated images
  • a first vector determination module using According to the difference information between the target image and the plurality of second generated images, the hidden vector is determined from the plurality of initial hidden vectors.
  • the device further includes: a second vector determining module, configured to input the target image into a pre-trained coding network, and output the hidden vector.
  • the device further includes: a first reconstruction module, configured to input the trained latent vector into the trained generation network to obtain a reconstructed image of the target image, wherein the reconstructed image Including a color image, the second degraded image of the target image includes a grayscale image; or the reconstructed image includes a complete image, and the second degraded image includes a missing image; or the resolution of the reconstructed image is greater than that of the second The resolution of the degraded image.
  • a first reconstruction module configured to input the trained latent vector into the trained generation network to obtain a reconstructed image of the target image, wherein the reconstructed image Including a color image, the second degraded image of the target image includes a grayscale image; or the reconstructed image includes a complete image, and the second degraded image includes a missing image; or the resolution of the reconstructed image is greater than that of the second The resolution of the degraded image.
  • an image generation device including: a disturbance module, configured to perform disturbance processing on a first latent vector by random jitter information to obtain a disturbed first latent vector; and a second reconstruction module, using The first latent vector after the disturbance is input into the first generation network for processing to obtain a reconstructed image of the target image.
  • the position of the object in the reconstructed image is different from the position of the object in the target image.
  • a latent vector and the first generation network are obtained by training according to the above-mentioned network training device.
  • an image generation device including: a third reconstruction module, configured to input the second latent vector and the category features of the preset category into the second generation network for processing to obtain a reconstructed image of the target image
  • the second generation network includes a conditional generation network, the category of the object in the reconstructed image includes the preset category, the category of the object in the target image is different from the preset category, and the second hidden
  • the vector and the second generation network are obtained by training according to the above-mentioned network training device.
  • an image generation device including: an interpolation module for performing interpolation processing on the third and fourth hidden vectors, the parameters of the third generation network and the parameters of the fourth generation network, respectively , Obtain at least one interpolation hidden vector and at least one parameter of the interpolation generation network, the third generation network is used to generate the reconstructed image of the first target image according to the third hidden vector, and the fourth generation network is used to generate the second image according to the fourth hidden vector A reconstructed image of the target image; a deformed image acquisition module for inputting each interpolation hidden vector into a corresponding interpolation generation network to obtain at least one deformed image, and the posture of the object in the at least one deformed image is in the first target image Between the posture of the object and the posture of the object in the second target image, wherein the third hidden vector and the third generation network, the fourth hidden vector and the fourth generation network are in accordance with the claims
  • the network training device described in any one of 12-18 is trained.
  • the functions or modules contained in the device provided in the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments.
  • the functions or modules contained in the device provided in the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments.
  • the embodiments of the present disclosure also provide a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above-mentioned method when executed by a processor.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
  • An embodiment of the present disclosure also proposes an electronic device, including: a processor; a memory for storing executable instructions of the processor; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
  • the embodiments of the present disclosure also provide a computer program product, which includes computer-readable code.
  • the processor in the device executes the network training method and the network training method provided in any of the above embodiments. Instructions for the image generation method.
  • the embodiments of the present disclosure also provide another computer program product for storing computer-readable instructions, which when executed, cause the computer to perform the operations of the network training method and the image generation method provided by any of the foregoing embodiments.
  • the electronic device can be provided as a terminal, server or other form of device.
  • FIG. 4 shows a block diagram of an electronic device 800 according to an embodiment of the present disclosure.
  • the electronic device 800 may be a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and other terminals.
  • the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, and a sensor component 814 , And communication component 816.
  • the processing component 802 generally controls the overall operations of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
  • the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the foregoing method.
  • the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components.
  • the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
  • the memory 804 is configured to store various types of data to support operations in the electronic device 800. Examples of these data include instructions for any application or method to operate on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc.
  • the memory 804 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic Disk or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic Disk Magnetic Disk or Optical Disk.
  • the power supply component 806 provides power for various components of the electronic device 800.
  • the power supply component 806 may include a power management system, one or more power supplies, and other components associated with the generation, management, and distribution of power for the electronic device 800.
  • the multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from users.
  • the touch panel includes one or more touch sensors to sense touch, sliding, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure related to the touch or slide operation.
  • the multimedia component 808 includes a front camera and/or a rear camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
  • the audio component 810 is configured to output and/or input audio signals.
  • the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal.
  • the received audio signal may be further stored in the memory 804 or transmitted via the communication component 816.
  • the audio component 810 further includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module.
  • the above-mentioned peripheral interface module may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: home button, volume button, start button, and lock button.
  • the sensor component 814 includes one or more sensors for providing the electronic device 800 with various aspects of state evaluation.
  • the sensor component 814 can detect the on/off status of the electronic device 800 and the relative positioning of the components.
  • the component is the display and the keypad of the electronic device 800.
  • the sensor component 814 can also detect the electronic device 800 or the electronic device 800.
  • the position of the component changes, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration/deceleration of the electronic device 800, and the temperature change of the electronic device 800.
  • the sensor component 814 may include a proximity sensor configured to detect the presence of nearby objects when there is no physical contact.
  • the sensor component 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • the communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices.
  • the electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof.
  • the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 816 further includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field-available A programmable gate array (FPGA), controller, microcontroller, microprocessor, or other electronic components are implemented to implement the above methods.
  • ASIC application-specific integrated circuits
  • DSP digital signal processors
  • DSPD digital signal processing devices
  • PLD programmable logic devices
  • FPGA field-available A programmable gate array
  • controller microcontroller, microprocessor, or other electronic components are implemented to implement the above methods.
  • a non-volatile computer-readable storage medium such as the memory 804 including computer program instructions, which can be executed by the processor 820 of the electronic device 800 to complete the foregoing method.
  • FIG. 5 shows a block diagram of an electronic device 1900 according to an embodiment of the present disclosure.
  • the electronic device 1900 may be provided as a server. 5
  • the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932, for storing instructions executable by the processing component 1922, such as application programs.
  • the application program stored in the memory 1932 may include one or more modules each corresponding to a set of instructions.
  • the processing component 1922 is configured to execute instructions to perform the above-described methods.
  • the electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to the network, and an input output (I/O) interface 1958 .
  • the electronic device 1900 can operate based on an operating system stored in the memory 1932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
  • a non-volatile computer-readable storage medium is also provided, such as the memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to complete the foregoing method.
  • the present disclosure may be a system, method and/or computer program product.
  • the computer program product may include a computer-readable storage medium loaded with computer-readable program instructions for enabling a processor to implement various aspects of the present disclosure.
  • the computer-readable storage medium may be a tangible device that can hold and store instructions used by the instruction execution device.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
  • Non-exhaustive list of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) Or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, mechanical encoding device, such as a printer with instructions stored thereon
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read-only memory
  • flash memory flash memory
  • SRAM static random access memory
  • CD-ROM compact disk read-only memory
  • DVD digital versatile disk
  • memory stick floppy disk
  • mechanical encoding device such as a printer with instructions stored thereon
  • the computer-readable storage medium used here is not interpreted as the instantaneous signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (for example, light pulses through fiber optic cables), or through wires Transmission of electrical signals.
  • the computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to various computing/processing devices, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • the network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network, and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing/processing device .
  • the computer program instructions used to perform the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or in one or more programming languages.
  • Source code or object code written in any combination, the programming language includes object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages.
  • Computer-readable program instructions can be executed entirely on the user's computer, partly on the user's computer, executed as a stand-alone software package, partly on the user's computer and partly executed on a remote computer, or entirely on the remote computer or server carried out.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to access the Internet connection).
  • LAN local area network
  • WAN wide area network
  • an electronic circuit such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), can be customized by using the status information of the computer-readable program instructions.
  • the computer-readable program instructions are executed to realize various aspects of the present disclosure.
  • These computer-readable program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine that makes these instructions when executed by the processor of the computer or other programmable data processing device , A device that implements the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams is produced. It is also possible to store these computer-readable program instructions in a computer-readable storage medium. These instructions make computers, programmable data processing apparatuses, and/or other devices work in a specific manner. Thus, the computer-readable medium storing the instructions includes An article of manufacture, which includes instructions for implementing various aspects of the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams.
  • each block in the flowchart or block diagram may represent a module, program segment, or part of an instruction, and the module, program segment, or part of an instruction contains one or more components for realizing the specified logical function.
  • Executable instructions may also occur in a different order from the order marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or actions Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the computer program product can be specifically implemented by hardware, software, or a combination thereof.
  • the computer program product is specifically embodied as a computer storage medium.
  • the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc. Wait.
  • SDK software development kit

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Probability & Statistics with Applications (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

一种网络训练方法及装置、图像生成方法及装置,所述网络训练方法包括:将隐向量输入预训练的生成网络,得到第一生成图像(S11),所述生成网络是与判别网络通过多个自然图像对抗训练得到的;对所述第一生成图像进行退化处理,得到所述第一生成图像的第一退化图像(S12);根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络(S13),其中,训练后的生成网络和训练后的隐向量用于生成所述目标图像的重建图像。可提高生成网络的训练效果。

Description

网络训练方法及装置、图像生成方法及装置
本申请要求在2020年1月9日提交中国专利局、申请号为202010023029.7、发明名称为“网络训练方法及装置、图像生成方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及计算机技术领域,尤其涉及一种网络训练方法及装置、图像生成方法及装置。
背景技术
在深度学习的各种图像处理任务中,设计或学习图像先验是图像复原、图像操纵等任务中的重要问题。例如,深度图像先验(Deep Image Prior)提出,一个随机初始化的卷积神经网络有低级的图像先验,可以用来实现超分辨率和图像补全等。
发明内容
本公开提出了一种网络训练及图像生成技术方案。
根据本公开的一方面,提供了一种网络训练方法,包括:将隐向量输入预训练的生成网络,得到第一生成图像,所述生成网络是与判别网络通过多个自然图像对抗训练得到的;对所述第一生成图像进行退化处理,得到所述第一生成图像的第一退化图像;根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,其中,训练后的生成网络和训练后的隐向量用于生成所述目标图像的重建图像。
在一种可能的实现方式中,根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,包括:将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征;根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络。
在一种可能的实现方式中,所述判别网络包括多级判别网络块,将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征,包括:将所述第一退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第一判别特征;将所述第二退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第二判别特征。
在一种可能的实现方式中,根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络,包括:根据所述第一判别特征及所述第二判别特征之间的距离,确定所述生成网络的网络损失;根据所述生成网络的网络损失,训练所述隐向量及所述生成网络。
在一种可能的实现方式中,所述生成网络包括N级生成网络块,根据所述生成网络的网络损失,训练所述隐向量及所述生成网络,包括:根据第n-1轮训练后的生成网络的网络损失,训练所述生成网络的前n级生成网络块,得到第n轮训练后的生成网络,1≤n≤N,n、N为整数。
在一种可能的实现方式中,所述方法还包括:将多个初始隐向量输入预训练的生成网络,得到多 个第二生成图像;根据所述目标图像与所述多个第二生成图像之间的差异信息,从所述多个初始隐向量中确定出所述隐向量。
在一种可能的实现方式中,所述方法还包括:将所述目标图像输入预训练的编码网络,输出所述隐向量。
在一种可能的实现方式中,所述方法还包括:将训练后的隐向量输入训练后的生成网络,得到所述目标图像的重建图像,其中,所述重建图像包括彩色图像,所述目标图像的第二退化图像包括灰度图像;或所述重建图像包括完整图像,所述第二退化图像包括缺失图像;或所述重建图像的分辨率大于所述第二退化图像的分辨率。
根据本公开的一方面,提供了一种图像生成方法,包括:通过随机抖动信息对第一隐向量进行扰动处理,得到扰动后的第一隐向量;将所述扰动后的第一隐向量输入第一生成网络中处理,得到目标图像的重建图像,所述重建图像中对象的位置与所述目标图像中对象的位置不同,其中,所述第一隐向量及所述第一生成网络是根据上述的网络训练方法训练得到的。
根据本公开的一方面,提供了一种图像生成方法,包括:将第二隐向量及预设类别的类别特征输入第二生成网络中处理,得到目标图像的重建图像,所述第二生成网络包括条件生成网络,所述重建图像中对象的类别包括所述预设类别,所述目标图像中对象的类别与所述预设类别不同,其中,所述第二隐向量及所述第二生成网络是根据上述的网络训练方法训练得到的。
根据本公开的一方面,提供了一种图像生成方法,包括:对第三隐向量与第四隐向量、第三生成网络的参数与第四生成网络的参数分别进行插值处理,得到至少一个插值隐向量以及至少一个插值生成网络的参数,第三生成网络用于根据第三隐向量生成第一目标图像的重建图像,第四生成网络用于根据第四隐向量生成第二目标图像的重建图像;将各个插值隐向量分别输入相应的插值生成网络,得到至少一个变形图像,所述至少一个变形图像中对象的姿态处于所述第一目标图像中对象的姿态与所述第二目标图像中对象的姿态之间,其中,所述第三隐向量及所述第三生成网络、所述第四隐向量及所述第四生成网络是根据上述的网络训练方法训练得到的。
根据本公开的一方面,提供了一种网络训练装置,包括:第一生成模块,用于将隐向量输入预训练的生成网络,得到第一生成图像,所述生成网络是与判别网络通过多个自然图像对抗训练得到的;退化模块,用于对所述第一生成图像进行退化处理,得到所述第一生成图像的第一退化图像;训练模块,用于根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,其中,训练后的生成网络和训练后的隐向量用于生成所述目标图像的重建图像。
在一种可能的实现方式中,所述训练模块包括:特征获取子模块,用于将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征;第一训练子模块,用于根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络。
在一种可能的实现方式中,所述判别网络包括多级判别网络块,所述特征获取子模块包括:第一获取子模块,用于将所述第一退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第一判别特征;第二获取子模块,用于将所述第二退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第二判别特征。
在一种可能的实现方式中,所述第一训练子模块包括:损失确定子模块,用于根据所述第一判别特征及所述第二判别特征之间的距离,确定所述生成网络的网络损失;第二训练子模块,用于根据所述生成网络的网络损失,训练所述隐向量及所述生成网络。
在一种可能的实现方式中,所述生成网络包括N级生成网络块,所述第二训练子模块用于:根据第n-1轮训练后的生成网络的网络损失,训练所述生成网络的前n级生成网络块,得到第n轮训练后的生成网络,1≤n≤N,n、N为整数。
在一种可能的实现方式中,所述装置还包括:第二生成模块,用于将多个初始隐向量输入预训练的生成网络,得到多个第二生成图像;第一向量确定模块,用于根据所述目标图像与所述多个第二生成图像之间的差异信息,从所述多个初始隐向量中确定出所述隐向量。
在一种可能的实现方式中,所述装置还包括:第二向量确定模块,用于将所述目标图像输入预训练的编码网络,输出所述隐向量。
在一种可能的实现方式中,所述装置还包括:第一重建模块,用于将训练后的隐向量输入训练后的生成网络,得到所述目标图像的重建图像,其中,所述重建图像包括彩色图像,所述目标图像的第二退化图像包括灰度图像;或所述重建图像包括完整图像,所述第二退化图像包括缺失图像;或所述重建图像的分辨率大于所述第二退化图像的分辨率。
根据本公开的一方面,提供了一种图像生成装置,包括:扰动模块,用于通过随机抖动信息对第一隐向量进行扰动处理,得到扰动后的第一隐向量;第二重建模块,用于将所述扰动后的第一隐向量输入第一生成网络中处理,得到目标图像的重建图像,所述重建图像中对象的位置与所述目标图像中对象的位置不同,其中,所述第一隐向量及所述第一生成网络是根据上述的网络训练装置训练得到的。
根据本公开的一方面,提供了一种图像生成装置,包括:第三重建模块,用于将第二隐向量及预设类别的类别特征输入第二生成网络中处理,得到目标图像的重建图像,所述第二生成网络包括条件生成网络,所述重建图像中对象的类别包括所述预设类别,所述目标图像中对象的类别与所述预设类别不同,其中,所述第二隐向量及所述第二生成网络是根据上述的网络训练装置训练得到的。
根据本公开的一方面,提供了一种图像生成装置,包括:插值模块,用于对第三隐向量与第四隐向量、第三生成网络的参数与第四生成网络的参数分别进行插值处理,得到至少一个插值隐向量以及至少一个插值生成网络的参数,第三生成网络用于根据第三隐向量生成第一目标图像的重建图像,第四生成网络用于根据第四隐向量生成第二目标图像的重建图像;变形图像获取模块,用于将各个插值隐向量分别输入相应的插值生成网络,得到至少一个变形图像,所述至少一个变形图像中对象的姿态处于所述第一目标图像中对象的姿态与所述第二目标图像中对象的姿态之间,其中,所述第三隐向量及所述第三生成网络、所述第四隐向量及所述第四生成网络是根据上述的网络训练装置训练得到的。
根据本公开的一方面,提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。
根据本公开的一方面,提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。
根据本公开的一方面,提供了一种计算机程序,包括计算机可读代码,当所述计算机可读代码 在电子设备中运行时,所述电子设备中的处理器执行上述图像处理方法。
在本公开实施例中,能够通过预训练的生成网络得到生成图像,根据生成图像的退化图像及原始图像的退化图像之间的差异,同时训练隐向量和生成网络,从而提高生成网络的训练效果,实现更精确的图像重建。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。
图1示出根据本公开实施例的网络训练方法的流程图。
图2示出根据本公开实施例的生成网络的训练过程的示意图。
图3示出根据本公开实施例的网络训练装置的框图。
图4示出根据本公开实施例的一种电子设备的框图。
图5示出根据本公开实施例的一种电子设备的框图。
具体实施方式
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。
在图像复原类、图像编辑类应用或软件中,通常需要对目标图像进行重建,以实现色彩化、图像补全、超分辨率、对抗防御、图像变形等图像复原和/或图像操纵任务。在图像重建时,可使用在大规模自然图像中学习的对抗生成网络(Generative Adversarial Networks,简称GAN)中的生成网络作为通用的图像先验,同时优化隐向量和生成器参数来进行图像重建,以提高图像重建的精度,从而可恢复目标图像之外的信息,或实现对图像高级语义的操纵。
图1示出根据本公开实施例的网络训练方法的流程图,如图1所示,所述网络训练方法包括:
在步骤S11中,将隐向量输入预训练的生成网络,得到第一生成图像,所述生成网络是与判别网 络通过多个自然图像对抗训练得到的;
在步骤S12中,对所述第一生成图像进行退化处理,得到所述第一生成图像的第一退化图像;
在步骤S13中,根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,其中,训练后的生成网络和训练后的隐向量用于生成所述目标图像的重建图像。
在一种可能的实现方式中,所述网络训练方法可以由终端设备或服务器等电子设备执行,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字处理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等,所述方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。或者,可通过服务器执行所述方法。
在相关技术中,对抗生成网络是一种广泛使用的生成模型,其包括生成网络G(Generator)和判别网络D(Discriminator),生成网络G负责将隐向量映射为生成图像,判别网络D负责区分生成图像与真实图像。隐向量可例如从多元高斯分布中采样得到。生成网络G和判别网络D通过对抗学习(adversarial learning)的方式训练。训练完成后,用生成网络G可以采样得到合成的图像。
在一种可能的实现方式中,可通过多个自然图像(Natural image)对抗训练生成网络和判别网络,自然图像可为客观反映自然景物的图像。将大量的自然图像作为样本,可使得生成网络和判别网络学习到更加通用的图像先验信息。经对抗训练后,可得到预训练的生成网络及判别网络。本公开对自然图像的选取及对抗训练的具体训练方式不作限制。
在图像重建任务中,假设x为原始的自然图像(可称为目标图像),
Figure PCTCN2020099953-appb-000001
是一个损失了部分信息的图像(例如:损失颜色,损失图像块,损失分辨率等,以下称此类图像为退化(degraded)图像)。根据
Figure PCTCN2020099953-appb-000002
损失信息的类型,其可以看作对目标图像进行退化处理得到(也即通过
Figure PCTCN2020099953-appb-000003
得到),其中,φ为相应的退化变换(例如,φ可以是灰度化变换,使得彩色图像变成灰度图像)。在该情况下,可通过生成网络对退化图像
Figure PCTCN2020099953-appb-000004
在退化空间进行图像重建。
应当说明的是,在实际应用中,往往只有退化后的图像
Figure PCTCN2020099953-appb-000005
而没有原始的目标图像x,例如早期黑白相机得到的黑白照片,或者因为相机分辨率较低得到低分辨率照片等。因此,“对目标图像进行退化处理”可以看作一种假想的步骤,或者因为外因/设备限制而不可避免的步骤。
在一种可能的实现方式中,可在步骤S11中将隐向量输入预训练的生成网络,得到第一生成图像。该隐向量可例如为随机初始化的隐向量,本公开对此不作限制。
在一种可能的实现方式中,可在步骤S12中对该第一生成图像进行退化处理,得到第一生成图像的第一退化图像。该退化处理的方式与对目标图像进行退化的方式相同,例如为灰度化处理。
在一种可能的实现方式中,可在步骤S13中根据第一生成图像的第一退化图像及目标图像的第二退化图像之间的差异(例如相似度或距离),对隐向量及生成网络进行训练。生成网络的训练目标可表示为:
Figure PCTCN2020099953-appb-000006
在公式(1)中,θ可表示生成网络G的参数,z可表示待训练的隐向量,G(z,θ)表示第一生成图像,φ(G(z,θ))表示第一生成图像的退化图像(可称为第一退化图像),
Figure PCTCN2020099953-appb-000007
表示目标图像的退化图像(可称为第二退化图像),L表示第一退化图像与第二退化图像之间的相似度度量。z*可表示训练后的隐向量,θ*可表示训练后的生成网络的参数,x*可表示目标图像的重建图像。
在训练过程中,可根据第一退化图像与第二退化图像之间的相似度确定网络损失,根据网络损失多次迭代优化隐向量和生成网络的参数,使得网络损失收敛,得到训练后的隐向量和生成网络。该训练后的隐向量和生成网络用于生成目标图像的重建图像,恢复目标图像中的图像信息。由于生成网络G学习了自然图像的分布,重建的x*会恢复出
Figure PCTCN2020099953-appb-000008
所缺失的自然图像信息。例如,若
Figure PCTCN2020099953-appb-000009
是灰度图,x*则是与之相匹配的彩色图像。
在一种可能的实现方式中,在训练过程中,可通过反向传播算法和ADAM(adaptive moment estimation,适应性矩估计)优化算法对隐向量和生成网络的参数进行参数调整,本公开对具体的训练方式不作限制。
根据本公开的实施例,能够通过预训练的生成网络得到生成图像,根据生成图像的退化图像及原始图像的退化图像之间的差异,同时训练隐向量和生成网络,从而提高生成网络的训练效果,实现更精确的图像重建。
在一种可能的实现方式中,在步骤S11之前,可先确定出待训练的隐向量。该隐向量可例如从多元高斯分布中随机采样直接得到,也可以通过其他方式得到。
在一种可能的实现方式中,所述方法还包括:将多个初始隐向量输入预训练的生成网络,得到多个第二生成图像;根据所述目标图像与所述多个第二生成图像之间的差异信息,从所述多个初始隐向量中确定出所述隐向量。
举例来说,可随机采样得到多个初始隐向量,并将各个初始隐向量分别输入到预训练的生成网络G中,得到多个第二生成图像。进而,可获取原始的目标图像与各个第二生成图像的差异信息,例如计算目标图像与各个第二生成图像之间的相似度(例如L1距离),确定出差异最小(即相似度最大)的第二生成图像,并可将与该第二生成图像对应的初始隐向量,确定为待训练的隐向量。通过这种方式,可使得确定出的隐向量与目标图像的图像信息较为接近,从而提高训练效率。
在一种可能的实现方式中,所述方法还包括:将所述目标图像输入预训练的编码网络,输出所述隐向量。
举例来说,可预先设定有编码网络(例如为卷积神经网络),用于将目标图像编码为隐向量。可通过样本图像对该编码网络进行预训练,得到预训练的编码网络。例如将样本图像输入编码网络中得到隐向量,再将隐向量输入预训练的生成网络得到生成图像;根据生成图像与样本图像之间的差异训练该编码网络,本公开对具体的训练方式不作限制。
在预训练后,可将目标图像输入预训练的编码网络,输出待训练的隐向量。通过这种方式,可使得确定出的隐向量与目标图像的图像信息更为接近,从而提高训练效率。
在一种可能的实现方式中,步骤S13可包括:
将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征;
根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络。
举例来说,为了保证重建图像不失真,可根据与生成网络对应的判别网络来训练该生成网络。可将第一退化图像和目标图像的第二退化图像分别输入预训练的判别网络中处理,输出第一退化图像的第一判别特征及所述第二退化图像的第二判别特征;根据第一判别特征及第二判别特征,训练所述隐向量及所述生成网络。例如,将第一判别特征及第二判别特征之间的L1距离确定生成网络的网络损失,进而根据网络损失调整隐向量及生成网络的参数。通过这种方式,可以更好地保留重建图像的真实性。
在一种可能的实现方式中,所述判别网络包括多级判别网络块,
将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征,包括:
将所述第一退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第一判别特征;
将所述第二退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第二判别特征。
举例来说,判别网络可包括多级的判别网络块(block),各个判别网络块可例如为残差块,每个残差块例如包括至少一个残差层以及全连接层、池化层,本公开对各个判别网络块的具体结构不作限制。
在一种可能的实现方式中,可将第一退化图像输入判别网络中处理,可得到各级判别网络块输出的第一判别特征;同样地,将第二退化图像输入判别网络中处理,可得到各级判别网络块输出的第二判别特征。通过这种方式,可以得到判别网络不同深度的特征,使得后续的相似度度量更为准确。
在一种可能的实现方式中,根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络的步骤可包括:
根据所述第一判别特征及所述第二判别特征之间的距离,确定所述生成网络的网络损失;根据所述生成网络的网络损失,训练所述隐向量及所述生成网络。
举例来说,可确定多个第一判别特征和多个第二判别特征之间的L1距离:
Figure PCTCN2020099953-appb-000010
在公式(2)中,x 1可表示第一退化图像;x 2可表示第二退化图像;D(x 1,i)和D(x 2,i)可分别表示第i级判别网络块输出的第一判别特征和第二判别特征,I表示判别网络块的级数,1≤i≤I,i,I为整数。
在一种可能的实现方式中,可将该L1距离直接作为生成网络的网络损失;也可将该L1距离与其他损失函数组合,共同作为生成网络的网络损失。进而根据网络损失训练生成网络。本公开对损失函数 的选择及组合方式不作限制。
相较于其他相似度度量,这种方式能够更好地保留重建图片的真实性,提高生成网络的训练效果。
在一种可能的实现方式中,所述生成网络包括N级生成网络块,
根据所述生成网络的网络损失,训练所述隐向量及所述生成网络的步骤,包括:
根据第n-1轮训练后的生成网络的网络损失,训练所述生成网络的前n级生成网络块,得到第n轮训练后的生成网络,1≤n≤N,n、N为整数。
举例来说,生成网络可包括N级的生成网络块,每级生成网络块可例如包括至少一个卷积层,本公开对各级生成网络块的具体结构不作限制。
在一种可能的实现方式中,可采用渐进(progressive)的参数优化方式进行网络训练。将训练过程分为N轮,针对N轮训练中的任意一轮(设为第n轮),根据第n-1轮训练后的生成网络的网络损失,训练所述生成网络的前n级生成网络块,得到第n轮训练后的生成网络。在n=1时,第n-1轮训练后的生成网络即为预训练的生成网络。
也就是说,可根据预训练的生成网络的网络损失,训练生成网络的第1级生成网络块,得到第1轮训练后的生成网络;根据第1轮训练后的生成网络的网络损失,训练生成网络的第1级和第2级生成网络块,得到第2轮训练后的生成网络;以此类推,根据第N-1轮训练后的生成网络的网络损失,训练生成网络的第1级至第N级生成网络块,得到第N轮训练后的生成网络,作为最终的生成网络。
图2示出根据本公开实施例的生成网络的训练过程的示意图。如图2所示,生成网络21可例如包括4级生成网络块,判别网络22可例如包括4级判别网络块。隐向量(未示出)输入生成网络21中,得到生成图像23;生成图像23输入判别网络22中,得到判别网络22的4级判别网络块的输出特征,该4级判别网络块的输出特征作为生成网络21的网络损失。生成网络21的训练过程可分为四轮,第一轮训练第1级生成网络块;第二轮训练第1级和第2级生成网络块;……;第四轮训练第1级至第4级生成网络块,得到训练后的生成网络。
通过先优化浅层,再逐步优化深层的方式,可以取得更好的优化效果,提高生成网络的性能。
在一种可能的实现方式中,所述方法还包括:
将训练后的隐向量输入训练后的生成网络,得到所述目标图像的重建图像,其中,所述重建图像包括彩色图像,所述目标图像的第二退化图像包括灰度图像;或
所述重建图像包括完整图像,所述第二退化图像包括缺失图像;或
所述重建图像的分辨率大于所述第二退化图像的分辨率。
举例来说,在步骤S13中完成隐向量和生成网络的训练过程后,可得到训练后的隐向量和生成网络。进而,可通过训练后的隐向量和生成网络实现图像复原(image restoration)任务,也即,将将训练后的隐向量输入训练后的生成网络,得到目标图像的重建图像。本公开对图像复原任务所包括的任务类型不作限制。
在图像复原任务为色彩化(colorization)任务时,目标图像的第二退化图像为灰度图像(对应的退化函数包括灰度化),经生成网络生成的重建图像为彩色图像。
在图像复原任务为图像补全(inpainting)任务时,目标图像的第二退化图像为缺失图像,也即第 二退化图像中存在部分缺失,对应的退化函数表示为φ(x)=x⊙m,其中m表示该图像补全任务对应的二元掩码(mask),⊙表示点乘,经生成网络生成的重建图像为完整图像。
在图像复原任务为超分辨率(super-resolution)任务时,目标图像的第二退化图像为模糊图像(对应的退化函数包括降采样),经生成网络生成的重建图像为清晰图像,也即重建图像的分辨率大于第二退化图像的分辨率。
通过这种方式,使得生成网络能够恢复目标图像中不包含的信息,显著提高图像复原任务的复原效果。
在一种可能的实现方式中,还可通过训练后的隐向量和生成网络实现图像操纵(image manipulation)任务(也可称为图像编辑任务)。本公开对图像操纵任务所包括的任务类型不作限制。下面对几种图像操纵任务的处理过程进行说明。
根据本公开的实施例,还提供了一种图像生成方法,该方法包括:
通过随机抖动信息对第一隐向量进行扰动处理,得到扰动后的第一隐向量;
将所述扰动后的第一隐向量输入第一生成网络中处理,得到目标图像的重建图像,所述重建图像中对象的位置与所述目标图像中对象的位置不同,
其中,所述第一隐向量及所述第一生成网络是根据上述网络训练方法训练得到的。
举例来说,可根据上述网络训练方法,训练得到训练后的隐向量和生成网络(此处称为第一隐向量和第一生成网络),通过该第一隐向量和第一生成网络实现随机抖动(random jittering)。其中,可设定有随机抖动信息,该随机抖动信息可例如为随机向量或随机数,本公开对此不作限制。
在一种可能的实现方式中,可通过该随机抖动信息对第一隐向量进行扰动处理,例如将随机抖动信息与第一隐向量叠加,得到扰动后的第一隐向量。再将扰动后的第一隐向量输入第一生成网络中处理,得到目标图像的重建图像。该重建图像中对象的位置与目标图像中对象的位置不同,从而实现图像中对象的随机抖动。通过这种方式,可以提高图像操纵任务的处理效果。
根据本公开的实施例,还提供了一种图像生成方法,该方法包括:
将第二隐向量及预设类别的类别特征输入第二生成网络中处理,得到目标图像的重建图像,所述第二生成网络包括条件生成网络,所述重建图像中对象的类别包括所述预设类别,所述目标图像中对象的类别与所述预设类别不同,其中,所述第二隐向量及所述第二生成网络是根据上述的网络训练方法训练得到的。
举例来说,可根据上述网络训练方法,训练得到训练后的隐向量和生成网络(此处称为第二隐向量和第二生成网络),通过该第二隐向量和第二生成网络实现对象的类别转换(category transfer)。其中,该第二生成网络可为条件对抗生成网络(conditional GAN)中的生成网络,其输入包括隐向量及类别特征。
在一种可能的实现方式中,可预先设定有多个类别,每个预设类别具有对应的类别特征。将第二隐向量及预设类别的类别特征输入第二生成网络中处理,可得到目标图像的重建图像,该重建图像中对象的类别为预设类别,原始的目标图像中对象的类别与预设类别不同。例如,在对象为动物时,目标图像中的动物为狗,而重建图像中的动物为猫;在对象为车辆时,目标图像中的车辆为巴士,而重 建图像中的车辆为卡车。
通过这种方式,可以实现图像中对象的类别转换,提高图像操纵任务的处理效果。
根据本公开的实施例,还提供了一种图像生成方法,该方法包括:
对第三隐向量与第四隐向量、第三生成网络的参数与第四生成网络的参数分别进行插值处理,得到至少一个插值隐向量以及至少一个插值生成网络的参数,第三生成网络用于根据第三隐向量生成第一目标图像的重建图像,第四生成网络用于根据第四隐向量生成第二目标图像的重建图像;
将各个插值隐向量分别输入相应的插值生成网络,得到至少一个变形图像,所述至少一个变形图像中对象的姿态处于所述第一目标图像中对象的姿态与所述第二目标图像中对象的姿态之间,
其中,所述第三隐向量及所述第三生成网络、所述第四隐向量及所述第四生成网络是根据上述的网络训练方法训练得到的。
举例来说,可根据上述网络训练方法,训练得到两个或两个以上的隐向量和生成网络,通过这些隐向量和生成网络实现两个图像之间的连续过渡,也即图像变形(image morphing)。
在一种可能的实现方式中,可训练得到第三隐向量及第三生成网络,第四隐向量及第四生成网络,第三生成网络用于根据第三隐向量生成第一目标图像的重建图像,第四生成网络用于根据第四隐向量生成第二目标图像的重建图像。
在一种可能的实现方式中,可对第三隐向量与第四隐向量、第三生成网络的参数与第四生成网络的参数分别进行插值处理,得到至少一个插值隐向量以及至少一个插值生成网络的参数,也即,得到相对应的多组插值隐向量及插值生成网络。本公开对具体的差值方式不作限制。
在一种可能的实现方式中,可将各个插值隐向量分别输入相应的插值生成网络,得到至少一个变形图像。该至少一个变形图像中对象的姿态处于所述第一目标图像中对象的姿态与所述第二目标图像中对象的姿态之间。这样,得到的一个或多个变形图像可实现两个图像之间的过渡。
在得到的变形图像较多的情况下,还可将第一目标图像的重建图像、多个变形图像及第二目标图像的重建图像作为视频帧,形成一段视频,完离散的图像到连续的视频之间的变换。
通过这种方式,可以实现图像之间的过渡,提高图像操纵任务的处理效果。
根据本公开实施例的方法,使用在大规模自然图像中学习的对抗生成网络(Generative Adversarial Networks,简称GAN)中的生成网络作为通用的图像先验,同时优化隐向量和生成器参数来进行图像重建,能够恢复目标图像之外的信息,例如恢复灰度图的颜色;能够学习到图像的流形(manifold),实现对图像高级语义的操纵。
此外,根据本公开实施例的方法,采用对抗生成网络中的判别网络的特征的L1距离来作为图像重建的相似度度量,并且对生成网络的参数的优化可以通过渐进(progressive)的方式进行,进一步提高了网络的训练效果,能够实现更精确的图像重建。
根据本公开实施例的方法,能够应用于图像复原类、图像编辑类应用或软件中,有效实现对各种目标图像的重建,可实现一系列图像复原(image restoration)任务和图像操纵(image manipulation)任务,包括但不限于:色彩化(colorization),图像补全(inpainting),超分辨率(super-resolution),对抗防御(adversarial defense),随机抖动(random jittering),图像变形(image morphing),类别转换(category transfer)等。用户可以用本方法恢复灰度图片的颜色,将低分辨率图像变为高分辨率图 像,恢复出图片损失的图像块;还可以对图片的内容进行操纵,例如将图片中的狗变成猫,改变图片中狗的姿态,实现两张图片的连续过渡等。
可以理解,本公开提及的上述各个方法实施例,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例,限于篇幅,本公开不再赘述。本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。应当理解,本公开的权利要求、说明书及附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。
此外,本公开还提供了网络训练装置、图像生成装置、电子设备、计算机可读存储介质、程序,上述均可用来实现本公开提供的任一种网络训练方法及图像生成方法,相应技术方案和描述和参见方法部分的相应记载,不再赘述。
图3示出根据本公开实施例的网络训练装置的框图,如图3所示,所述装置包括:
第一生成模块31,用于将隐向量输入预训练的生成网络,得到第一生成图像,所述生成网络是与判别网络通过多个自然图像对抗训练得到的;
退化模块32,用于对所述第一生成图像进行退化处理,得到所述第一生成图像的第一退化图像;
训练模块33,用于根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,其中,训练后的生成网络和训练后的隐向量用于生成所述目标图像的重建图像。
在一种可能的实现方式中,所述训练模块包括:特征获取子模块,用于将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征;第一训练子模块,用于根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络。
在一种可能的实现方式中,所述判别网络包括多级判别网络块,所述特征获取子模块包括:第一获取子模块,用于将所述第一退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第一判别特征;第二获取子模块,用于将所述第二退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第二判别特征。
在一种可能的实现方式中,所述第一训练子模块包括:损失确定子模块,用于根据所述第一判别特征及所述第二判别特征之间的距离,确定所述生成网络的网络损失;第二训练子模块,用于根据所述生成网络的网络损失,训练所述隐向量及所述生成网络。
在一种可能的实现方式中,所述生成网络包括N级生成网络块,所述第二训练子模块用于:根据第n-1轮训练后的生成网络的网络损失,训练所述生成网络的前n级生成网络块,得到第n轮训练后的生成网络,1≤n≤N,n、N为整数。
在一种可能的实现方式中,所述装置还包括:第二生成模块,用于将多个初始隐向量输入预训练的生成网络,得到多个第二生成图像;第一向量确定模块,用于根据所述目标图像与所述多个第二生成图像之间的差异信息,从所述多个初始隐向量中确定出所述隐向量。
在一种可能的实现方式中,所述装置还包括:第二向量确定模块,用于将所述目标图像输入预训练的编码网络,输出所述隐向量。
在一种可能的实现方式中,所述装置还包括:第一重建模块,用于将训练后的隐向量输入训练后 的生成网络,得到所述目标图像的重建图像,其中,所述重建图像包括彩色图像,所述目标图像的第二退化图像包括灰度图像;或所述重建图像包括完整图像,所述第二退化图像包括缺失图像;或所述重建图像的分辨率大于所述第二退化图像的分辨率。
根据本公开的一方面,提供了一种图像生成装置,包括:扰动模块,用于通过随机抖动信息对第一隐向量进行扰动处理,得到扰动后的第一隐向量;第二重建模块,用于将所述扰动后的第一隐向量输入第一生成网络中处理,得到目标图像的重建图像,所述重建图像中对象的位置与所述目标图像中对象的位置不同,其中,所述第一隐向量及所述第一生成网络是根据上述的网络训练装置训练得到的。
根据本公开的一方面,提供了一种图像生成装置,包括:第三重建模块,用于将第二隐向量及预设类别的类别特征输入第二生成网络中处理,得到目标图像的重建图像,所述第二生成网络包括条件生成网络,所述重建图像中对象的类别包括所述预设类别,所述目标图像中对象的类别与所述预设类别不同,其中,所述第二隐向量及所述第二生成网络是根据上述的网络训练装置训练得到的。
根据本公开的一方面,提供了一种图像生成装置,包括:插值模块,用于对第三隐向量与第四隐向量、第三生成网络的参数与第四生成网络的参数分别进行插值处理,得到至少一个插值隐向量以及至少一个插值生成网络的参数,第三生成网络用于根据第三隐向量生成第一目标图像的重建图像,第四生成网络用于根据第四隐向量生成第二目标图像的重建图像;变形图像获取模块,用于将各个插值隐向量分别输入相应的插值生成网络,得到至少一个变形图像,所述至少一个变形图像中对象的姿态处于所述第一目标图像中对象的姿态与所述第二目标图像中对象的姿态之间,其中,所述第三隐向量及所述第三生成网络、所述第四隐向量及所述第四生成网络是根据权利要求12-18中任意一项所述的网络训练装置训练得到的。
在一些实施例中,本公开实施例提供的装置具有的功能或包含的模块可以用于执行上文方法实施例描述的方法,其具体实现可以参照上文方法实施例的描述,为了简洁,这里不再赘述。
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是非易失性计算机可读存储介质或易失性计算机可读存储介质。
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。
本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,当计算机可读代码在设备上运行时,设备中的处理器执行用于实现如上任一实施例提供的网络训练方法及图像生成方法的指令。
本公开实施例还提供了另一种计算机程序产品,用于存储计算机可读指令,指令被执行时使得计算机执行上述任一实施例提供的网络训练方法及图像生成方法的操作。
电子设备可以被提供为终端、服务器或其它形态的设备。
图4示出根据本公开实施例的一种电子设备800的框图。例如,电子设备800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。
参照图4,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例 中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。
图5示出根据本公开实施例的一种电子设备1900的框图。例如,电子设备1900可以被提供为一服务器。参照图5,电子设备1900包括处理组件1922,其进一步包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922的执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1922被配置为执行指令,以执行上述方法。
电子设备1900还可以包括一个电源组件1926被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950被配置为将电子设备1900连接到网络,和一个输入输出(I/O)接口1958。电子设备1900可以操作基于存储在存储器1932的操作系统,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器1932,上述计算机程序指令可由电子设备1900的处理组件1922执行以完成上述方法。
本公开可以是系统、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是――但不限于――电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、 机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
在不违背逻辑的情况下,本公开不同实施例之间可以相互结合,不同实施例描述有所侧重,为侧重描述的部分可以参见其他实施例的记载。
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露 的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。

Claims (25)

  1. 一种网络训练方法,包括:
    将隐向量输入预训练的生成网络,得到第一生成图像,所述生成网络是与判别网络通过多个自然图像对抗训练得到的;
    对所述第一生成图像进行退化处理,得到所述第一生成图像的第一退化图像;
    根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,其中,训练后的生成网络和训练后的隐向量用于生成所述目标图像的重建图像。
  2. 根据权利要求1所述的方法,其特征在于,根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,包括:
    将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征;
    根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络。
  3. 根据权利要求2所述的方法,其特征在于,所述判别网络包括多级判别网络块,
    将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征,包括:
    将所述第一退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第一判别特征;
    将所述第二退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第二判别特征。
  4. 根据权利要求2或3所述的方法,其特征在于,根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络,包括:
    根据所述第一判别特征及所述第二判别特征之间的距离,确定所述生成网络的网络损失;
    根据所述生成网络的网络损失,训练所述隐向量及所述生成网络。
  5. 根据权利要求4所述的方法,其特征在于,所述生成网络包括N级生成网络块,
    根据所述生成网络的网络损失,训练所述隐向量及所述生成网络,包括:
    根据第n-1轮训练后的生成网络的网络损失,训练所述生成网络的前n级生成网络块,得到第n轮训练后的生成网络,1≤n≤N,n、N为整数。
  6. 根据权利要求1-5中任意一项所述的方法,其特征在于,所述方法还包括:
    将多个初始隐向量输入预训练的生成网络,得到多个第二生成图像;
    根据所述目标图像与所述多个第二生成图像之间的差异信息,从所述多个初始隐向量中确定出所述隐向量。
  7. 根据权利要求1-5中任意一项所述的方法,其特征在于,所述方法还包括:
    将所述目标图像输入预训练的编码网络,输出所述隐向量。
  8. 根据权利要求1-7中任意一项所述的方法,其特征在于,所述方法还包括:
    将训练后的隐向量输入训练后的生成网络,得到所述目标图像的重建图像,
    其中,所述重建图像包括彩色图像,所述目标图像的第二退化图像包括灰度图像;或
    所述重建图像包括完整图像,所述第二退化图像包括缺失图像;或
    所述重建图像的分辨率大于所述第二退化图像的分辨率。
  9. 一种图像生成方法,所述方法包括:
    通过随机抖动信息对第一隐向量进行扰动处理,得到扰动后的第一隐向量;
    将所述扰动后的第一隐向量输入第一生成网络中处理,得到目标图像的重建图像,所述重建图像中对象的位置与所述目标图像中对象的位置不同,
    其中,所述第一隐向量及所述第一生成网络是根据权利要求1-7中任意一项所述的网络训练方法训练得到的。
  10. 一种图像生成方法,所述方法包括:
    将第二隐向量及预设类别的类别特征输入第二生成网络中处理,得到目标图像的重建图像,所述第二生成网络包括条件生成网络,所述重建图像中对象的类别包括所述预设类别,所述目标图像中对象的类别与所述预设类别不同,
    其中,所述第二隐向量及所述第二生成网络是根据权利要求1-7中任意一项所述的网络训练方法训练得到的。
  11. 一种图像生成方法,所述方法包括:
    对第三隐向量与第四隐向量、第三生成网络的参数与第四生成网络的参数分别进行插值处理,得到至少一个插值隐向量以及至少一个插值生成网络的参数,第三生成网络用于根据第三隐向量生成第一目标图像的重建图像,第四生成网络用于根据第四隐向量生成第二目标图像的重建图像;
    将各个插值隐向量分别输入相应的插值生成网络,得到至少一个变形图像,所述至少一个变形图像中对象的姿态处于所述第一目标图像中对象的姿态与所述第二目标图像中对象的姿态之间,
    其中,所述第三隐向量及所述第三生成网络、所述第四隐向量及所述第四生成网络是根据权利要求1-7中任意一项所述的网络训练方法训练得到的。
  12. 一种网络训练装置,包括:
    第一生成模块,用于将隐向量输入预训练的生成网络,得到第一生成图像,所述生成网络是与判别网络通过多个自然图像对抗训练得到的;
    退化模块,用于对所述第一生成图像进行退化处理,得到所述第一生成图像的第一退化图像;
    训练模块,用于根据所述第一退化图像及目标图像的第二退化图像,训练所述隐向量及所述生成网络,其中,训练后的生成网络和训练后的隐向量用于生成所述目标图像的重建图像。
  13. 根据权利要求12所述的装置,其特征在于,所述训练模块包括:
    特征获取子模块,用于将所述第一退化图像及目标图像的第二退化图像分别输入预训练的判别网络中处理,得到所述第一退化图像的第一判别特征及所述第二退化图像的第二判别特征;
    第一训练子模块,用于根据所述第一判别特征及所述第二判别特征,训练所述隐向量及所述生成网络。
  14. 根据权利要求13所述的装置,其特征在于,所述判别网络包括多级判别网络块,所述特征获取子模块包括:
    第一获取子模块,用于将所述第一退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第一判别特征;
    第二获取子模块,用于将所述第二退化图像输入所述判别网络中处理,得到所述判别网络的多级判别网络块输出的多个第二判别特征。
  15. 根据权利要求13或14所述的装置,其特征在于,所述第一训练子模块包括:
    损失确定子模块,用于根据所述第一判别特征及所述第二判别特征之间的距离,确定所述生成网络的网络损失;
    第二训练子模块,用于根据所述生成网络的网络损失,训练所述隐向量及所述生成网络。
  16. 根据权利要求15所述的装置,其特征在于,所述生成网络包括N级生成网络块,所述第二训练子模块用于:
    根据第n-1轮训练后的生成网络的网络损失,训练所述生成网络的前n级生成网络块,得到第n轮训练后的生成网络,1≤n≤N,n、N为整数。
  17. 根据权利要求12-16中任意一项所述的装置,其特征在于,所述装置还包括:
    第二生成模块,用于将多个初始隐向量输入预训练的生成网络,得到多个第二生成图像;
    第一向量确定模块,用于根据所述目标图像与所述多个第二生成图像之间的差异信息,从所述多个初始隐向量中确定出所述隐向量。
  18. 根据权利要求12-16中任意一项所述的装置,其特征在于,所述装置还包括:
    第二向量确定模块,用于将所述目标图像输入预训练的编码网络,输出所述隐向量。
  19. 根据权利要求12-18中任意一项所述的装置,其特征在于,所述装置还包括:
    第一重建模块,用于将训练后的隐向量输入训练后的生成网络,得到所述目标图像的重建图像, 其中,所述重建图像包括彩色图像,所述目标图像的第二退化图像包括灰度图像;或
    所述重建图像包括完整图像,所述第二退化图像包括缺失图像;或
    所述重建图像的分辨率大于所述第二退化图像的分辨率。
  20. 一种图像生成装置,包括:
    扰动模块,用于通过随机抖动信息对第一隐向量进行扰动处理,得到扰动后的第一隐向量;
    第二重建模块,用于将所述扰动后的第一隐向量输入第一生成网络中处理,得到目标图像的重建图像,所述重建图像中对象的位置与所述目标图像中对象的位置不同,
    其中,所述第一隐向量及所述第一生成网络是根据权利要求12-18中任意一项所述的网络训练装置训练得到的。
  21. 一种图像生成装置,包括:
    第三重建模块,用于将第二隐向量及预设类别的类别特征输入第二生成网络中处理,得到目标图像的重建图像,所述第二生成网络包括条件生成网络,所述重建图像中对象的类别包括所述预设类别,所述目标图像中对象的类别与所述预设类别不同,
    其中,所述第二隐向量及所述第二生成网络是根据权利要求12-18中任意一项所述的网络训练装置训练得到的。
  22. 一种图像生成装置,包括:
    插值模块,用于对第三隐向量与第四隐向量、第三生成网络的参数与第四生成网络的参数分别进行插值处理,得到至少一个插值隐向量以及至少一个插值生成网络的参数,第三生成网络用于根据第三隐向量生成第一目标图像的重建图像,第四生成网络用于根据第四隐向量生成第二目标图像的重建图像;
    变形图像获取模块,用于将各个插值隐向量分别输入相应的插值生成网络,得到至少一个变形图像,所述至少一个变形图像中对象的姿态处于所述第一目标图像中对象的姿态与所述第二目标图像中对象的姿态之间,
    其中,所述第三隐向量及所述第三生成网络、所述第四隐向量及所述第四生成网络是根据权利要求12-18中任意一项所述的网络训练装置训练得到的。
  23. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为调用所述存储器存储的指令,以执行权利要求1至11中任意一项所述的方法。
  24. 一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行 时实现权利要求1至11中任意一项所述的方法。
  25. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在电子设备中运行时,所述电子设备中的处理器执行用于实现权利要求1至11中任意一项所述的方法。
PCT/CN2020/099953 2020-01-09 2020-07-02 网络训练方法及装置、图像生成方法及装置 WO2021139120A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
KR1020227024492A KR20220116015A (ko) 2020-01-09 2020-07-02 네트워크 트레이닝 방법 및 장치, 이미지 생성 방법 및 장치
US17/853,816 US20220327385A1 (en) 2020-01-09 2022-06-29 Network training method, electronic device and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010023029.7 2020-01-09
CN202010023029.7A CN111223040B (zh) 2020-01-09 2020-01-09 网络训练方法及装置、图像生成方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/853,816 Continuation US20220327385A1 (en) 2020-01-09 2022-06-29 Network training method, electronic device and storage medium

Publications (1)

Publication Number Publication Date
WO2021139120A1 true WO2021139120A1 (zh) 2021-07-15

Family

ID=70832269

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/099953 WO2021139120A1 (zh) 2020-01-09 2020-07-02 网络训练方法及装置、图像生成方法及装置

Country Status (5)

Country Link
US (1) US20220327385A1 (zh)
KR (1) KR20220116015A (zh)
CN (1) CN111223040B (zh)
TW (1) TWI759830B (zh)
WO (1) WO2021139120A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114140603A (zh) * 2021-12-08 2022-03-04 北京百度网讯科技有限公司 虚拟形象生成模型的训练方法和虚拟形象生成方法

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111223040B (zh) * 2020-01-09 2023-04-25 北京市商汤科技开发有限公司 网络训练方法及装置、图像生成方法及装置
CN111767679B (zh) * 2020-07-14 2023-11-07 中国科学院计算机网络信息中心 时变矢量场数据的处理方法及装置
CN112003834B (zh) * 2020-07-30 2022-09-23 瑞数信息技术(上海)有限公司 异常行为检测方法和装置
CN114007099A (zh) * 2021-11-04 2022-02-01 北京搜狗科技发展有限公司 一种视频处理方法、装置和用于视频处理的装置
CN113822798B (zh) * 2021-11-25 2022-02-18 北京市商汤科技开发有限公司 生成对抗网络训练方法及装置、电子设备和存储介质
CN114299588B (zh) * 2021-12-30 2024-05-10 杭州电子科技大学 一种基于局部空间转换网络的实时目标编辑方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190040586A (ko) * 2017-10-11 2019-04-19 인하대학교 산학협력단 인공신경망을 이용한 단일 영상 고해상도 복원 방법 및 시스템
CN109816620A (zh) * 2019-01-31 2019-05-28 深圳市商汤科技有限公司 图像处理方法及装置、电子设备和存储介质
CN109840890A (zh) * 2019-01-31 2019-06-04 深圳市商汤科技有限公司 图像处理方法及装置、电子设备和存储介质
CN111223040A (zh) * 2020-01-09 2020-06-02 北京市商汤科技开发有限公司 网络训练方法及装置、图像生成方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11449759B2 (en) * 2018-01-03 2022-09-20 Siemens Heathcare Gmbh Medical imaging diffeomorphic registration based on machine learning
CN110633755A (zh) * 2019-09-19 2019-12-31 北京市商汤科技开发有限公司 网络训练方法、图像处理方法及装置、电子设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190040586A (ko) * 2017-10-11 2019-04-19 인하대학교 산학협력단 인공신경망을 이용한 단일 영상 고해상도 복원 방법 및 시스템
CN109816620A (zh) * 2019-01-31 2019-05-28 深圳市商汤科技有限公司 图像处理方法及装置、电子设备和存储介质
CN109840890A (zh) * 2019-01-31 2019-06-04 深圳市商汤科技有限公司 图像处理方法及装置、电子设备和存储介质
CN111223040A (zh) * 2020-01-09 2020-06-02 北京市商汤科技开发有限公司 网络训练方法及装置、图像生成方法及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114140603A (zh) * 2021-12-08 2022-03-04 北京百度网讯科技有限公司 虚拟形象生成模型的训练方法和虚拟形象生成方法
JP2022177218A (ja) * 2021-12-08 2022-11-30 ベイジン バイドゥ ネットコム サイエンス テクノロジー カンパニー リミテッド 虚像生成モデルのトレーニング方法および虚像生成方法
JP7374274B2 (ja) 2021-12-08 2023-11-06 ベイジン バイドゥ ネットコム サイエンス テクノロジー カンパニー リミテッド 虚像生成モデルのトレーニング方法および虚像生成方法

Also Published As

Publication number Publication date
TWI759830B (zh) 2022-04-01
CN111223040B (zh) 2023-04-25
CN111223040A (zh) 2020-06-02
TW202127369A (zh) 2021-07-16
US20220327385A1 (en) 2022-10-13
KR20220116015A (ko) 2022-08-19

Similar Documents

Publication Publication Date Title
WO2021139120A1 (zh) 网络训练方法及装置、图像生成方法及装置
WO2020224457A1 (zh) 图像处理方法及装置、电子设备和存储介质
WO2021155632A1 (zh) 图像处理方法及装置、电子设备和存储介质
WO2021196401A1 (zh) 图像重建方法及装置、电子设备和存储介质
WO2021056621A1 (zh) 文本序列的识别方法及装置、电子设备和存储介质
WO2021208667A1 (zh) 图像处理方法及装置、电子设备和存储介质
WO2020199704A1 (zh) 文本识别
WO2021012564A1 (zh) 视频处理方法及装置、电子设备和存储介质
CN111612070B (zh) 基于场景图的图像描述生成方法及装置
CN110245757B (zh) 一种图像样本的处理方法及装置、电子设备和存储介质
WO2023050723A1 (zh) 视频插帧方法、装置、电子设备、存储介质、程序及程序产品
WO2021208666A1 (zh) 字符识别方法及装置、电子设备和存储介质
CN111242303B (zh) 网络训练方法及装置、图像处理方法及装置
WO2020172979A1 (zh) 数据处理方法和装置、电子设备和存储介质
TWI778313B (zh) 圖像處理方法、電子設備和儲存介質
WO2020220807A1 (zh) 图像生成方法及装置、电子设备及存储介质
CN110633470A (zh) 命名实体识别方法、装置及存储介质
WO2021056770A1 (zh) 图像重建方法及装置、电子设备和存储介质
CN113139484B (zh) 人群定位方法及装置、电子设备和存储介质
CN111988622B (zh) 视频预测方法及装置、电子设备和存储介质
CN111311588B (zh) 重定位方法及装置、电子设备和存储介质
WO2021082381A1 (zh) 人脸识别方法及装置、电子设备和存储介质
CN114842404A (zh) 时序动作提名的生成方法及装置、电子设备和存储介质
CN110443363B (zh) 图像特征学习方法及装置
CN107992893B (zh) 压缩图像特征空间的方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20911364

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022540701

Country of ref document: JP

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 20227024492

Country of ref document: KR

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20911364

Country of ref document: EP

Kind code of ref document: A1