WO2021217856A1 - 人脸图像生成方法、装置、电子设备及可读存储介质 - Google Patents

人脸图像生成方法、装置、电子设备及可读存储介质 Download PDF

Info

Publication number
WO2021217856A1
WO2021217856A1 PCT/CN2020/098982 CN2020098982W WO2021217856A1 WO 2021217856 A1 WO2021217856 A1 WO 2021217856A1 CN 2020098982 W CN2020098982 W CN 2020098982W WO 2021217856 A1 WO2021217856 A1 WO 2021217856A1
Authority
WO
WIPO (PCT)
Prior art keywords
face image
image generation
generation model
area
vectors
Prior art date
Application number
PCT/CN2020/098982
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 平安科技(深圳)有限公司
Publication of WO2021217856A1 publication Critical patent/WO2021217856A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • G06V40/171Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification

Definitions

  • This application relates to the technical field of image processing in artificial intelligence, and in particular to a method, device, electronic device, and readable storage medium for generating a face image.
  • Face recognition is an important aspect in the field of artificial intelligence. With the development of machine learning, more models are used to recognize faces, and the purity and diversity of training data have an impact on the recognition accuracy of face recognition models.
  • the decisive impact the inventor realized that the current methods of data cleaning and image mirroring, flipping, zooming and other data enhancement methods are usually used to improve the purity and diversity of training data, which is time-consuming and labor-intensive, and the data generalization ability is insufficient.
  • the recognition ability of the model is poor. Therefore, there is an urgent need for a face image generation method to improve the purity and diversity of the training set images of the face recognition model.
  • the face image generation method provided in this application includes:
  • the request In response to a face image generation request sent by the client, the request includes the number m of users whose face images are to be generated and the number n of face images of each user, and according to the request, m first random numbers that obey a normal distribution are generated.
  • the m first random vectors are sequentially input into the feature separation area of the trained face image generation model, and m first high-order feature vectors and m first low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the high-order eigenvector set;
  • the n second random vectors are sequentially input into the feature separation area of the face image generation model to obtain n second high-order feature vectors and n second low-order feature vectors, and the n second low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the low-order eigenvector set;
  • the m first high-order feature vectors in the high-order feature vector set are sequentially matched with the n second low-order feature vectors in the low-order feature vector set one by one to obtain m*n vector pairs, and each The vector pair is input to the image generation area of the face image generation model to obtain m*n face images.
  • the present application also provides a face image generation device, including:
  • the request module is used to respond to a face image generation request sent by the client.
  • the request includes the number m of users whose face images are to be generated, the number n of face images for each user, and generates a normal distribution according to the request. m first random vectors and n second random vectors;
  • the first separation module is configured to sequentially input the m first random vectors into the feature separation area of the trained face image generation model to obtain m first high-order feature vectors and m first low-order feature vectors, Taking the set of the m first high-order feature vectors as a high-order feature vector set;
  • the second separation module is configured to sequentially input the n second random vectors into the feature separation area of the face image generation model to obtain n second high-order feature vectors and n second low-order feature vectors, and The set of the n second low-order feature vectors is used as a low-order feature vector set;
  • the present application also provides an electronic device, which includes a memory and a processor.
  • the memory stores a face image generation program that can run on the processor.
  • the face image generation program is executed by the processor, the following steps are implemented:
  • the request In response to a face image generation request sent by the client, the request includes the number m of users whose face images are to be generated and the number n of face images of each user, and according to the request, m first random numbers that obey a normal distribution are generated.
  • the m first random vectors are sequentially input into the feature separation area of the trained face image generation model, and m first high-order feature vectors and m first low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the high-order eigenvector set;
  • the n second random vectors are sequentially input into the feature separation area of the face image generation model to obtain n second high-order feature vectors and n second low-order feature vectors, and the n second low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the low-order eigenvector set;
  • the m first high-order feature vectors in the high-order feature vector set are sequentially matched with the n second low-order feature vectors in the low-order feature vector set one by one to obtain m*n vector pairs, and each The vector pair is input to the image generation area of the face image generation model to obtain m*n face images.
  • the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a human face image generation program, and the human face image generation program can be executed by one or more processors To achieve the following steps:
  • the request In response to a face image generation request sent by the client, the request includes the number m of users whose face images are to be generated and the number n of face images of each user, and according to the request, m first random numbers that obey a normal distribution are generated.
  • the m first random vectors are sequentially input into the feature separation area of the trained face image generation model, and m first high-order feature vectors and m first low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the high-order eigenvector set;
  • the n second random vectors are sequentially input into the feature separation area of the face image generation model to obtain n second high-order feature vectors and n second low-order feature vectors, and the n second low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the low-order eigenvector set;
  • the m first high-order feature vectors in the high-order feature vector set are sequentially matched with the n second low-order feature vectors in the low-order feature vector set one by one to obtain m*n vector pairs, and each The vector pair is input to the image generation area of the face image generation model to obtain m*n face images.
  • this application first generates m first random vectors and n according to the number m of users whose face images are to be generated in the face image generation request and the number n of face images of each user.
  • the second random vector then, the m first random vectors are input into the feature separation area of the trained face image generation model, and m first high-order feature vectors and m first low-order feature vectors are obtained, and m
  • the set of first high-order feature vectors is used as the high-order feature vector set; then, n second random vectors are input into the feature separation area of the face image generation model to obtain n second high-order feature vectors and nth
  • Two low-level feature vectors a set of n second low-level feature vectors is used as a low-level feature vector set, where the first and second high-level feature vectors represent the identity features of the face (e.g., left eye, right eye, Nose, mouth, forehead), the first and second low-level feature vectors represent the style features of the face
  • This application matches the first high-level feature vector representing identity features with the second low-level feature vector in the low-level feature vector set representing style features one by one, so that different styles of face images can be generated for the same user, so that the face The image is more diversified.
  • the high-level feature vector representing the identity feature remains unchanged, only the low-level feature vector representing the style feature is changed, which ensures the high purity of the same user's face image set. Faces with the same label There will be no noisy images in the image set. Therefore, this application improves the purity and diversity of the training set images of the face recognition model.
  • Fig. 1 is a schematic diagram of an embodiment of an electronic device of this application
  • FIG. 2 is a block diagram of an embodiment of the applicant's face image generating device
  • FIG. 3 is a flowchart of an embodiment of the applicant's face image generation method.
  • the electronic device 1 is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
  • the electronic device 1 may be a computer, a single web server, a server group composed of multiple web servers, or a cloud composed of a large number of hosts or web servers based on cloud computing, where cloud computing is a type of distributed computing, A super virtual computer composed of a group of loosely coupled computer sets.
  • the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be communicably connected to each other through a system bus.
  • the memory 11 stores a human face image generation program 10, and the human face
  • the image generation program 10 can be executed by the processor 12.
  • FIG. 1 only shows the electronic device 1 with the components 11-13 and the facial image generation program 10. Those skilled in the art can understand that the structure shown in FIG. 1 does not constitute a limitation on the electronic device 1, and may include Fewer or more parts than shown, or some parts in combination, or different parts arrangement.
  • the memory 11 includes a memory and at least one type of readable storage medium.
  • the memory provides a cache for the operation of the electronic device 1;
  • the readable storage medium can be, for example, flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM) ), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks and other non-volatile storage media.
  • the readable storage medium may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1.
  • the nonvolatile storage medium may also be an external storage unit of the electronic device 1.
  • Storage devices such as plug-in hard disks, Smart Media Card (SMC), Secure Digital (SD) cards, flash memory cards (Flash Card), etc., equipped on the electronic device 1.
  • the readable storage medium of the memory 11 is generally used to store the operating system and various application software installed in the electronic device 1, for example, to store the code of the face image generation program 10 in an embodiment of the present application.
  • the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 12 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
  • the processor 12 is generally used to control the overall operation of the electronic device 1, such as performing data interaction or communication-related control and processing with other devices.
  • the processor 12 is used to run the program code or process data stored in the memory 11, for example, to run the facial image generation program 10 and so on.
  • the network interface 13 may include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the electronic device 1 and a client (not shown in the figure).
  • the electronic device 1 may further include a user interface.
  • the user interface may include a display (Display) and an input unit such as a keyboard (Keyboard).
  • the optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visualized user interface.
  • the face image generation program 10 when executed by the processor 12, the following request step, the first separation step, the second separation step, and the generation step are implemented.
  • Request step In response to a face image generation request sent by the client, the request includes the number m of users whose face images are to be generated, the number n of face images for each user, and generate m obeying normal distributions according to the request.
  • a face image generation request includes: 100 user face images are to be generated, and the number of face images for each user is 50, a total of 5000 face images need to be generated, where the number of face images is 100.
  • the first random vector and the second random vector are randomly sampled vectors within [-1,1].
  • the first separation step sequentially input the m first random vectors into the feature separation area of the trained face image generation model to obtain m first high-order feature vectors and m first low-order feature vectors, and The set of m first high-order feature vectors is used as the high-order feature vector set.
  • the face image generation model includes a feature separation area, an image generation area, and an image discrimination area.
  • the feature separation area is used to split the input random vector into high-order feature vectors and low-order feature vectors;
  • the input of the image generation area is the feature vector output by the feature separation area, and the image generation area generates the input feature vector similar to the real one Face image;
  • the input of the image discrimination area is the face image output by the image generation area.
  • the image discrimination area is equivalent to a two-classifier. By extracting the characteristics of the input image, it can distinguish whether the input image is from the real image or the image generation area. Image, if the input image is from a real image, the image discrimination area outputs 1; otherwise, it outputs 0.
  • the feature separation area includes a first number of fully connected modules, the fully connected modules include one fully connected layer and one first activation layer, and the activation function of the first activation layer is a linear rectification unit function.
  • the feature separation area includes 18 fully connected modules. After the random vector passes through 18 fully connected layers, a 512-dimensional vector is obtained. Then, the 512-dimensional vector is copied into 18 512-dimensional vectors. Each 512-dimensional vector is sent to a fully connected layer to obtain 18 different 1024-dimensional vectors. Among the 18 vectors, the first 8 vectors are high-order feature vectors, and the last 10 vectors are low-order feature vectors.
  • the high-level feature vector is the identity feature vector of the face (e.g., the feature vector corresponding to the left eye, right eye, nose, mouth, and forehead), and the low-level feature vector is the style feature vector of the face (e.g., background, light Condition, skin color, hairstyle, hair color, glasses, and freckles corresponding feature vector), high-level feature vector can uniquely determine an identity, corresponding to a face image label.
  • the image generation area includes a second number of first convolution modules, and the first convolution module includes 2 conventional convolution layers and 1 transposed convolution layer, wherein the transposed convolution layer is located in the two conventional convolution layers.
  • the image generation area includes 9 first convolution modules, and each first convolution module performs an up-sampling through transposed convolution, and separates the output of the previous conventional convolution layer from the feature separation area. A 1024-dimensional vector is stitched together. After each sampling, the length and width of the image are doubled. After 9 samplings, a face image is generated.
  • an adaptiveinstancenormalization (adaptive instance normalization) operation is also performed on the spliced vector, which is used to align the mean and variance of the identity feature with the mean and variance of the style feature, speeding up the neural network The transmission speed is high, and the style conversion is completed in the feature space.
  • the image discrimination area includes a third number of second convolution modules, and the second convolution module includes 1 conventional convolution layer, 1 normalization layer, 1 second activation layer, and 1 fully connected layer ,
  • the activation function of the second activation layer is a hyperbolic tangent function.
  • the image discrimination area includes 4 second convolution modules.
  • the conventional convolution layer of the first second convolution module uses 64 5*5 convolution kernels for convolution operation.
  • the conventional convolution layer of the convolution module uses 128 5*5 convolution kernels for convolution operation, and the conventional convolution layer of the third second convolution module uses 256 5*5 convolution kernels for convolution operation.
  • the conventional convolution layer of the fourth second convolution module uses 512 5*5 convolution kernels for convolution operation, and the convolution step length of each layer is 2.
  • the principle of image generation by the face image generation model is: the feature separation area and the image generation area simulate the feature distribution of the sample images in the sample set to generate an image that conforms to the real image distribution to deceive the image discriminant area, and the image discriminant area distinguishes Whether the input image is the image generated in the image generation area or the real image.
  • the image generated in the image generation area is indistinguishable from the real sample, and the image discrimination area cannot correctly distinguish the generated image from the real image.
  • the training process of the face image generation model includes:
  • A1. Construct a first objective function, perform first training on the face image generation model, and obtain an optimized face image generation model;
  • A2. Construct a second objective function, and perform second training on the optimized face image generation model to obtain a trained face image generation model.
  • the constructing a first objective function and performing first training on the face image generation model to obtain an optimized face image generation model includes:
  • the set of the fourth number of real face images acquired from the preset database is used as the first face image set, and the first face image set is input into the image discrimination area of the face image generation model, Get the first discrimination rate;
  • the first objective function is:
  • V(D) represents the value of the first objective function
  • Ai represents the i-th image in the first face image set
  • D(A i ) represents the first discrimination rate of the i-th image in the first face image set
  • Z i represents the i-th random vector in the first random vector set
  • G(Z i ) represents the i-th image in the second face image set
  • D(G(Z i )) represents the i-th image in the second face image set
  • a ⁇ P data represents that A is sampled in the real image set P data
  • Z ⁇ P z represents that Z is sampled in the random vector set P z
  • E[] represents the mathematical expectation
  • the constructing the second objective function, performing the second training on the optimized face image generation model, and obtaining the trained face image generation model includes:
  • the set of the sixth number of real face images acquired from the preset database is used as the third face image set, and the third face image set is input into the optimized face image generation model Image discrimination area, get the third discrimination rate;
  • the second objective function is a game function
  • the characteristic separation area parameters, image generation area parameters, and image discrimination area parameters of the optimized face image generation model are adjusted so that the second objective function reaches a balance
  • the second objective function is:
  • V(D,G) represents the second objective function value
  • B i represents the ith image in the third face image set
  • D(B i ) represents the third discrimination rate of the ith image in the third face image set
  • C i represents the i-th random vector in the second random vector set
  • G(C i ) represents the i-th image in the fourth face image set
  • D(G(C i )) represents the i-th image in the fourth face image set
  • B ⁇ P data indicates that B is sampled in the real image set P data
  • C ⁇ P z indicates that C is sampled in the random vector set P z
  • E[] indicates the mathematical expectation.
  • the second separation step sequentially input the n second random vectors into the feature separation area of the face image generation model to obtain n second high-order feature vectors and n second low-order feature vectors, and combine the The set of n second low-order eigenvectors is used as the low-order eigenvector set.
  • the high-level feature vector set includes 100 first high-level feature vectors
  • the low-level feature vector set includes 50 second low-level feature vectors, which can determine the current total 100 identity tags, 50 style features.
  • Generating step match the m first high-order feature vectors in the high-order feature vector set with the n second low-order feature vectors in the low-order feature vector set one by one to obtain m*n vector pairs, in turn Each vector pair is input into the image generation area of the face image generation model to obtain m*n face images.
  • each identity feature vector in the high-level feature vector set with 50 style features in the low-level feature vector set 50 images of different styles can be generated for each user, realizing the diversification of face images, and at the same time Since the identity feature vector of each user has not changed, the image set of the same user does not contain images with other identity tags, which improves the purity of the image.
  • the electronic device 1 proposed in this application firstly generates m pieces of normal distribution according to the number m of users whose face images are to be generated in the face image generation request and the number n of face images of each user.
  • the first random vector and n second random vectors then, input m first random vectors into the feature separation area of the trained face image generation model to obtain m first high-order feature vectors and m first low Order feature vector, the set of m first high-order feature vectors is taken as the high-order feature vector set; then, n second random vectors are input into the feature separation area of the face image generation model to obtain n second high Order feature vector and n second low-order feature vectors, the set of n second low-order feature vectors is taken as the low-order feature vector set, where the first and second high-order feature vectors represent the identity features of the face (e.g.
  • the first and second low-level feature vectors represent the style features of the face (for example, background, lighting conditions, skin color, hairstyle, hair color, glasses, freckles); and finally , Match the m first high-order feature vectors in the high-order feature vector set with the n second low-order feature vectors in the low-order feature vector set in sequence to obtain m*n vector pairs, and input each vector pair in turn In the image generation area of the face image generation model, m*n face images are obtained.
  • This application matches the first high-level feature vector representing identity features with the second low-level feature vector in the low-level feature vector set representing style features one by one, so that different styles of face images can be generated for the same user, so that the face The image is more diversified.
  • the high-level feature vector representing the identity feature remains unchanged, only the low-level feature vector representing the style feature is changed, which ensures the high purity of the same user's face image set. Faces with the same label There will be no noisy images in the image set. Therefore, this application improves the purity and diversity of the training set images of the face recognition model.
  • FIG. 2 it is a block diagram of an embodiment of the applicant's face image generating apparatus 100.
  • the face image generation device 100 includes a request module 110, a first separation module 120, a second separation module 130, and a generation module 140.
  • a request module 110 a request module 110
  • a first separation module 120 a second separation module 130
  • a generation module 140 a generation module 140
  • the request module 110 is configured to respond to a facial image generation request sent by the client, the request includes the number m of users whose facial images are to be generated, the number n of facial images of each user, and generates a obedience normal according to the request. M first random vectors and n second random vectors of state distribution;
  • the first separation module 120 is configured to sequentially input the m first random vectors into the feature separation area of the trained face image generation model to obtain m first high-order feature vectors and m first low-order feature vectors Feature vector, taking the set of the m first high-order feature vectors as a high-order feature vector set;
  • the second separation module 130 is configured to sequentially input the n second random vectors into the feature separation area of the face image generation model to obtain n second high-level feature vectors and n second low-level features Vector, taking the set of the n second low-order feature vectors as a low-order feature vector set;
  • the generating module 140 is configured to sequentially match the m first high-order feature vectors in the high-order feature vector set with the n second low-order feature vectors in the low-order feature vector set one by one to obtain m*n Each vector pair is sequentially input into the image generation area of the face image generation model to obtain m*n face images.
  • the functions or operation steps implemented by the aforementioned request module 110, the first separation module 120, the second separation module 130, and the generation module 140 when executed are substantially the same as those of the aforementioned embodiment, and will not be repeated here.
  • the face image generation method includes steps S1-S4.
  • the request In response to a face image generation request sent by the client, the request includes the number m of users whose face images are to be generated, and the number n of face images for each user, and according to the request, generate m-th images that obey a normal distribution. A random vector and n second random vectors.
  • a face image generation request includes: 100 user face images are to be generated, and the number of face images for each user is 50, a total of 5000 face images need to be generated, where the number of face images is 100.
  • the first random vector and the second random vector are randomly sampled vectors within [-1,1].
  • the m first random vectors are sequentially input into the feature separation area of the trained face image generation model to obtain m first high-order feature vectors and m first low-order feature vectors, and the m
  • the first high-order feature vector set is used as the high-order feature vector set.
  • the face image generation model includes a feature separation area, an image generation area, and an image discrimination area.
  • the feature separation area is used to split the input random vector into high-order feature vectors and low-order feature vectors;
  • the input of the image generation area is the feature vector output by the feature separation area, and the image generation area generates the input feature vector similar to the real one Face image;
  • the input of the image discrimination area is the face image output by the image generation area.
  • the image discrimination area is equivalent to a two-classifier. By extracting the characteristics of the input image, it can distinguish whether the input image is from the real image or the image generation area. Image, if the input image is from a real image, the image discrimination area outputs 1; otherwise, it outputs 0.
  • the feature separation area includes a first number of fully connected modules, the fully connected modules include one fully connected layer and one first activation layer, and the activation function of the first activation layer is a linear rectification unit function.
  • the feature separation area includes 18 fully connected modules. After the random vector passes through 18 fully connected layers, a 512-dimensional vector is obtained. Then, the 512-dimensional vector is copied into 18 512-dimensional vectors. Each 512-dimensional vector is sent to a fully connected layer to obtain 18 different 1024-dimensional vectors. Among the 18 vectors, the first 8 vectors are high-order feature vectors, and the last 10 vectors are low-order feature vectors.
  • the high-level feature vector is the identity feature vector of the face (e.g., the feature vector corresponding to the left eye, right eye, nose, mouth, and forehead), and the low-level feature vector is the style feature vector of the face (e.g., background, light Condition, skin color, hairstyle, hair color, glasses, and freckles corresponding feature vector), high-level feature vector can uniquely determine an identity, corresponding to a face image label.
  • the image generation area includes a second number of first convolution modules, and the first convolution module includes 2 conventional convolution layers and 1 transposed convolution layer, wherein the transposed convolution layer is located in the two conventional convolution layers.
  • the image generation area includes 9 first convolution modules, and each first convolution module performs an up-sampling through transposed convolution, and separates the output of the previous conventional convolution layer from the feature separation area. A 1024-dimensional vector is stitched together. After each sampling, the length and width of the image are doubled. After 9 samplings, a face image is generated.
  • an adaptiveinstancenormalization (adaptive instance normalization) operation is also performed on the spliced vector to align the mean and variance of the identity feature with the mean and variance of the style feature, speeding up the neural network The transmission speed is high, and the style conversion is completed in the feature space.
  • the image discrimination area includes a third number of second convolution modules, and the second convolution module includes 1 conventional convolution layer, 1 normalization layer, 1 second activation layer, and 1 fully connected layer ,
  • the activation function of the second activation layer is a hyperbolic tangent function.
  • the image discrimination area includes 4 second convolution modules.
  • the conventional convolution layer of the first second convolution module uses 64 5*5 convolution kernels for convolution operation.
  • the conventional convolution layer of the convolution module uses 128 5*5 convolution kernels for convolution operation, and the conventional convolution layer of the third second convolution module uses 256 5*5 convolution kernels for convolution operation.
  • the conventional convolution layer of the fourth second convolution module uses 512 5*5 convolution kernels for convolution operation, and the convolution step length of each layer is 2.
  • the principle of image generation by the face image generation model is: the feature separation area and the image generation area simulate the feature distribution of the sample images in the sample set to generate an image that conforms to the real image distribution to deceive the image discriminant area, and the image discriminant area distinguishes Whether the input image is the image generated in the image generation area or the real image.
  • the image generated in the image generation area is indistinguishable from the real sample, and the image discrimination area cannot correctly distinguish the generated image from the real image.
  • the training process of the face image generation model includes:
  • A1. Construct a first objective function, perform first training on the face image generation model, and obtain an optimized face image generation model;
  • A2. Construct a second objective function, and perform second training on the optimized face image generation model to obtain a trained face image generation model.
  • the constructing a first objective function and performing first training on the face image generation model to obtain an optimized face image generation model includes:
  • the set of the fourth number of real face images acquired from the preset database is used as the first face image set, and the first face image set is input into the image discrimination area of the face image generation model, Get the first discrimination rate;
  • the first objective function is:
  • V(D) represents the value of the first objective function
  • Ai represents the i-th image in the first face image set
  • D(A i ) represents the first discrimination rate of the i-th image in the first face image set
  • Z i represents the i-th random vector in the first random vector set
  • G(Z i ) represents the i-th image in the second face image set
  • D(G(Z i )) represents the i-th image in the second face image set
  • a ⁇ P data represents that A is sampled in the real image set P data
  • Z ⁇ P z represents that Z is sampled in the random vector set P z
  • E[] represents the mathematical expectation
  • the constructing the second objective function, performing the second training on the optimized face image generation model, and obtaining the trained face image generation model includes:
  • the set of the sixth number of real face images acquired from the preset database is used as the third face image set, and the third face image set is input into the optimized face image generation model Image discrimination area, get the third discrimination rate;
  • the second objective function is a game function
  • the characteristic separation area parameters, image generation area parameters, and image discrimination area parameters of the optimized face image generation model are adjusted so that the second objective function reaches a balance
  • the second objective function is:
  • V(D,G) represents the second objective function value
  • B i represents the ith image in the third face image set
  • D(B i ) represents the third discrimination rate of the ith image in the third face image set
  • C i represents the i-th random vector in the second random vector set
  • G(C i ) represents the i-th image in the fourth face image set
  • D(G(C i )) represents the i-th image in the fourth face image set
  • B ⁇ P data indicates that B is sampled in the real image set P data
  • C ⁇ P z indicates that C is sampled in the random vector set P z
  • E[] indicates the mathematical expectation.
  • n second random vectors are sequentially input into the feature separation area of the face image generation model to obtain n second high-order feature vectors and n second low-order feature vectors, and the nth
  • the set of two low-order eigenvectors is used as the low-order eigenvector set.
  • the high-level feature vector set includes 100 first high-level feature vectors
  • the low-level feature vector set includes 50 second low-level feature vectors, which can determine the current total 100 identity tags, 50 style features.
  • each identity feature vector in the high-level feature vector set with 50 style features in the low-level feature vector set 50 images of different styles can be generated for each user, realizing the diversification of face images, and at the same time Since the identity feature vector of each user has not changed, the image set of the same user does not contain images with other identity tags, which improves the purity of the image.
  • the method provided in this application can also be applied to smart city fields such as smart security, smart transportation, smart communities, etc., so as to promote the construction of smart cities.
  • smart city fields such as smart security, smart transportation, smart communities, etc.
  • the purity of the image is improved by this solution, which can improve the accuracy of security inspections in smart security and so on.
  • this solution can also store the obtained m*n face images in a node of a blockchain.
  • the face image generation method proposed in this application firstly generates a normal distribution according to the number m of users whose face images are to be generated in the face image generation request and the number of face images n of each user. m first random vectors and n second random vectors; then, input m first random vectors into the feature separation area of the trained face image generation model to obtain m first high-order feature vectors and m A low-order feature vector, a set of m first high-order feature vectors is used as a high-order feature vector set; then, n second random vectors are input into the feature separation area of the face image generation model, and nth Two high-level feature vectors and n second low-level feature vectors, the set of n second low-level feature vectors is used as the low-level feature vector set, where the first and second high-level feature vectors represent the identity features of the face (E.g.
  • the first and second low-level feature vectors represent the style features of the face (e.g., background, lighting conditions, skin color, hairstyle, hair color, glasses, freckles) ;
  • the m first high-order eigenvectors in the high-order eigenvector set are matched with the n second low-order eigenvectors in the low-order eigenvector set to obtain m*n vector pairs, and each vector pair is sequentially matched Enter the image generation area of the face image generation model to obtain m*n face images.
  • This application matches the first high-level feature vector representing identity features with the second low-level feature vector in the low-level feature vector set representing style features one by one, so that different styles of face images can be generated for the same user, so that the face The image is more diversified.
  • the high-level feature vector representing the identity feature remains unchanged, only the low-level feature vector representing the style feature is changed, which ensures the high purity of the same user's face image set. Faces with the same label There will be no noisy images in the image set. Therefore, this application improves the purity and diversity of the training set images of the face recognition model.
  • the embodiments of the present application also propose a computer-readable storage medium.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the computer-readable storage medium may be a hard disk, a multimedia card, or an SD card. , Flash memory card, SMC, read only memory (ROM), erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, etc. any one or more of them random combination.
  • the computer-readable storage medium includes a face image generating program 10, which implements the following operations when executed by a processor:
  • the request In response to a face image generation request sent by the client, the request includes the number m of users whose face images are to be generated and the number n of face images of each user, and according to the request, m first random numbers that obey a normal distribution are generated.
  • the m first random vectors are sequentially input into the feature separation area of the trained face image generation model, and m first high-order feature vectors and m first low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the high-order eigenvector set;
  • the n second random vectors are sequentially input into the feature separation area of the face image generation model to obtain n second high-order feature vectors and n second low-order feature vectors, and the n second low-order feature vectors are obtained.
  • the set of high-order eigenvectors is used as the low-order eigenvector set;
  • the m first high-order feature vectors in the high-order feature vector set are sequentially matched with the n second low-order feature vectors in the low-order feature vector set one by one to obtain m*n vector pairs, and each The vector pair is input to the image generation area of the face image generation model to obtain m*n face images.
  • the specific implementation of the computer-readable storage medium of the present application is substantially the same as the specific implementation of the above-mentioned method for generating a face image and the electronic device 1, and will not be repeated here.
  • the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better. ⁇
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to make a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present application.
  • a terminal device which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Health & Medical Sciences (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)
  • Collating Specific Patterns (AREA)

Abstract

一种人工智能中的图像处理技术领域的人脸图像生成方法、装置、电子设备以及计算机可读存储介质,方法包括:响应客户端发出的人脸图像生成请求,请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据请求生成服从正态分布的m个第一随机向量及n个第二随机向量(S1);将m个第一随机向量输入人脸图像生成模型的特征分离区,得到高阶特征向量集(S2);将n个第二随机向量输入模型的特征分离区,得到低阶特征向量集(S3);将高阶特征向量集中的m个第一高阶特征向量与低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,将每个向量对输入模型的图像生成区,得到m*n张人脸图像(S4);提升了训练集图像的纯净度和多样性。还可应用于智慧安防、智慧交通、智慧社区等智慧城市领域中,推动智慧城市的建设。

Description

人脸图像生成方法、装置、电子设备及可读存储介质
本申请要求于2020年4月30日提交中国专利局、申请号为CN202010360187.1、发明名称为“人脸图像生成方法、电子装置及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能中的图像处理技术领域,尤其涉及一种人脸图像生成方法、装置、电子设备及可读存储介质。
背景技术
人脸识别是人工智能领域的一个重要方面,随着机器学习的发展,更多的是采用模型对人脸进行识别,而训练数据的纯净度和多样性对人脸识别模型的识别准确性产生决定性的影响,发明人意识到当前通常通过数据清洗及图像镜像、翻转、缩放等数据增强的方法来提高训练数据的纯净度和多样性,耗时、耗力,且数据泛化能力不足,当脸部有遮盖物(例如,戴眼镜、脸部有伤痕、雀斑)时,模型的识别能力较差。因此,亟需一种人脸图像生成方法,以提升人脸识别模型的训练集图像的纯净度和多样性。
发明内容
鉴于以上内容,有必要提供一种人脸图像生成方法,旨在提升人脸识别模型的训练集图像的纯净度和多样性。
本申请提供的人脸图像生成方法,包括:
响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
此外,为实现上述目的,本申请还提供一种人脸图像生成装置,包括:
请求模块,用于响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
第一分离模块,用于将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
第二分离模块,用于将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
生成模块,用于将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
此外,为实现上述目的,本申请还提供一种电子设备,该电子设备包括:存储器、处理器,所述存储器中存储有可在所述处理器上运行的人脸图像生成程序,所述人脸图像生成程序被所述处理器执行时实现如下步骤:
响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有人脸图像生成程序,所述人脸图像生成程序可被一个或者多个处理器执行,以实现如下步骤:
响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
相较现有技术,本申请首先根据人脸图像生成请求中待生成人脸图像的用户数量m、每个用户的人脸图像数量n生成服从正态分布的m个第一随机向量及n个第二随机向量;然后,将m个第一随机向量输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将m个第一高阶特征向量的集合作为高阶特征向量集;接着,将n个第二随机向量输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将n个第二低阶特征向量的集合作为低阶特征向量集,其中,第一、第二高阶特征向量代表人脸的身份特征(例如,左眼、右眼、鼻子、嘴巴、额头),第一、第二低阶特征向量代表人脸的风格特征(例如,背景、光照条件、肤色、发型、发色、眼镜、雀斑);最后,将高阶特征向量集中的m个第一高阶特征向量与低阶特征向量集中的n个第二低阶特征向量依次匹配,得到m*n个向量对,依次将每个向量对输入人脸图像生成模型的图像生成区,得到m*n张人脸图像。本申请通过将代表身份特征的第一高阶特征向量依次与代表风格特征的低阶特征向量集中的第二低阶 特征向量逐一匹配,可为同一用户生成不同风格的人脸图像,使得人脸图像更加多样化,同时,因代表身份特征的高阶特征向量保持不变,仅变化了代表风格特征的低阶特征向量,保证了同一用户人脸图像集的高纯净度,同一标签的人脸图像集中将不存在噪声图像。因此,本申请提升了人脸识别模型的训练集图像的纯净度和多样性。
附图说明
图1为本申请电子设备一实施例的示意图;
图2为本申请人脸图像生成装置一实施例的模块图;
图3为本申请人脸图像生成方法一实施例的流程图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。
如图1所示,为本申请电子设备1一实施例的示意图。电子设备1是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。所述电子设备1可以是计算机、也可以是单个网络服务器、多个网络服务器组成的服务器组或者基于云计算的由大量主机或者网络服务器构成的云,其中云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。
在本实施例中,电子设备1包括,但不仅限于,可通过系统总线相互通信连接的存储器11、处理器12、网络接口13,该存储器11中存储有人脸图像生成程序10,所述人脸图像生成程序10可被所述处理器12执行。图1仅示出了具有组件11-13以及人脸图像生成程序10的电子设备1,本领域技术人员可以理解的是,图1示出的结构并不构成对电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
其中,存储器11包括内存及至少一种类型的可读存储介质。内存为电子设备1的运行提供缓存;可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等的非易失性存储介质。在一些实施例中,可读存储介质可以是电子设备1的内部存储单元,例如该电子设备1的硬盘;在另一些实施例中,该非易失性存储介质也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。本实施例中,存储器11的可读存储介质通常用于存储安装于电子设备1的操作系统和各类应用软件,例如存储本申请一实施例中的人脸图像生成程序10的代码等。此外,存储器11还可以用于暂时地存储已经输出或者将要输出的各类数据。
处理器12在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器12通常用于控制所述电子设备1的总体操作,例如执行与其他设备进行数据交互或者通信相关的控制和处理等。本实 施例中,所述处理器12用于运行所述存储器11中存储的程序代码或者处理数据,例如运行人脸图像生成程序10等。
网络接口13可包括无线网络接口或有线网络接口,该网络接口13用于在所述电子设备1与客户端(图中未画出)之间建立通信连接。
可选的,所述电子设备1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选的,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
在本申请的一实施例中,所述人脸图像生成程序10被所述处理器12执行时实现如下请求步骤、第一分离步骤、第二分离步骤及生成步骤。
请求步骤:响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量。
例如,人脸图像生成请求包括:待生成100个用户的人脸图像,每个用户的人脸图像数量为50张,则共需生成5000张人脸图像,其中,人脸图像的标签数量为100个。
本实施例中,第一随机向量及第二随机向量为[-1,1]内随机采样的向量。
第一分离步骤:将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集。
本实施例中,所述人脸图像生成模型包括特征分离区、图像生成区、图像判别区。
特征分离区用于将输入的随机向量拆分为高阶特征向量及低阶特征向量;图像生成区的输入为特征分离区输出的特征向量,图像生成区将输入的特征向量生成类似于真实的人脸图像;图像判别区的输入为图像生成区输出的人脸图像,图像判别区相当于一个二分类器,通过提取输入图像的特征,区分输入的图像是来自真实图像还是图像生成区生成的图像,若输入的图像来自真实图像,图像判别区输出1,否则,输出0。
所述特征分离区包括第一数量的全连接模块,所述全连接模块包括1个全连接层、1个第一激活层,所述第一激活层的激活函数为线性整流单元函数。本实施例中,特征分离区包括18个全连接模块,随机向量通过18个全连接层后,得到一个512维的向量,然后,将该512维的向量复制为18个512维的向量,将每一个512维的向量分别送入一个全连接层,得到18个不同的1024维的向量,这18个向量中,前8个向量为高阶特征向量,后10个向量为低阶特征向量。
所述高阶特征向量为人脸的身份特征向量(比如,左眼、右眼、鼻子、嘴巴、额头对应的特征向量),所述低阶特征向量为人脸的风格特征向量(比如,背景、光照条件、肤色、发型、发色、眼镜、雀斑对应的特征向量),高阶特征向量可以唯一确定一个身份,对应一个人脸图像标签。
所述图像生成区包括第二数量的第一卷积模块,所述第一卷积模块包括2个常规卷积层、1个转置卷积层,其中,转置卷积层位于两层常规卷积层中间。本实施例中,图像生成区包括9个第一卷积模块,每个第一卷积模块通过转置卷积做一次上采样,将前一个常规卷积层的输出与特征分离区得到的18个1024维的向量进行拼接,每次采样后,图像的长、宽分别扩大一倍,9次采样后,生成人脸图像。
本实施例中,每次拼接后,还对拼接得到的向量执行adaptiveinstancenormalization(自适应实例归一化)操作,用于将身份特征的均值和方差与样式特征的均值和方差对齐,加快了神经网络的传输速度,在特征空间中完成风格转换。
所述图像判别区包括第三数量的第二卷积模块,所述第二卷积模块包括1个常规卷积层、1个归一化层、1个第二激活层、1个全连接层,所述第二激活层的激活函数为双曲正切函数。本实施例中,图像判别区包括4个第二卷积模块,第一个第二卷积模块的常规卷积层采用64个5*5的卷积核进行卷积操作,第二个第二卷积模块的常规卷积层采用128个5*5的卷积核进行卷积操作,第三个第二卷积模块的常规卷积层采用256个5*5的卷积核进行卷积操作,第四个第二卷积模块的常规卷积层采用512个5*5的卷积核进行卷积操作,各层卷积步长均为2。
所述人脸图像生成模型生成图像的原理为:特征分离区及图像生成区通过模拟样本集中的样本图像的特征分布,生成符合真实图像分布的图像,来欺骗图像判别区,而图像判别区分辨输入的图像是图像生成区生成的图像还是真实图像,通过模型训练使得图像生成区生成的图像与真实样本无差别,图像判别区也无法正确的区分生成的图像和真实图像。
本实施例中,所述人脸图像生成模型的训练过程包括:
A1、构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型;
A2、构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型。
所述构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型,包括:
B1、将从预设数据库中获取的第四数量的真实人脸图像的集合作为第一人脸图像集,将所述第一人脸图像集输入所述人脸图像生成模型的图像判别区,得到第一判别率;
B2、将服从正态分布的第五数量的随机向量的集合作为第一随机向量集,将所述第一随机向量集输入所述人脸图像生成模型的特征分离区,得到第一特征集,将所述第一特征集输入所述人脸图像生成模型的图像生成区,得到第二人脸图像集,将所述第二人脸图像集输入所述人脸图像生成模型的图像判别区,得到第二判别率;
B3、根据所述第一判别率、第二判别率构建第一目标函数;
B4、固定所述特征分离区及图像生成区的参数,采用梯度上升法调整所述图像判别区的参数,使得第一目标函数值最小,得到优化的人脸图像生成模型。
本实施例中,所述第一目标函数为:
Figure PCTCN2020098982-appb-000001
其中,V(D)表示第一目标函数值,A i表示第一人脸图像集中第i张图像,D(A i)表示第一人脸图像集中第i张图像的第一判别率,Z i表示第一随机向量集中第i个随机向量,G(Z i)表示第二人脸图像集中第i张图像,D(G(Z i))表示第二人脸图像集中第i张图像的第二判别率,A~P data表示A采样于真实图像集合P data,Z~P z表示Z采样于随机向量集合P z,E[]表示求数学期望;
所述构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型包括:
C1、将从所述预设数据库中获取的第六数量的真实人脸图像的集合作为第三人脸图像集,将所述第三人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第三判别率;
C2、将服从正态分布的第七数量的随机向量的集合作为第二随机向量集,将所述第二随机向量集输入所述优化的人脸图像生成模型的特征分离区,得到第二特征集,将所述第二特征集输入所述优化的人脸图像生成模型的图像生成区,得到第四人脸图像集,将所述第四人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第四判别率;
C3、根据所述第三判别率、第四判别率构建第二目标函数;
C4、采用梯度下降法调整所述优化的人脸图像生成模型的特征分离区参数、图像生 成区参数、图像判别区参数,使得第二目标函数达到平衡,得到训练好的人脸图像生成模型。
本实施例中,所述第二目标函数为博弈函数,所述调整所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数、图像判别区参数,使得第二目标函数达到平衡,包括:
D1、对所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数执行第一调整,使得第二目标函数值最小;
D2、对所述优化的人脸图像生成模型的图像判别区参数执行第二调整,使得第二目标函数值最大;
D3、通过所述第一调整与第二调整来调整第二目标函数值,当第二目标函数值不再变化时,第二目标函数达到平衡。
所述第二目标函数为:
Figure PCTCN2020098982-appb-000002
其中,V(D,G)表示第二目标函数值,B i表示第三人脸图像集中第i张图像,D(B i)表示第三人脸图像集中第i张图像的第三判别率,C i表示第二随机向量集中第i个随机向量,G(C i)表示第四人脸图像集中第i张图像,D(G(C i))表示第四人脸图像集中第i张图像的第四判别率,B~P data表示B采样于真实图像集合P data,C~P z表示C采样于随机向量集合P z,E[]表示求数学期望。
第二分离步骤:将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集。
以图像生成请求中m为100、n为50为例,则高阶特征向量集中包括100个第一高阶特征向量,低阶特征向量集中包括50个第二低阶特征向量,可确定当前共100个身份标签、50种风格特征。
生成步骤:将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
将高阶特征向量集中每个身份特征向量分别与低阶特征向量集中的50种风格特征进行组合,则可为每个用户生成50张不同风格的图像,实现了人脸图像的多样化,同时因每个用户的身份特征向量未改变,故同一用户的图像集中不含其它身份标签的图像,提高了图像的纯净度。
由上述实施例可知,本申请提出的电子设备1,首先,根据人脸图像生成请求中待生成人脸图像的用户数量m、每个用户的人脸图像数量n生成服从正态分布的m个第一随机向量及n个第二随机向量;然后,将m个第一随机向量输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将m个第一高阶特征向量的集合作为高阶特征向量集;接着,将n个第二随机向量输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将n个第二低阶特征向量的集合作为低阶特征向量集,其中,第一、第二高阶特征向量代表人脸的身份特征(例如,左眼、右眼、鼻子、嘴巴、额头),第一、第二低阶特征向量代表人脸的风格特征(例如,背景、光照条件、肤色、发型、发色、眼镜、雀斑);最后,将高阶特征向量集中的m个第一高阶特征向量与低阶特征向量集中的n个第二低阶特征向量依次匹配,得到m*n个向量对,依次将每个向量对输入人脸图像生成模型的图像生成区,得到m*n张人脸图像。本申请通过将代表身份特征的第一高阶特征向量依次与代表风格特征的低阶特征向量集中的第二低阶特征向量逐一匹配,可为同一用户生成不同风格的人脸图像,使得人脸图像更加多样化,同时,因代表身份特征的高阶特征向量保持不变,仅变化了代表 风格特征的低阶特征向量,保证了同一用户人脸图像集的高纯净度,同一标签的人脸图像集中将不存在噪声图像。因此,本申请提升了人脸识别模型的训练集图像的纯净度和多样性。
如图2所示,为本申请人脸图像生成装置100一实施例的模块图。
在本申请的一个实施例中,人脸图像生成装置100包括请求模块110、第一分离模块120、第二分离模块130及生成模块140,示例性地:
所述请求模块110,用于响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
所述第一分离模块120,用于将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
所述第二分离模块130,用于将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
所述生成模块140,用于将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
上述请求模块110、第一分离模块120、第二分离模块130及生成模块140等模块被执行时所实现的功能或操作步骤与上述实施例大体相同,在此不再赘述。
如图3所示,为本申请人脸图像生成方法一实施例的流程图,该人脸图像生成方法包括步骤S1-S4。
S1、响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量。
例如,人脸图像生成请求包括:待生成100个用户的人脸图像,每个用户的人脸图像数量为50张,则共需生成5000张人脸图像,其中,人脸图像的标签数量为100个。
本实施例中,第一随机向量及第二随机向量为[-1,1]内随机采样的向量。
S2、将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集。
本实施例中,所述人脸图像生成模型包括特征分离区、图像生成区、图像判别区。
特征分离区用于将输入的随机向量拆分为高阶特征向量及低阶特征向量;图像生成区的输入为特征分离区输出的特征向量,图像生成区将输入的特征向量生成类似于真实的人脸图像;图像判别区的输入为图像生成区输出的人脸图像,图像判别区相当于一个二分类器,通过提取输入图像的特征,区分输入的图像是来自真实图像还是图像生成区生成的图像,若输入的图像来自真实图像,图像判别区输出1,否则,输出0。
所述特征分离区包括第一数量的全连接模块,所述全连接模块包括1个全连接层、1个第一激活层,所述第一激活层的激活函数为线性整流单元函数。本实施例中,特征分离区包括18个全连接模块,随机向量通过18个全连接层后,得到一个512维的向量,然后,将该512维的向量复制为18个512维的向量,将每一个512维的向量分别送入一个全连接层,得到18个不同的1024维的向量,这18个向量中,前8个向量为高阶特征向量,后10个向量为低阶特征向量。
所述高阶特征向量为人脸的身份特征向量(比如,左眼、右眼、鼻子、嘴巴、额头对应的特征向量),所述低阶特征向量为人脸的风格特征向量(比如,背景、光照条件、肤 色、发型、发色、眼镜、雀斑对应的特征向量),高阶特征向量可以唯一确定一个身份,对应一个人脸图像标签。
所述图像生成区包括第二数量的第一卷积模块,所述第一卷积模块包括2个常规卷积层、1个转置卷积层,其中,转置卷积层位于两层常规卷积层中间。本实施例中,图像生成区包括9个第一卷积模块,每个第一卷积模块通过转置卷积做一次上采样,将前一个常规卷积层的输出与特征分离区得到的18个1024维的向量进行拼接,每次采样后,图像的长、宽分别扩大一倍,9次采样后,生成人脸图像。
本实施例中,每次拼接后,还对拼接得到的向量执行adaptiveinstancenormalization(自适应实例归一化)操作,用于将身份特征的均值和方差与样式特征的均值和方差对齐,加快了神经网络的传输速度,在特征空间中完成风格转换。
所述图像判别区包括第三数量的第二卷积模块,所述第二卷积模块包括1个常规卷积层、1个归一化层、1个第二激活层、1个全连接层,所述第二激活层的激活函数为双曲正切函数。本实施例中,图像判别区包括4个第二卷积模块,第一个第二卷积模块的常规卷积层采用64个5*5的卷积核进行卷积操作,第二个第二卷积模块的常规卷积层采用128个5*5的卷积核进行卷积操作,第三个第二卷积模块的常规卷积层采用256个5*5的卷积核进行卷积操作,第四个第二卷积模块的常规卷积层采用512个5*5的卷积核进行卷积操作,各层卷积步长均为2。
所述人脸图像生成模型生成图像的原理为:特征分离区及图像生成区通过模拟样本集中的样本图像的特征分布,生成符合真实图像分布的图像,来欺骗图像判别区,而图像判别区分辨输入的图像是图像生成区生成的图像还是真实图像,通过模型训练使得图像生成区生成的图像与真实样本无差别,图像判别区也无法正确的区分生成的图像和真实图像。
本实施例中,所述人脸图像生成模型的训练过程包括:
A1、构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型;
A2、构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型。
所述构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型,包括:
B1、将从预设数据库中获取的第四数量的真实人脸图像的集合作为第一人脸图像集,将所述第一人脸图像集输入所述人脸图像生成模型的图像判别区,得到第一判别率;
B2、将服从正态分布的第五数量的随机向量的集合作为第一随机向量集,将所述第一随机向量集输入所述人脸图像生成模型的特征分离区,得到第一特征集,将所述第一特征集输入所述人脸图像生成模型的图像生成区,得到第二人脸图像集,将所述第二人脸图像集输入所述人脸图像生成模型的图像判别区,得到第二判别率;
B3、根据所述第一判别率、第二判别率构建第一目标函数;
B4、固定所述特征分离区及图像生成区的参数,采用梯度上升法调整所述图像判别区的参数,使得第一目标函数值最小,得到优化的人脸图像生成模型。
本实施例中,所述第一目标函数为:
Figure PCTCN2020098982-appb-000003
其中,V(D)表示第一目标函数值,A i表示第一人脸图像集中第i张图像,D(A i)表示第一人脸图像集中第i张图像的第一判别率,Z i表示第一随机向量集中第i个随机向量,G(Z i)表示第二人脸图像集中第i张图像,D(G(Z i))表示第二人脸图像集中第i张图像的第二判别率,A~P data表示A采样于真实图像集合P data,Z~P z表示Z采样于随机向量集合P z,E[]表示求数学期望;
所述构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好 的人脸图像生成模型包括:
C1、将从所述预设数据库中获取的第六数量的真实人脸图像的集合作为第三人脸图像集,将所述第三人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第三判别率;
C2、将服从正态分布的第七数量的随机向量的集合作为第二随机向量集,将所述第二随机向量集输入所述优化的人脸图像生成模型的特征分离区,得到第二特征集,将所述第二特征集输入所述优化的人脸图像生成模型的图像生成区,得到第四人脸图像集,将所述第四人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第四判别率;
C3、根据所述第三判别率、第四判别率构建第二目标函数;
C4、采用梯度下降法调整所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数、图像判别区参数,使得第二目标函数达到平衡,得到训练好的人脸图像生成模型。
本实施例中,所述第二目标函数为博弈函数,所述调整所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数、图像判别区参数,使得第二目标函数达到平衡,包括:
D1、对所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数执行第一调整,使得第二目标函数值最小;
D2、对所述优化的人脸图像生成模型的图像判别区参数执行第二调整,使得第二目标函数值最大;
D3、通过所述第一调整与第二调整来调整第二目标函数值,当第二目标函数值不再变化时,第二目标函数达到平衡。
所述第二目标函数为:
Figure PCTCN2020098982-appb-000004
其中,V(D,G)表示第二目标函数值,B i表示第三人脸图像集中第i张图像,D(B i)表示第三人脸图像集中第i张图像的第三判别率,C i表示第二随机向量集中第i个随机向量,G(C i)表示第四人脸图像集中第i张图像,D(G(C i))表示第四人脸图像集中第i张图像的第四判别率,B~P data表示B采样于真实图像集合P data,C~P z表示C采样于随机向量集合P z,E[]表示求数学期望。
S3、将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集。
以图像生成请求中m为100、n为50为例,则高阶特征向量集中包括100个第一高阶特征向量,低阶特征向量集中包括50个第二低阶特征向量,可确定当前共100个身份标签、50种风格特征。
S4、将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
将高阶特征向量集中每个身份特征向量分别与低阶特征向量集中的50种风格特征进行组合,则可为每个用户生成50张不同风格的图像,实现了人脸图像的多样化,同时因每个用户的身份特征向量未改变,故同一用户的图像集中不含其它身份标签的图像,提高了图像的纯净度。
在另一个实施例中,本申请所提供的方法还可应用于智慧安防、智慧交通、智慧社区等智慧城市领域中,从而推动智慧城市的建设。比如通过本方案提高了图像的纯净度,从而可提高智慧安防中安防检查的准确率等等。
在另一个实施例中,为进一步保证上述得到的m*n张人脸图像的私密和安全性,本 方案还可以将得到的m*n张人脸图像存储于一区块链的节点中。
由上述实施例可知,本申请提出的人脸图像生成方法,首先,根据人脸图像生成请求中待生成人脸图像的用户数量m、每个用户的人脸图像数量n生成服从正态分布的m个第一随机向量及n个第二随机向量;然后,将m个第一随机向量输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将m个第一高阶特征向量的集合作为高阶特征向量集;接着,将n个第二随机向量输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将n个第二低阶特征向量的集合作为低阶特征向量集,其中,第一、第二高阶特征向量代表人脸的身份特征(例如,左眼、右眼、鼻子、嘴巴、额头),第一、第二低阶特征向量代表人脸的风格特征(例如,背景、光照条件、肤色、发型、发色、眼镜、雀斑);最后,将高阶特征向量集中的m个第一高阶特征向量与低阶特征向量集中的n个第二低阶特征向量依次匹配,得到m*n个向量对,依次将每个向量对输入人脸图像生成模型的图像生成区,得到m*n张人脸图像。本申请通过将代表身份特征的第一高阶特征向量依次与代表风格特征的低阶特征向量集中的第二低阶特征向量逐一匹配,可为同一用户生成不同风格的人脸图像,使得人脸图像更加多样化,同时,因代表身份特征的高阶特征向量保持不变,仅变化了代表风格特征的低阶特征向量,保证了同一用户人脸图像集的高纯净度,同一标签的人脸图像集中将不存在噪声图像。因此,本申请提升了人脸识别模型的训练集图像的纯净度和多样性。
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质可以是非易失性,也可以是易失性,计算机可读存储介质可以是硬盘、多媒体卡、SD卡、闪存卡、SMC、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器等中的任意一种或者几种的任意组合。计算机可读存储介质中包括人脸图像生成程序10,所述人脸图像生成程序10被处理器执行时实现如下操作:
响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
本申请之计算机可读存储介质的具体实施方式与上述人脸图像生成方法以及电子设备1的具体实施方式大致相同,在此不再赘述。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可 借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种人脸图像生成方法,应用于电子设备,其中,所述方法包括:
    响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
    将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
    将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
    将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
  2. 如权利要求1所述的人脸图像生成方法,所述人脸图像生成模型还包括图像判别区,其中,所述特征分离区包括第一数量的全连接模块,所述全连接模块包括1个全连接层、1个第一激活层;
    所述图像生成区包括第二数量的第一卷积模块,所述第一卷积模块包括2个常规卷积层、1个转置卷积层,其中,转置卷积层位于两层常规卷积层中间;
    所述图像判别区包括第三数量的第二卷积模块,所述第二卷积模块包括1个常规卷积层、1个归一化层、1个第二激活层、1个全连接层。
  3. 如权利要求2所述的人脸图像生成方法,其中,所述人脸图像生成模型的训练过程包括:
    构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型;
    构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型。
  4. 如权利要求3所述的人脸图像生成方法,其中,所述构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型包括:
    将从预设数据库中获取的第四数量的真实人脸图像的集合作为第一人脸图像集,将所述第一人脸图像集输入所述人脸图像生成模型的图像判别区,得到第一判别率;
    将服从正态分布的第五数量的随机向量的集合作为第一随机向量集,将所述第一随机向量集输入所述人脸图像生成模型的特征分离区,得到第一特征集,将所述第一特征集输入所述人脸图像生成模型的图像生成区,得到第二人脸图像集,将所述第二人脸图像集输入所述人脸图像生成模型的图像判别区,得到第二判别率;
    根据所述第一判别率、第二判别率构建第一目标函数;
    固定所述特征分离区及图像生成区的参数,采用梯度上升法调整所述图像判别区的参数,使得第一目标函数值最小,得到优化的人脸图像生成模型。
  5. 如权利要求4所述的人脸图像生成方法,其中,所述构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型包括:
    将从所述预设数据库中获取的第六数量的真实人脸图像的集合作为第三人脸图像集,将所述第三人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第三判别率;
    将服从正态分布的第七数量的随机向量的集合作为第二随机向量集,将所述第二随机向量集输入所述优化的人脸图像生成模型的特征分离区,得到第二特征集,将所述第二特 征集输入所述优化的人脸图像生成模型的图像生成区,得到第四人脸图像集,将所述第四人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第四判别率;
    根据所述第三判别率、第四判别率构建第二目标函数;
    采用梯度下降法调整所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数、图像判别区参数,使得第二目标函数达到平衡,得到训练好的人脸图像生成模型。
  6. 如权利要求5所述的人脸图像生成方法,其中,所述调整所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数、图像判别区参数,使得第二目标函数达到平衡,包括:
    对所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数执行第一调整,使得第二目标函数值最小;
    对所述优化的人脸图像生成模型的图像判别区参数执行第二调整,使得第二目标函数值最大;
    通过所述第一调整与第二调整来调整第二目标函数值,当第二目标函数值不再变化时,第二目标函数达到平衡。
  7. 如权利要求4所述的人脸图像生成方法,其中,所述第一目标函数为:
    Figure PCTCN2020098982-appb-100001
    其中,V(D)表示第一目标函数值,A i表示第一人脸图像集中第i张图像,D(A i)表示第一人脸图像集中第i张图像的第一判别率,Z i表示第一随机向量集中第i个随机向量,G(Z i)表示第二人脸图像集中第i张图像,D(G(Z i))表示第二人脸图像集中第i张图像的第二判别率,A~P data表示A采样于真实图像集合P data,Z~P z表示Z采样于随机向量集合P z,E[]表示求数学期望。
  8. 如权利要求6所述的人脸图像生成方法,其中,所述第二目标函数为:
    Figure PCTCN2020098982-appb-100002
    其中,V(D,G)表示第二目标函数值,B i表示第三人脸图像集中第i张图像,D(B i)表示第三人脸图像集中第i张图像的第三判别率,C i表示第二随机向量集中第i个随机向量,G(C i)表示第四人脸图像集中第i张图像,D(G(C i))表示第四人脸图像集中第i张图像的第四判别率,B~P data表示B采样于真实图像集合P data,C~P z表示C采样于随机向量集合P z,E[]表示求数学期望。
  9. 一种人脸图像生成装置,其中,包括:
    请求模块,用于响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
    第一分离模块,用于将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
    第二分离模块,用于将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
    生成模块,用于将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
  10. 一种电子设备,其中,该电子设备包括:存储器、处理器,所述存储器上存储有可在所述处理器上运行的人脸图像生成程序,所述人脸图像生成程序被所述处理器执行时实现如下步骤:
    响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、 每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
    将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
    将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
    将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
  11. 如权利要求10所述的电子设备,所述人脸图像生成模型还包括图像判别区,其中,所述特征分离区包括第一数量的全连接模块,所述全连接模块包括1个全连接层、1个第一激活层;
    所述图像生成区包括第二数量的第一卷积模块,所述第一卷积模块包括2个常规卷积层、1个转置卷积层,其中,转置卷积层位于两层常规卷积层中间;
    所述图像判别区包括第三数量的第二卷积模块,所述第二卷积模块包括1个常规卷积层、1个归一化层、1个第二激活层、1个全连接层。
  12. 如权利要求11所述的电子设备,其中,所述人脸图像生成模型的训练过程包括:
    构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型;
    构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型。
  13. 如权利要求12所述的电子设备,其中,所述构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型包括:
    将从预设数据库中获取的第四数量的真实人脸图像的集合作为第一人脸图像集,将所述第一人脸图像集输入所述人脸图像生成模型的图像判别区,得到第一判别率;
    将服从正态分布的第五数量的随机向量的集合作为第一随机向量集,将所述第一随机向量集输入所述人脸图像生成模型的特征分离区,得到第一特征集,将所述第一特征集输入所述人脸图像生成模型的图像生成区,得到第二人脸图像集,将所述第二人脸图像集输入所述人脸图像生成模型的图像判别区,得到第二判别率;
    根据所述第一判别率、第二判别率构建第一目标函数;
    固定所述特征分离区及图像生成区的参数,采用梯度上升法调整所述图像判别区的参数,使得第一目标函数值最小,得到优化的人脸图像生成模型。
  14. 如权利要求13所述的电子设备,其中,所述构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型包括:
    将从所述预设数据库中获取的第六数量的真实人脸图像的集合作为第三人脸图像集,将所述第三人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第三判别率;
    将服从正态分布的第七数量的随机向量的集合作为第二随机向量集,将所述第二随机向量集输入所述优化的人脸图像生成模型的特征分离区,得到第二特征集,将所述第二特征集输入所述优化的人脸图像生成模型的图像生成区,得到第四人脸图像集,将所述第四人脸图像集输入所述优化的人脸图像生成模型的图像判别区,得到第四判别率;
    根据所述第三判别率、第四判别率构建第二目标函数;
    采用梯度下降法调整所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数、图像判别区参数,使得第二目标函数达到平衡,得到训练好的人脸图像生成模型。
  15. 如权利要求14所述的电子设备,其中,所述调整所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数、图像判别区参数,使得第二目标函数达到平衡,包括:
    对所述优化的人脸图像生成模型的特征分离区参数、图像生成区参数执行第一调整,使得第二目标函数值最小;
    对所述优化的人脸图像生成模型的图像判别区参数执行第二调整,使得第二目标函数值最大;
    通过所述第一调整与第二调整来调整第二目标函数值,当第二目标函数值不再变化时,第二目标函数达到平衡。
  16. 如权利要求13所述的电子设备,其中,所述第一目标函数为:
    Figure PCTCN2020098982-appb-100003
    其中,V(D)表示第一目标函数值,A i表示第一人脸图像集中第i张图像,D(A i)表示第一人脸图像集中第i张图像的第一判别率,Z i表示第一随机向量集中第i个随机向量,G(Z i)表示第二人脸图像集中第i张图像,D(G(Z i))表示第二人脸图像集中第i张图像的第二判别率,A~P data表示A采样于真实图像集合P data,Z~P z表示Z采样于随机向量集合P z,E[]表示求数学期望。
  17. 如权利要求15所述的电子设备,其中,所述第二目标函数为:
    Figure PCTCN2020098982-appb-100004
    其中,V(D,G)表示第二目标函数值,B i表示第三人脸图像集中第i张图像,D(B i)表示第三人脸图像集中第i张图像的第三判别率,C i表示第二随机向量集中第i个随机向量,G(C i)表示第四人脸图像集中第i张图像,D(G(C i))表示第四人脸图像集中第i张图像的第四判别率,B~P data表示B采样于真实图像集合P data,C~P z表示C采样于随机向量集合P z,E[]表示求数学期望。
  18. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有人脸图像生成程序,所述人脸图像生成程序可被一个或者多个处理器执行,以实现如下步骤:
    响应客户端发出的人脸图像生成请求,所述请求包括待生成人脸图像的用户数量m、每个用户的人脸图像数量n,根据所述请求生成服从正态分布的m个第一随机向量及n个第二随机向量;
    将所述m个第一随机向量依次输入训练好的人脸图像生成模型的特征分离区,得到m个第一高阶特征向量及m个第一低阶特征向量,将所述m个第一高阶特征向量的集合作为高阶特征向量集;
    将所述n个第二随机向量依次输入所述人脸图像生成模型的特征分离区,得到n个第二高阶特征向量及n个第二低阶特征向量,将所述n个第二低阶特征向量的集合作为低阶特征向量集;
    将所述高阶特征向量集中的m个第一高阶特征向量依次与所述低阶特征向量集中的n个第二低阶特征向量逐一匹配,得到m*n个向量对,依次将每个向量对输入所述人脸图像生成模型的图像生成区,得到m*n张人脸图像。
  19. 如权利要求18所述的计算机可读存储介质,所述人脸图像生成模型还包括图像判别区,其中,所述特征分离区包括第一数量的全连接模块,所述全连接模块包括1个全连接层、1个第一激活层;
    所述图像生成区包括第二数量的第一卷积模块,所述第一卷积模块包括2个常规卷积层、1个转置卷积层,其中,转置卷积层位于两层常规卷积层中间;
    所述图像判别区包括第三数量的第二卷积模块,所述第二卷积模块包括1个常规卷积层、1个归一化层、1个第二激活层、1个全连接层。
  20. 如权利要求19所述的计算机可读存储介质,其中,所述人脸图像生成模型的训 练过程包括:
    构建第一目标函数,对所述人脸图像生成模型进行第一训练,得到优化的人脸图像生成模型;
    构建第二目标函数,对所述优化的人脸图像生成模型进行第二训练,得到训练好的人脸图像生成模型。
PCT/CN2020/098982 2020-04-30 2020-06-29 人脸图像生成方法、装置、电子设备及可读存储介质 WO2021217856A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010360187.1A CN111652064B (zh) 2020-04-30 2020-04-30 人脸图像生成方法、电子装置及可读存储介质
CN202010360187.1 2020-04-30

Publications (1)

Publication Number Publication Date
WO2021217856A1 true WO2021217856A1 (zh) 2021-11-04

Family

ID=72349431

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/098982 WO2021217856A1 (zh) 2020-04-30 2020-06-29 人脸图像生成方法、装置、电子设备及可读存储介质

Country Status (2)

Country Link
CN (1) CN111652064B (zh)
WO (1) WO2021217856A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719309B (zh) * 2023-08-08 2023-10-27 东莞正大康地饲料有限公司 饲料生产控制系统的异常报警方法及系统

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103695A (zh) * 2009-12-21 2011-06-22 北京中星微电子有限公司 一种图像样本生成方法及装置
CN106780662A (zh) * 2016-11-16 2017-05-31 北京旷视科技有限公司 人脸图像生成方法、装置及设备
CN108446601A (zh) * 2018-02-27 2018-08-24 东南大学 一种基于动静特征融合的人脸识别方法
CN109308681A (zh) * 2018-09-29 2019-02-05 北京字节跳动网络技术有限公司 图像处理方法和装置
US10311288B1 (en) * 2017-03-24 2019-06-04 Stripe, Inc. Determining identity of a person in a digital image
CN110659582A (zh) * 2019-08-29 2020-01-07 深圳云天励飞技术有限公司 图像转换模型训练方法、异质人脸识别方法、装置及设备
CN110781738A (zh) * 2019-09-19 2020-02-11 平安科技(深圳)有限公司 生成人脸图像的方法、装置、计算机设备及存储介质

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030063796A1 (en) * 2001-09-28 2003-04-03 Koninklijke Philips Electronics N.V. System and method of face recognition through 1/2 faces
CN107273978B (zh) * 2017-05-25 2019-11-12 清华大学 一种三模型博弈的产生式对抗网络模型的建立方法及装置
CN107633236B (zh) * 2017-09-28 2019-01-22 北京达佳互联信息技术有限公司 图像内容理解方法、装置及服务器
CN110197099B (zh) * 2018-02-26 2022-10-11 腾讯科技(深圳)有限公司 跨年龄人脸识别及其模型训练的方法和装置
CN108960324A (zh) * 2018-06-29 2018-12-07 北京奇虎科技有限公司 建立跨域联合分布匹配模型的方法、装置及其应用
CN109543548A (zh) * 2018-10-26 2019-03-29 桂林电子科技大学 一种人脸识别方法、装置及存储介质
CN109685097B (zh) * 2018-11-08 2020-12-25 银河水滴科技(北京)有限公司 一种基于gan的图像检测方法及装置
CN109753589A (zh) * 2018-11-28 2019-05-14 中国科学院信息工程研究所 一种基于图卷积网络的图可视化方法
CN110309709A (zh) * 2019-05-20 2019-10-08 平安科技(深圳)有限公司 人脸识别方法、装置及计算机可读存储介质
CN110516544B (zh) * 2019-07-19 2024-04-09 平安科技(深圳)有限公司 基于深度学习的人脸识别方法、装置及计算机可读存储介质
CN111062468B (zh) * 2020-03-06 2023-06-20 图灵人工智能研究院(南京)有限公司 生成网络的训练方法和系统、以及图像生成方法及设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103695A (zh) * 2009-12-21 2011-06-22 北京中星微电子有限公司 一种图像样本生成方法及装置
CN106780662A (zh) * 2016-11-16 2017-05-31 北京旷视科技有限公司 人脸图像生成方法、装置及设备
US10311288B1 (en) * 2017-03-24 2019-06-04 Stripe, Inc. Determining identity of a person in a digital image
CN108446601A (zh) * 2018-02-27 2018-08-24 东南大学 一种基于动静特征融合的人脸识别方法
CN109308681A (zh) * 2018-09-29 2019-02-05 北京字节跳动网络技术有限公司 图像处理方法和装置
CN110659582A (zh) * 2019-08-29 2020-01-07 深圳云天励飞技术有限公司 图像转换模型训练方法、异质人脸识别方法、装置及设备
CN110781738A (zh) * 2019-09-19 2020-02-11 平安科技(深圳)有限公司 生成人脸图像的方法、装置、计算机设备及存储介质

Also Published As

Publication number Publication date
CN111652064B (zh) 2024-06-07
CN111652064A (zh) 2020-09-11

Similar Documents

Publication Publication Date Title
WO2019120115A1 (zh) 人脸识别的方法、装置及计算机装置
CN108009521B (zh) 人脸图像匹配方法、装置、终端及存储介质
WO2021218060A1 (zh) 基于深度学习的人脸识别方法及装置
US20200143248A1 (en) Machine learning model training method and device, and expression image classification method and device
CN111177569B (zh) 基于人工智能的推荐处理方法、装置及设备
CN112417096B (zh) 问答对匹配方法、装置、电子设备及存储介质
Rajasekar et al. Enhanced multimodal biometric recognition approach for smart cities based on an optimized fuzzy genetic algorithm
WO2022105118A1 (zh) 基于图像的健康状态识别方法、装置、设备及存储介质
CN107808118A (zh) 身份识别方法、电子装置及计算机可读存储介质
CN109766840A (zh) 人脸表情识别方法、装置、终端及存储介质
CN108780519A (zh) 卷积神经网络中的结构学习
KR20160061856A (ko) 객체 인식 방법 및 장치, 및 인식기 학습 방법 및 장치
CN112418059B (zh) 一种情绪识别的方法、装置、计算机设备及存储介质
CN111368672A (zh) 一种用于遗传病面部识别模型的构建方法及装置
CN105740808B (zh) 人脸识别方法和装置
WO2021169641A1 (zh) 人脸识别方法和系统
CN113656587B (zh) 文本分类方法、装置、电子设备及存储介质
CN111816300A (zh) 基于深度强化学习的数据分类方法、装置、设备及介质
CN115050064A (zh) 人脸活体检测方法、装置、设备及介质
CN107392191B (zh) 身份判定方法、装置及电子设备
CN112446322A (zh) 眼球特征检测方法、装置、设备及计算机可读存储介质
WO2021012958A1 (zh) 原创文本甄别方法、装置、设备与计算机可读存储介质
WO2021042895A1 (zh) 基于神经网络的验证码识别方法、系统及计算机设备
WO2021217856A1 (zh) 人脸图像生成方法、装置、电子设备及可读存储介质
CN111666976A (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: 20933445

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20933445

Country of ref document: EP

Kind code of ref document: A1