Specific embodiment
In order to better understand the above technical scheme, below by attached drawing and specific embodiment to this specification embodiment
Technical solution be described in detail, it should be understood that the specific features in this specification embodiment and embodiment are to this explanation
The detailed description of book embodiment technical solution, rather than the restriction to this specification technical solution, in the absence of conflict,
Technical characteristic in this specification embodiment and embodiment can be combined with each other.
With reference to shown in Figure 1A, Figure 1A is a kind of application scenarios of the virtual cosmetic method of this specification embodiment, user side
Terminal device 30, virtual client 10 of making up are applied to the terminal device 30 of user side.It is provided in virtual makeup client 10
More than one virtual makeup model 20.For example, terminal device 30 may is that VR equipment, mobile phone, tablet computer.If this is virtual
Client 10 of making up is applied to terminal device 30, and cosmetics data and the user of user's selection are directly acquired by terminal device 30
Adornment front face image;Terminal device 30 is based on virtual makeup model 20, by the cosmetics data application of user's selection before adornment
Portion's image predicts the corresponding dressing effect image of adornment front face image and presents to user.
With reference to shown in Figure 1B, Figure 1B is another application scenarios of the virtual cosmetic method of this specification embodiment, the scene
Under, the terminal device 30 including being located at user side, and the service positioned at network side being connected to the network between terminal device 30
Device 40 is provided with virtual make up system 50 on server 40, transmits the makeup that user selects from terminal device 30 to server 40
The adornment front face image of product data and user, the cosmetics data for being selected user based on virtual makeup model 20 by server 40
Applied to adornment front face image, the corresponding dressing effect image of adornment front face image is predicted, then by dressing effect image feedback
To terminal device 30, presented from terminal device 30 to user.
Specifically, virtually makeup client 10, virtual make up system 50 can be applied to the scene of online purchase cosmetics
Lower auxiliary user selects cosmetics, also can be applied to experience of making up on the line of various cosmetics companies.
In a first aspect, this illustrates a kind of virtual cosmetic method that embodiment provides, it is applied to virtual makeup shown in figure 1A
In virtual make up system shown in client or Figure 1B.Refering to what is shown in Fig. 2, the virtual makeup that this specification embodiment provides
Method includes the following steps:
S202, the cosmetics data for obtaining user's selection.
Specifically, user can choose the cosmetics data of single class or multiclass cosmetics.In an optional embodiment
In, the cosmetics data of user's selection, comprising: cosmetics brand and cosmetic property.More specifically, cosmetic property can be with
Including following type information: cosmetics type, cosmetics model, cosmetic color.Cosmetics type is signified are as follows: lipstick, informer
Pen, mascara etc., difference of the cosmetics model based on cosmetics brand, model setting is different, is not limited herein.
S204, the adornment front face image for obtaining user.
Specifically, obtaining before the adornment of user's current shooting photo before photo or pre-stored adornment.Based on photo before adornment
Determine adornment front face image.Specifically, if photo does not meet preset picture specification before adornment, by photo before adornment
It is handled to obtain adornment front face image;Otherwise, using photo before adornment as adornment front face image.
It should be noted that preset picture specification may include dimensions, it is one or more kinds of in borders.Such as
Photo does not meet preset dimensions before fruit adornment, then corresponding to reduce or amplify photo before the adornment, to meet preset size
Specification.If photo does not meet borders before adornment, the borderline region of photo before adornment is cut, to obtain with face in photo before adornment
Contouring is the adornment front face image on boundary.
S206, model of being made up based on destination virtual in adornment front face image, are predicted cosmetics data application before adornment
The corresponding dressing effect image of portion's image.
Desired cosmetic information is determined based on the cosmetics data of user's selection.Determining desired cosmetic information includes:
The facial characteristics of colouring information and instruction.It should be noted that colouring information can be indicated with rgb color mode, the face of instruction
Portion's feature is signified are as follows: the facial characteristics such as eyes, lip, eyelashes.
In an optional embodiment, user selects cosmetics data, can be with are as follows: based on preset cosmetics inventory into
The selection of row cosmetics data receives the cosmetics data that user selects from preset cosmetics inventory.In cosmetics inventory
There are many cosmetics brands and cosmetic property for user's selection for setting.
In the specific implementation process, the corresponding pass having between cosmetics data and cosmetics information is established in cosmetics inventory
System.Based on corresponding relationship, the corresponding desired cosmetic information of cosmetics data of user's selection is determined.
In an optional embodiment, using universal virtual makeup model as destination virtual makeup model, Huo Zhecong
It is virtually made up in the model basin of model including multiple single-items, determines single-item virtualization corresponding with the cosmetics data that user selects
Adornment model is made up model as destination virtual, and the single-item in model basin makes up model virtually with cosmetics brand and/or cosmetics
Type is to distinguish.
Specifically, the cosmetics data based on user's selection select universal virtual makeup model or single-item virtually to make up
Model is destination virtual makeup model.Optionally, user selects a variety of cosmetics types or choosing under same cosmetics brand
Select a variety of cosmetics types under a variety of cosmetic brands, it is determined that universal virtual makeup model is destination virtual makeup model.
If user selects a kind of cosmetics type, it is determined that single-item corresponding with the cosmetics type that user selects virtually make up model for
Destination virtual makeup model.
In S206, facial characteristics is applied based on what is indicated in the determining desired cosmetic information of cosmetics data, by mesh
The colouring information marked in cosmetics information is applied to corresponding facial characteristics in adornment front face image, predicts adornment front face image
Corresponding dressing effect image.
Specifically, destination virtual makeup model can be obtained based on following steps:
Step 10: by picture after picture before the original adornment of collection preset quantity user and original adornment, obtaining original image
Collection.
By picture after picture before the original adornment of collection preset quantity user and original adornment, various skin properties are obtained, respectively
A age of user, it is original after picture and the user are made up using cosmetics before the original shape of the user of the various colours of skin
Picture after adornment.Picture corresponds to same user with picture after original adornment before original adornment.
In this specification embodiment, corresponding between picture and picture degree after original adornment at least refers to before original adornment: figure
Face angle in piece is consistent.It is, of course, also possible to limit harsher correspondence index, such as: dimension of picture, brightness, saturation degree,
Contrast etc. is consistent.
Step 20: by handling original image collection, obtaining the picture sample collection comprising multiple trained pictures pair, training picture
To comprising for picture after picture before the adornment of same user and adornment.
Specifically, the processing of original image collection can be completed as follows:
Step 20A: it is concentrated from original image and washes out the multiple original images pair for meeting default sample index, original image
To comprising for picture after picture before the original adornment of same user and original adornment.
Preset sample index is for measuring whether retain reservation.Specifically, preset sample index may include as follows
It is one or more kinds of: luminance index, resolution ratio index, size index.From original image concentration wash out before original adornment picture and
Picture meets the picture pair of preset sample index simultaneously after corresponding original adornment, and is determined as original image pair.It needs to illustrate
If picture does not meet preset sample index with any of picture after corresponding original adornment picture before original adornment,
None are retained with picture after corresponding original adornment for picture before original adornment.
It should be understood that the specific value range of luminance index, resolution ratio index, size index can be according to reality
Demand setting, this specification embodiment is without specifically limiting.
Step 20B: to each original image to unitized processing is carried out, to obtain the picture sample for including multiple trained pictures pair
This collection, training picture is to comprising for picture after picture before the adornment of same user and adornment.
Unitized processing to original image pair, is specifically as follows: to scheming after picture before original adornment and corresponding original adornment
Piece carries out face capture, determines facial image region;The image-region except facial image region is cut, face figure is obtained
Picture;Facial image is amplified to specific image size, picture after picture and new adornment is obtained before new adornment, to obtain training figure
Piece pair.
In this specification embodiment, by being amplified to specific image size, the training that can concentrate picture sample is schemed
The size adjusting of piece pair is to consistent, thus effect when guaranteeing for training pattern.
In the specific implementation process, the original image of collection is concentrated comprising a variety of skin properties, a variety of age of user, a variety of
Picture after picture and original adornment before the original adornment of skin color.It includes a variety of skin properties that the picture sample then obtained, which is concentrated, more
Kind of age of user, a variety of skin colors adornment before picture after picture and corresponding adornment.To ensure that training picture sample used
Diversity.
It should be noted that since training process needs a large amount of picture samples, by picture sample possible after step 20B
Lazy weight can then extend the picture sample quantity of picture sample set by step 20C.If after step 20B
Picture sample quantity is enough, then can be omitted step 20C.
Step 2C: the training picture pair concentrated based on picture sample extends the picture sample quantity of picture sample set.Having
In body implementation process, sample size can be extended in the following way:
Mode one: training picture pair is replicated, picture after picture before adornment in the training picture sample of duplication and/or adornment is carried out
Increase brightness, generate new training picture to and be added to picture sample collection.
Mode two: training picture pair is replicated, picture after picture before the training picture centering adornment of duplication and/or adornment is increased
Add shade, generate new training picture to and be added to picture sample concentrate.
Mode three: replicating training picture pair, schemes to picture before the training picture centering training adornment of duplication and/or after training adornment
Piece carry out increase brightness and increase shade, generate new training picture to and be added to picture sample collection.
In the specific implementation process, can to different training pictures to use mode different in three kinds of modes as above into
Row processing, to extend sample size, so that sample size to the satisfaction for supplementing picture sample collection presets sample size.
Step 30: target virtualization adornment model is trained based on picture sample collection.
Specifically, initial convolutional neural networks model is trained based on picture sample collection, obtains destination virtual
Makeup model.One in model or be general specifically, destination virtual makeup model can virtually make up for multiple single-items
Type is virtually made up model.Multiple single-items model of virtually making up is set in model basin.
In this specification embodiment, universal virtual makeup model can be applied to the effect of the makeup to any facial characteristics
Fruit is predicted that versatility is stronger.Also, it can predict to use a variety of cosmetics pair simultaneously based on universal virtual makeup model
The dressing effect that facial characteristics is made up is corresponded in the adornment front face image of user.
In order to train universal virtual makeup model, each face presented in picture after the adornment that picture sample used is concentrated is special
Sign is made up;It is to be appreciated that the picture sample of the universal virtual makeup model of training is concentrated, scheme after not distinguishing adornment
The cosmetics brand to be applied some make up in piece.
In this specification embodiment, model of virtually being made up based on single-item can carry out makeup effect to specific facial characteristics
Fruit prediction, prediction result are more acurrate.Training has multiple single-items virtually to make up and model and is set in model basin in advance.Based on this,
The single-item that belongs in model basin of destination virtual makeup model is virtually made up model.Specifically, in order to train single-item virtually to make up
Model, picture sample concentrate adornment after picture present each facial characteristics in, by corresponding cosmetics brand and/or toiletries
The cosmetic makeup of type.
Specifically, the single-item in model basin virtually make up model can be with cosmetics type for distinguish.For example,
" mascara " corresponding single-item is virtually made up model, and " lipstick " corresponding another single-item is virtually made up model.Then it is directed to M type
M virtual make up system of cosmetics corresponding training are placed in model basin.The type of cosmetics is more, needs trained single-item empty
Quasi- makeup mould is more.
Single-item in model basin model of virtually making up can be with cosmetics brand and cosmetics type to distinguish.Citing comes
It says, the X of A brand1Money mascara corresponds to single-item and virtually makes up model m1, the Y of A brand1Money lipstick corresponds to single-item and virtually makes up model
m2, the X of B brand2Money mascara corresponds to single-item and virtually makes up model m3, the Y of B brand2Money lipstick corresponds to single-item and virtually makes up model
m4.To M*N single-item be trained virtually to make up model altogether for the cosmetics of N number of type of M brand.
In this specification embodiment, the adornment concentrated of picture sample after corresponding the applied some make up cosmetics brand of picture
It is different with cosmetics type, train come single-item virtually make up model difference.
For example, for the X of A brand1Money mascara is needed based on picture before adornment and using the X of A brand1Money mascara
Picture constitutes the picture sample collection of multiple trained pictures pair after the adornment of makeup, instructs to initial convolutional neural networks model
Practice, to obtain the X for A brand1The single-item of money mascara is virtually made up model;For the X of A brand2Money mascara, needs base
Picture and the X using B brand before comprising adornment2Picture constitutes the picture sample of multiple trained pictures pair after the adornment of money mascara makeup
This collection is trained initial convolutional neural networks model, to obtain the X for A brand2The single-item of money mascara virtualizes
Adornment model.
Certainly, in the specific implementation process, the model of virtually making up of the single-item in model basin can also be with cosmetics brand
To distinguish, details are not described herein.
In an optional embodiment, destination virtual makeup model specifically: determined from model basin and user selects
The brand message and the matched single-item of cosmetics type selected virtually make up model as destination virtual makeup model.Embodiment party herein
In formula, step S206 specifically: determine the cosmetics type and/or cosmetics brand of user's selection;Change based on user's selection
Cosmetic type and/or cosmetics brand determine destination virtual makeup model from model basin.Specifically, if user selects
Cosmetics type is selected, determines that single-item corresponding with the cosmetics type that user selects virtually makes up model as destination virtual makeup
Model;If user selects cosmetics brand, determine that corresponding with the cosmetics brand that user selects single-item is virtually made up model
As destination virtual makeup model;If user's simultaneous selection cosmetics brand and cosmetics type, determining and user selection
Cosmetics brand and the corresponding single-item of cosmetics type virtually make up model as destination virtual makeup model.
In the following, to being trained to obtain destination virtual makeup to initial convolutional neural networks model based on picture sample collection
The process of model is described:
Step 30A, picture sample collection is inputted, the image array for the training picture pair that picture sample is concentrated is generated;
Step 30B, it is carried out at convolution between the image array and initial convolutional neural networks model based on picture before adornment
Reason operation obtains the analog image matrix of picture before corresponding adornment;
Step 30C, the image array of comparative simulation image array and picture after adornment adjusts convolutional Neural based on comparing result
The model parameter of network model;
Step 30D, it is re-started between the image array based on picture before model and adornment comprising model parameter after adjustment
Process of convolution operation, circulation step 30C and step 30D obtain destination virtual makeup model until when meeting preset termination condition.
Specifically, maximum frequency of training can be set, the image of picture before the model and adornment of model parameter after adjusting is compared
Similarity between matrix, the similarity after meeting adjustment before the model and adornment of model parameter between the image array of picture reach
Training is terminated when reaching maximum frequency of training to default similarity or frequency of training, obtains destination virtual makeup model.Certainly
In the specific implementation process, other termination conditions be may be arranged as.
Second aspect is based on inventive concept same as cosmetic method virtual in previous embodiment, this specification embodiment
A kind of virtual cosmetic device is provided, refering to what is shown in Fig. 3, including:
Data capture unit 301, for obtaining the cosmetics data of user's selection;
Image acquisition unit 302, for obtaining the adornment front face image of user;
Makeup predicting unit 303, for being based on destination virtual makeup model for cosmetics data application in adornment front face figure
Picture predicts the corresponding dressing effect image of adornment front face image.
In a kind of optional mode, virtual cosmetic device, further includes: model determination unit 304 is used for universal void
Intend makeup model as destination virtual makeup model, or;From the model basin for virtually making up model including multiple single-items, determine
Single-item corresponding with cosmetics data virtually makes up model as destination virtual makeup model, and single-item makes up model virtually to make up
Product brand and/or cosmetics type are to distinguish.
In a kind of optional mode, virtual cosmetic device, further includes: picture collector unit 305, for pre- by collecting
If picture after picture and original adornment, obtains original image collection before the original adornment of number of users;Picture processing unit 306, for leading to
Processing original image collection is crossed, obtains the picture sample collection comprising multiple trained pictures pair, training picture is to comprising being directed to same use
Picture after picture and adornment before the adornment at family;Training unit 307, for training target virtualization adornment model based on picture sample collection.
Picture processing unit 306, is specifically used for: concentrating from original image and washes out the multiple originals for meeting default sample index
Beginning picture pair, original image is to comprising for picture after picture before the original adornment of same user and original adornment;To multiple original graphs
Piece is to unitized processing is carried out, to obtain the picture sample collection for including multiple trained pictures pair.
Picture processing unit 306, is also used to: the training picture pair concentrated based on picture sample, extension picture sample set
Picture sample quantity.
Training unit 307, is specifically used for: initial convolutional neural networks model is trained based on picture sample collection,
Obtain destination virtual makeup model.
Training unit 307, is specifically used for: input picture sample collection generates the image of picture sample concentration training picture pair
Matrix;Process of convolution operation is carried out between image array and initial convolutional neural networks model based on picture before adornment, is obtained
The analog image matrix of picture before corresponding adornment;The image array of picture after comparative simulation image array and adornment, is based on comparing result
Adjust the model parameter of convolutional neural networks model;Image moment based on picture before model and adornment comprising model parameter after adjustment
The step of re-starting process of convolution operation between battle array, recycling adjustment model parameter and re-start process of convolution operation is until completely
When sufficient preset termination condition, destination virtual makeup model is obtained.
The third aspect, is based on inventive concept same as cosmetic method virtual in previous embodiment, and this specification also provides
A kind of computer equipment, computer equipment are specifically as follows terminal device or server, as shown in figure 4, the computer equipment
Including memory 404, processor 402 and it is stored in the computer program that can be run on memory 404 and on the processor 402,
Processor 402 realizes step described in any embodiment of virtual cosmetic method above when executing program.
Wherein, in Fig. 4, bus architecture (is represented) with bus 400, and bus 400 may include any number of interconnection
Bus and bridge, bus 400 will include the one or more processors represented by processor 402 and what memory 404 represented deposits
The various circuits of reservoir link together.Bus 400 can also will peripheral equipment, voltage-stablizer and management circuit etc. it
Various other circuits of class link together, and these are all it is known in the art, therefore, no longer carry out further to it herein
Description.Bus interface 406 provides interface between bus 400 and receiver 401 and transmitter 403.Receiver 401 and transmitter
403 can be the same element, i.e. transceiver, provide the unit for communicating over a transmission medium with various other devices.Place
It manages device 402 and is responsible for management bus 400 and common processing, and memory 404 can be used for storage processor 402 and execute behaviour
Used data when making.
Fourth aspect, is based on inventive concept same as cosmetic method virtual in previous embodiment, and this specification also provides
A kind of computer readable storage medium, is stored thereon with computer program, realizes when which is executed by processor virtual above
Step described in any embodiment of cosmetic method.
This specification is referring to the method, equipment (system) and computer program product according to this specification embodiment
Flowchart and/or the block diagram describes.It should be understood that can be realized by computer program instructions every in flowchart and/or the block diagram
The combination of process and/or box in one process and/or box and flowchart and/or the block diagram.It can provide these computers
Processor of the program instruction to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices
To generate a machine, so that generating use by the instruction that computer or the processor of other programmable data processing devices execute
In setting for the function that realization is specified in one or more flows of the flowchart and/or one or more blocks of the block diagram
It is standby.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of equipment, the commander equipment realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Although the preferred embodiment of this specification has been described, once a person skilled in the art knows basic wounds
The property made concept, then additional changes and modifications may be made to these embodiments.So the following claims are intended to be interpreted as includes
Preferred embodiment and all change and modification for falling into this specification range.
Obviously, those skilled in the art can carry out various modification and variations without departing from this specification to this specification
Spirit and scope.In this way, if these modifications and variations of this specification belong to this specification claim and its equivalent skill
Within the scope of art, then this specification is also intended to include these modifications and variations.