IP Library › Granted Patent US 10,650,492
Granted Patent B2
US 10,650,492 · App. 16/052,429 · Granted May 12, 2020

Method and apparatus for generating image

Inventors: Tao He (Beijing, CN); Gang Zhang (Beijing, CN); Jingtuo Liu (Beijing, CN)
Assignee: Baidu Online Network Technology (Beijing) Co., Ltd.
G06T3/4007G06N3/084G06T5/50G06T7/344G06T11/00G06T2207/30201
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,650,492
App. No.
16/052,429
Granted
May 12, 2020
Kind
B2
Abstract

A method and an apparatus for generating an image are provided. A specific embodiment of the method comprises: acquiring a to-be-processed facial image, the image resolution of the to-be-processed facial image being lower than a preset first resolution threshold; and inputting the to-be-processed facial image into a pre-trained generative model to generate a processed facial image. The generative model updates a model parameter using a loss function in a training process, and the loss function is determined based on a probability of an image group being positive sample data, the image group composed of a facial sample image and a facial generative image. According to this embodiment, authenticity of the generated facial image is enhanced.

Claims (44)

1. A method for generating an image, comprising:

acquiring a to-be-processed facial image, an image resolution of the to-be-processed facial image being lower than a preset first resolution threshold; and

inputting the to-be-processed facial image into a pre-trained generative model to generate a processed facial image, wherein the generative model is obtained through the following training:

inputting a facial sample image into an initial generative model, and outputting, by the initial generative model, a facial generative image, an image resolution of the facial sample image being lower than the first resolution threshold;

inputting a 2-tuple composed of a pixel matrix of the facial sample image and a pixel matrix of the facial generative image into a pre-trained discriminative model, and outputting, by the discriminative model, a probability of an image group being positive sample data, the image group composed of the facial sample image and the facial generative image, and the positive sample data comprising a first real facial image whose image resolution higher than a second resolution threshold and a second real facial image whose image resolution lower than the first resolution threshold which is generated based on the first real facial image; and

obtaining a loss function of the initial generative model based on the probability, and updating a model parameter of the initial generative model using the loss function to obtain the generative model.

2. The method according to claim 1 , wherein the obtaining a loss function of the initial generative model based on the probability comprises:

determining the loss function of the initial generative model based on the probability and a similarity between the facial generative image and a standard facial image, wherein the standard facial image and a single facial generative image contain facial information of a same person.

3. The method according to claim 2 , wherein the determining the loss function of the initial generative model based on the probability and a similarity between the facial generative image and a standard facial image comprises:

extracting respectively feature information of the facial generative image and feature information of the standard facial image using a pre-trained recognition model, and calculating a Euclidean distance between the feature information of the facial generative image and the feature information of the standard facial image; and

obtaining the loss function of the initial generative model according to the probability and the Euclidean distance.

4. The method according to claim 1 , wherein the initial generative model is trained and obtained by:

using a first facial sample image whose image resolution lower than the first resolution threshold as an input and using a second facial sample image whose image resolution higher than the second resolution threshold as an output by using a machine learning method, wherein the first facial sample image and the second facial sample image contain the facial information of a same person.

5. The method according to claim 1 , wherein the discriminative model is trained and obtained by:

using first sample data as an input and using annotation information of the first sample data as an output by using a machine learning method, the first sample data comprising positive sample data with annotation information and negative sample data with annotation information, wherein the positive sample data comprises the first real facial image whose image resolution higher than the second resolution threshold and the second real facial image whose image resolution lower than the first resolution threshold which is obtained based on the first real facial image, and the negative sample data comprises a third real facial image whose image resolution lower than the first resolution threshold and a facial image outputted based on the third real facial image by the generative model.

6. The method according to claim 3 , wherein the recognition model is trained and obtained by:

using a third facial sample image as an input and feature information of the third facial sample image as an output by using a machine learning method.

7. An apparatus for generating an image, comprising:

at least one processor; and

a memory storing instructions, the instructions when executed by the at least one processor, cause the at least one processor to perform operations, the operations comprising:

acquiring a to-be-processed facial image, an image resolution of the to-be-processed facial image being lower than a preset first resolution threshold;

inputting the to-be-processed facial image into a pre-trained generative model to generate a processed facial image; and

training the generative model, wherein,

the generative model is obtained through the following training:

inputting a facial sample image into an initial generative model, and output, by the initial generative model, a facial generative image, an image resolution of the facial sample image being lower than the first resolution threshold;

inputting a 2-tuple composed of a pixel matrix of the facial sample image and a pixel matrix of the facial generative image into a pre-trained discriminative model, and outputting, by the discriminative model, a probability of an image group being positive sample data, the image group composed of the facial sample image and the facial generative image, and the positive sample data comprising a first real facial image whose image resolution higher than a second resolution threshold and a second real facial image whose image resolution lower than the first resolution threshold which is generated based on the first real facial image; and

obtaining a loss function of the initial generative model based on the probability, and updating a model parameter of the initial generative model using the loss function to obtain the generative model.

8. The apparatus according to claim 7 , wherein the obtaining a loss function of the initial generative model based on the probability comprises:

determining the loss function of the initial generative model based on the probability and a similarity between the facial generative image and a standard facial image, wherein the standard facial image and a single facial generative image contain facial information of a same person.

9. The apparatus according to claim 8 , wherein the determining the loss function of the initial generative model based on the probability and a similarity between the facial generative image and a standard facial image comprises:

extracting respectively feature information of the facial generative image and feature information of the standard facial image using a pre-trained recognition model, and calculating a Euclidean distance between the feature information of the facial generative image and the feature information of the standard facial image; and

obtaining the loss function of the initial generative model according to the probability and the Euclidean distance.

10. The apparatus according to claim 7 , wherein the initial generative model is trained and obtained by:

using a first facial sample image whose image resolution lower than the first resolution threshold as an input and using a second facial sample image whose image resolution higher than the second resolution threshold as an output by using a machine learning method to train and obtain the initial generative model, wherein the first facial sample image and the second facial sample image contain the facial information of a same person.

11. The apparatus according to claim 7 , wherein the discriminative model is trained and obtained by:

using first sample data as an input and using annotation information of the first sample data as an output by using a machine learning method to train and obtain the discriminative model, the first sample data comprises positive sample data with annotation information and negative sample data with annotation information, wherein the positive sample data comprises the first real facial image whose image resolution higher than the second resolution threshold and the second real facial image whose image resolution lower than the first resolution threshold which is obtained based on the first real facial image, and the negative sample data comprises a third real facial image whose image resolution lower than the first resolution threshold and a facial image outputted based on the third real facial image by the generative model.

12. The apparatus according to claim 9 , wherein the recognition model is trained and obtained by:

using a third facial sample image as an input and feature information of the third facial sample image as an output by using a machine learning method to train and obtain the recognition model.

13. A non-transitory computer storage medium, storing a computer program, wherein the computer program, when executed by a processor, cause the processor to perform operations, the operations comprising:

acquiring a to-be-processed facial image, an image resolution of the to-be-processed facial image being lower than a preset first resolution threshold; and

inputting the to-be-processed facial image into a pre-trained generative model to generate a processed facial image, wherein the generative model is obtained through the following training:

inputting a facial sample image into an initial generative model, and outputting, by the initial generative model, a facial generative image, an image resolution of the facial sample image being lower than the first resolution threshold;

inputting a 2-tuple composed of a pixel matrix of the facial sample image and a pixel matrix of the facial generative image into a pre-trained discriminative model, and outputting, by the discriminative model, a probability of an image group being positive sample data, the image group composed of the facial sample image and the facial generative image, and the positive sample data comprising a first real facial image whose image resolution higher than a second resolution threshold and a second real facial image whose image resolution lower than the first resolution threshold which is generated based on the first real facial image; and

obtaining a loss function of the initial generative model based on the probability, and updating a model parameter of the initial generative model using the loss function to obtain the generative model.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 6, 2020
From: HE, TAO; ZHANG, GANG; LIU, JINGTUO
To: BAIDU ONLINE NETWORK TECHNOLOGY (BEIJING) CO., LTD.
Reel/Frame 052319/0840 →
Priority Claims (1)
CN 2017 1 0806066 · Sep 8, 2017 · national
Continuity (1)
Related Publication 20190080433A1 · Mar 14, 2019
Cited By (1)
US 12,614,410