Summary of the invention
The present disclosure proposes the method and apparatus for training pattern, and the method and apparatus for generating information.
In a first aspect, embodiment of the disclosure provides a kind of method for training pattern, this method comprises: obtaining instruction
Practice sample set, wherein the training sample that training sample is concentrated includes the key point of head image, head subject in head image
The posture classification information of head subject in information and head image;Using machine learning algorithm, the instruction that training sample is concentrated
The head image that white silk sample includes is as input data, by key point information corresponding with the head image of input and posture classification
Information is as desired output data, and training obtains key point and posture classification determines model, wherein key point and posture classification are true
Cover half type includes that key point determines that submodel and posture classification determine submodel, and key point determines submodel for determining head figure
The position of the key point of head subject as in, posture classification determine submodel for determining the head subject in head image
The classification of posture.
In some embodiments, using machine learning algorithm, the head figure for including by the training sample that training sample is concentrated
As being used as input data, using key point information corresponding with the head image of input and posture classification information as desired output number
According to training obtains key point and posture classification determines model, comprising: obtain initial model, wherein initial model includes the first son
Model, the second submodel and third submodel;Using machine learning algorithm, the head for including by the training sample that training sample is concentrated
Input data of portion's image as the first submodel obtains the reality output data of the first submodel, by the reality of the first submodel
Input data of the border output data as the second submodel and third submodel, respectively obtains the second submodel and third submodel
Reality output data, reality output data and desired output data based on the second submodel and third submodel, adjustment just
The parameter of beginning model obtains the initial model of training completion, and the initial model that training is completed is determined as key point and appearance
State classification determines model, wherein the desired output data of the second submodel are the key point information of training sample, third submodel
Desired output data be training sample posture classification information;Initial model the first submodel for including that training is completed and
Second submodel is determined as key point and determines submodel, and the first submodel for including by the initial model that training is completed and the
Three submodels are determined as posture classification and determine submodel.
In some embodiments, head image is that the posture classification information of face-image and head image is used to indicate
It smiles, laugh, crying, any one of anger.
In some embodiments, the posture classification information of head image is used to indicate any for bowing, come back, in the head of side
?.
Second aspect, embodiment of the disclosure provide a kind of method for generating information, this method comprises: obtaining mesh
Mark head image;Target cranial image is input to the key point that in advance trained key point and posture classification determine that model includes
It determines submodel, obtains the key point information of the head subject in target cranial image, wherein key point and posture classification determine
Model is by as the method training of any embodiment in the above-mentioned method for training pattern obtains.
In some embodiments, target cranial image is input to key point trained in advance and determines submodel, obtain mesh
Mark the key point information of the head subject in head image, comprising: target cranial image is input to key point trained in advance
And posture classification determines that the key point that model includes determines that submodel and posture classification determine submodel, obtains target cranial image
In head subject belong to each posture classification information in predetermined posture classification information set instruction posture classification
Probability and the head subject in target cranial image key point information;Based on obtained probability and key point information,
Determine the final key point information of the head subject in target cranial image.
In some embodiments, it is based on obtained probability and key point information, determines the head in target cranial image
The final key point information of object, comprising: determine whether maximum probability is greater than or equal in advance in obtained each probability
Determining probability threshold value;It is greater than or equal to probability threshold value in response to maximum probability, obtained key point information is determined as
The final key point information of head subject in target cranial image.
The third aspect, embodiment of the disclosure provide a kind of device for training pattern, which includes: first to obtain
Unit is taken, is configured to obtain training sample set, wherein the training sample that training sample is concentrated includes head image, head figure
The posture classification information of head subject in the key point information and head image of head subject as in;Training unit is matched
The head image that using machine learning algorithm, includes using the training sample that training sample is concentrated is set to as input data, it will be with
The corresponding key point information of the head image of input and posture classification information as desired output data, training obtain key point and
Posture classification determines model, wherein key point and posture classification determine that model includes that key point determines submodel and posture classification
Determine submodel, key point determines the position of key point of the submodel for determining the head subject in head image, posture class
Not Que Ding submodel be used to determine head subject in head image posture classification.
In some embodiments, training unit includes: acquisition module, is configured to obtain initial model, wherein introductory die
Type includes the first submodel, the second submodel and third submodel;Training module is configured to using machine learning algorithm, will
Input data of the head image that the training sample that training sample is concentrated includes as the first submodel, obtains the first submodel
Reality output data, using the reality output data of the first submodel as the input data of the second submodel and third submodel,
The reality output data for respectively obtaining the second submodel and third submodel, the reality based on the second submodel and third submodel
Output data and desired output data, adjust the parameter of initial model, obtain the initial model of training completion, and will train
At initial model be determined as key point and posture classification determines model, wherein the desired output data of the second submodel are instruction
Practice the key point information of sample, the desired output data of third submodel are the posture classification information of training sample;Determining module,
It is configured to the first submodel for training the initial model of completion to include and the second submodel being determined as key point to determine submodule
Type, and the first submodel and third submodel that the initial model that training is completed includes are determined as posture classification and determine submodule
Type.
In some embodiments, head image is that the posture classification information of face-image and head image is used to indicate
It smiles, laugh, crying, any one of anger.
In some embodiments, the posture classification information of head image is used to indicate any for bowing, come back, in the head of side
?.
Fourth aspect, embodiment of the disclosure provide a kind of for generating the device of information, which includes: second to obtain
Unit is taken, is configured to obtain target cranial image;Input unit is configured to target cranial image being input to preparatory training
Key point and the posture classification key point that determines that model includes determine submodel, obtain the head subject in target cranial image
Key point information, wherein key point and posture classification determine that model is by appointing in such as above-mentioned method for training pattern
What the method training of one embodiment obtained.
In some embodiments, input unit includes: input module, is configured to for target cranial image being input in advance
Trained key point and posture classification determines that the key point that model includes determines that submodel and posture classification determine submodel, obtains
Each posture classification information that head subject in target cranial image belongs in predetermined posture classification information set refers to
The probability for the posture classification shown and the key point information of the head subject in target cranial image;Determining module is configured to
Based on obtained probability and key point information, the final key point information of the head subject in target cranial image is determined.
In some embodiments, determining module includes: the first determining submodule, is configured to determine obtained each general
Whether maximum probability is greater than or equal to predetermined probability threshold value in rate;Second determines submodule, is configured in response to
Maximum probability is greater than or equal to probability threshold value, and obtained key point information is determined as the head pair in target cranial image
The final key point information of elephant.
5th aspect, embodiment of the disclosure provide a kind of electronic equipment, comprising: one or more processors;Storage
Device is stored thereon with one or more programs, when said one or multiple programs are executed by said one or multiple processors,
So that the one or more processors realize the method such as any embodiment in the above-mentioned method for training pattern.
6th aspect, embodiment of the disclosure provide a kind of computer-readable medium, are stored thereon with computer program,
The method such as any embodiment in the above-mentioned method for training pattern is realized when the program is executed by processor.
The method and apparatus for training pattern that embodiment of the disclosure provides, and method for generating information with
Device passes through and obtains training sample set, wherein the training sample that training sample is concentrated includes head image, in head image
Then the posture classification information of head subject in the key point information and head image of head subject is calculated using machine learning
Method, the head image for including using the training sample that training sample is concentrated, will be corresponding with the head image of input as input data
Key point information and posture classification information as desired output data, training obtains key point and posture classification determines model,
Wherein, key point and posture classification determine that model includes that key point determines that submodel and posture classification determine submodel, key point
Determine the position of key point of the submodel for determining the head subject in head image, posture classification determines that submodel is used for really
The classification for determining the posture of the head subject in head image enriches the training method of model, helps to obtain based on training
Model improves the determination accuracy of the positioning accuracy of header key point and the posture classification of head subject.
Specific embodiment
The disclosure is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the disclosure can phase
Mutually combination.The disclosure is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can the method for training pattern using embodiment of the disclosure or the dress for training pattern
It sets, alternatively, the exemplary system architecture 100 of the embodiment of the method or apparatus for generating information.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105.
Network 104 between terminal device 101,102,103 and server 105 to provide the medium of communication link.Network 104 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102,103 and be interacted by network 104 with server 105, to receive or send out
Send data (such as training sample) etc..Various client applications can be installed on terminal device 101,102,103, such as regarded
Frequency playout software, the application of Domestic News class, image processing class application, web browser applications, the application of shopping class, searching class are answered
With, instant messaging tools, mailbox client, social platform software etc..
Terminal device 101,102,103 can be hardware, be also possible to software.For example, working as terminal device 101,102,103
When for hardware, it can be various electronic equipments, including but not limited to smart phone, tablet computer, E-book reader, MP3 is broadcast
Put device (Moving Picture Experts Group Audio Layer III, dynamic image expert's compression standard audio layer
Face 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert's compression standard sound
Frequency level 4) player, pocket computer on knee and desktop computer etc..When terminal device 101,102,103 is software
When, it may be mounted in above-mentioned cited electronic equipment.Multiple softwares or software module may be implemented into (such as mentioning in it
For the software or software module of Distributed Services), single software or software module also may be implemented into.Specific limit is not done herein
It is fixed.
Server 105 can be to provide the server of various services, such as be sent based on terminal device 101,102,103
Training sample, carry out the background server of model training.Background server can use machine learning algorithm, based on getting
Training sample carry out training pattern.As an example, server 105 can be cloud server, it is also possible to physical server.
It should be noted that server can be hardware, it is also possible to software.When server is hardware, may be implemented
At the distributed server cluster that multiple servers form, individual server also may be implemented into.It, can when server is software
To be implemented as multiple softwares or software module (such as providing the software of Distributed Services or software module), also may be implemented
At single software or software module.It is not specifically limited herein.
It should also be noted that, the method provided by embodiment of the disclosure for training pattern can be held by server
Row, can also be executed, can also be fitted to each other execution by server and terminal device by terminal device.Correspondingly, for training
The various pieces (such as each unit, subelement, module, submodule) that the device of model includes can all be set to server
In, it can also all be set in terminal device, can also be respectively arranged in server and terminal device.In addition, the disclosure
Embodiment provided by can be executed by server for the method that generates information, can also be executed by terminal device, may be used also
To be fitted to each other execution by server and terminal device.Various pieces that correspondingly, the device for generating information includes (such as
Each unit, subelement, module, submodule) it can all be set in server, it can also all be set to terminal device
In, it can also be respectively arranged in server and terminal device.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.For example, when the method for being used for training pattern runs on it
On electronic equipment during executing this method, when not needing to carry out data transmission with other electronic equipments, the system architecture
It can only include the method operation electronic equipment (such as server or terminal device) thereon for training pattern.
With continued reference to Fig. 2, the process of one embodiment of the method for training pattern according to the disclosure is shown
200.This is used for the method for training pattern, comprising the following steps:
Step 201, training sample set is obtained.
In the present embodiment, for the executing subject of the method for training pattern, (such as server shown in FIG. 1 or terminal are set
It is standby) training sample set can be obtained from other electronic equipments or locally by wired connection mode or radio connection.
Wherein, the training sample that training sample is concentrated includes the key point information and head of head image, head subject in head image
The posture classification information of head subject in portion's image.
Herein, above-mentioned head subject can be the image on head included in head image.The key of head subject
Point information can serve to indicate that at least one of following position in head image: eyes object, nose object, eyebrow object,
Mouth object, face mask point etc..Eyes object can be the image of eyes included in head image.Nose object can
To be the image of nose included in head image.Eyebrow object can be the image of eyebrow included in head image.
Mouth object can be the image of mouth included in head image.
The quantity of the key point of above-mentioned key point information instruction can be one, be also possible to multiple.In this regard, technical staff
It can be not construed as limiting with sets itself, the embodiment of the present application.As an example, the quantity of the key point of key point information instruction can be
28,64 or 128 etc..
Above-mentioned posture classification information can serve to indicate that the classification of the posture of the head subject in head image.
In some optional implementations of the present embodiment, head image is the appearance of face-image and head image
State classification information is used to indicate smile, laughs, cries, any one of anger.
It is appreciated that above-mentioned smile, laugh, cry, each single item in anger is considered as the posture of head subject a kind of
Classification.Herein, posture classification information can serve to indicate that facial expression.
In some cases, when the face object in face-image be in face face-image obtain direction (such as face
Angle where the sight and face-image of object obtain direction between straight line is greater than predetermined angle threshold value) when, posture classification letter
Breath can serve to indicate that facial expression.
It should be understood that when the face object in face-image is in and faces face-image acquisition direction, facial expression phase
For the classification of other postures, tend to more intuitively to reflect feature (such as the posture of the face object in face-image
Feature).
In some optional implementations of the present embodiment, the posture classification information of head image can be used for indicating
Bow, come back, side head any one of.
It is appreciated that it is above-mentioned bow, come back, side head in each single item be considered as a kind of head subject posture class
Not.Herein, posture classification information can serve to indicate that the classification of other postures in addition to facial expression is (such as above-mentioned low
Head comes back, side head).
In some cases, direction (such as face is obtained when the face object in face-image is in non-face-image of facing
Angle where the sight and face-image of portion's object obtain direction between straight line is less than or equal to predetermined angle threshold value) when, posture
Classification information can serve to indicate that other postures in addition to facial expression classification (such as it is above-mentioned bow, come back, side head).
It should be understood that when the face object in face-image be in it is non-face face-image obtain direction when, bow, lift
Head, side head tend to the feature for more intuitively reflecting the face object in face-image relative to the classification of other postures
(such as posture feature).
Step 202, using machine learning algorithm, the head image for including using the training sample that training sample is concentrated is as defeated
Enter data, using key point information corresponding with the head image of input and posture classification information as desired output data, training
It obtains key point and posture classification determines model.
In the present embodiment, above-mentioned executing subject can use machine learning algorithm, the instruction that will be got in step 201
The head image that training sample in white silk sample set includes is as input data, by key point corresponding with the head image of input
Information and posture classification information are as desired output data, and training obtains key point and posture classification determines model.Wherein, crucial
Point and posture classification determine that model includes that key point determines that submodel and posture classification determine submodel, and key point determines submodel
For determining the position of the key point of the head subject in head image, posture classification determines submodel for determining head image
In head subject posture classification.
In some optional implementations of the present embodiment, above-mentioned steps 202 may include following sub-step:
Sub-step one, obtain initial model, wherein initial model include the first submodel (such as convolutional neural networks) and
Second submodel (such as convolutional neural networks).
Sub-step two, using machine learning algorithm, the head image for including by the training sample that training sample is concentrated is distinguished
The input data of the first submodel and the second submodel that include as initial model, by pass corresponding with the head image of input
Desired output data of the key point information as the first submodel, using posture classification information corresponding with the head image of input as
The desired output data of second submodel obtain the first submodel and the second submodel of training completion, and training are completed
The first submodel and the second submodel be determined as training completion key point and posture classification determine model.Wherein, key point
And posture classification determines that the key point that model includes determines that submodel is the first submodel that above-mentioned training is completed.Key point and appearance
State classification determines that the posture classification that model includes determines that submodel is the second submodel that above-mentioned training is completed.First submodel
Desired output data are the key point information of training sample, and the desired output data of the second submodel are the posture class of training sample
Other information.
It is appreciated that the process of the first submodel and the second submodel that obtain training completion is to adjust initial model packet
The model parameter (parameters) of the first submodel and the second submodel that include makes initial model (i.e. the first submodel and
Two submodels) meet the process of predetermined trained termination condition.Wherein, model parameter may include weight, step-length, biasing
Deng.Above-mentioned trained termination condition can be the various conditions for being used to indicate and terminating training.For example, training termination condition may include
But be not limited at least one of following: the training time reaches preset duration, frequency of training reaches preset times, based on reality output number
It is less than preset threshold according to the functional value of the predetermined loss function obtained with desired output data.
It should be noted that technical staff can set the first submodule that above-mentioned initial model includes according to actual needs
The model structure of type and the second submodel, embodiment of the disclosure do not limit this.
In some optional implementations of the present embodiment, above-mentioned steps 202 also may include following sub-step:
Sub-step one obtains initial model.Wherein, initial model includes the first submodel, the second submodel and third
Model.
Sub-step two, using machine learning algorithm, the head image that includes using the training sample that training sample is concentrated as
The input data of first submodel obtains the reality output data of the first submodel, by the reality output data of the first submodel
As the input data of the second submodel and third submodel, the reality output of the second submodel and third submodel is respectively obtained
Data, reality output data and desired output data based on the second submodel and third submodel, adjust the ginseng of initial model
Number, obtains the initial model of training completion, and initial model that training is completed is determined as key point and posture classification and is determined
Model.Wherein, the desired output data of the second submodel are the key point information of training sample, the desired output of third submodel
Data are the posture classification information of training sample.
It is appreciated that the process for obtaining the initial model of training completion is to adjust the model parameter of initial model
(parameters), initial model (including the first submodel, the second submodel, third submodel) is made to meet predetermined instruction
Practice the process of termination condition.Wherein, model parameter may include weight, step-length, biasing etc..Above-mentioned trained termination condition can be
It is used to indicate the various conditions for terminating training.For example, it is at least one of following to train termination condition can include but is not limited to: training
Time reaches preset duration, frequency of training reaches preset times, it is pre- to be obtained based on reality output data and desired output data
First the functional value of determining loss function is less than preset threshold.
It should be noted that technical staff can according to actual needs, the above-mentioned initial model of sets itself include first
Model structure included by submodel, the second submodel and third submodel, embodiment of the disclosure do not limit this.
Sub-step three, the first submodel and the second submodel that the initial model by training completion includes are determined as key point
It determines submodel, and the first submodel and third submodel that the initial model that training is completed includes is determined as posture classification
Determine submodel.
It is appreciated that this optional implementation can determine submodel (i.e. second based on key point in the training process
Submodel) reality output data and desired output data and posture classification determine the reality of submodel (i.e. third submodel)
Border output data and desired output data determine that submodel and posture classification determine submodel common sparing to adjust key point
The model parameter of (i.e. the first submodel), thus, so that key point determines the output (i.e. key point information) and posture of submodel
Classification determines both output (i.e. posture classification information) of submodel respectively as the mutual reference of determination.Specifically, in training
And it is subsequent determine model using key point and posture classification during, above-mentioned executing subject can according to posture classification information come
Key point information is obtained, posture classification information can also be obtained according to key point information.Thus, it is possible to more accurate determination
Key point information and posture classification information out.
Optionally, above-mentioned executing subject can also execute step 202 in the following way:
Firstly, the head image for including using the training sample that training sample is concentrated is as initial using machine learning algorithm
The input data of model, using key point information corresponding with the head image of input as the desired output data of initial model,
Training obtains mid-module.
It is appreciated that the process for obtaining mid-module is to adjust the model parameter (parameters) of initial model, make
Initial model meets the process of predetermined condition.Wherein, model parameter may include weight, step-length, biasing etc..Above-mentioned item
Part, which can be to be used to indicate, has trained the various conditions for obtaining mid-module.For example, the condition can include but is not limited to it is following
At least one of: the training time reaches preset duration, frequency of training reaches preset times, is based on reality output data and desired output
The functional value for the predetermined loss function that data obtain is less than preset threshold.
Then, using machine learning algorithm, the head image for including using the training sample that training sample is concentrated is as centre
The input data of model, using posture classification information corresponding with the head image of input as the desired output number of mid-module
According to training obtains key point and posture classification determines model.
It is appreciated that obtaining key point and posture classification determines that the process of model is to adjust the model parameter of mid-module
(parameters), mid-module is made to meet the process of predetermined trained termination condition.Wherein, model parameter may include
Weight, step-length, biasing etc..Above-mentioned trained termination condition can be the various conditions for being used to indicate and terminating training.For example, training knot
Beam condition can include but is not limited at least one of following: the training time reaches preset duration, frequency of training reaches preset times,
The functional value of the predetermined loss function obtained based on reality output data and desired output data is less than preset threshold.
It should be noted that technical staff can according to actual needs, mould included by the above-mentioned initial model of sets itself
Type structure, embodiment of the disclosure do not limit this.
With continued reference to the signal that Fig. 3, Fig. 3 are according to the application scenarios of the method for training pattern of the present embodiment
Figure.In the application scenarios of Fig. 3, server 301 obtains training sample set 3011 first.Wherein, in training sample set 3011
Training sample includes the head subject in the key point information and head image of head image, head subject in head image
Posture classification information.Then, server 301 utilizes machine learning algorithm, includes by the training sample in training sample set 3011
Head image as input data, using key point information corresponding with the head image of input and posture classification information as the phase
Hope output data, training obtains key point and posture classification determines model 3012.Wherein, key point and posture classification determine model
3012 include that key point determines that submodel and posture classification determine submodel, and key point determines submodel for determining head image
In head subject key point position, posture classification determines submodel for determining the appearance of head subject in head image
The classification of state.
The method provided by the above embodiment of the disclosure, by obtaining training sample set, wherein the instruction that training sample is concentrated
Practice the appearance of the head subject in the key point information and head image that sample includes head image, head subject in head image
State classification information, then, using machine learning algorithm, the head image for including using the training sample that training sample is concentrated is as defeated
Enter data, using key point information corresponding with the head image of input and posture classification information as desired output data, training
It obtains key point and posture classification determines model, wherein key point and posture classification determine that model includes that key point determines submodule
Type and posture classification determine submodel, and key point determines key point of the submodel for determining the head subject in head image
Position, posture classification determine the classification of posture of the submodel for determining the head subject in head image, enrich model
Training method, the model for helping to obtain based on training improve the positioning accuracy of header key point and the appearance of head subject
The determination accuracy of state classification.
With further reference to Fig. 4, it illustrates the processes 400 of one embodiment of the method for generating information.This is used for
Generate the process 400 of the method for information, comprising the following steps:
Step 401, target cranial image is obtained.
In the present embodiment, (such as server shown in FIG. 1 or terminal are set the executing subject for generating the method for information
It is standby) target cranial figure can be obtained from other electronic equipments or locally by wired connection mode or radio connection
Picture.
Wherein, above-mentioned target cranial image can be the head figure of the key point information of head subject therein to be determined
Picture.Above-mentioned head subject can be the image on head included in head image.The key point information of head subject can be used
Position at least one of below instruction in head image: eyes object, nose object, eyebrow object, mouth object, face
Profile point etc..Eyes object can be the image of eyes included in head image.Nose object can be head image
Included in nose image.Eyebrow object can be the image of eyebrow included in head image.Mouth object can be with
It is the image of mouth included in head image.
The quantity of the key point of above-mentioned key point information instruction can be one, be also possible to multiple.In this regard, technical staff
It can be not construed as limiting with sets itself, the embodiment of the present application.As an example, the quantity of the key point of key point information instruction can be
28,64 or 128 etc..
Step 402, target cranial image is input to trained in advance key point and posture classification and determines what model included
Key point determines submodel, generates the key point information of the head subject in target cranial image.
In the present embodiment, target cranial image can be input to trained in advance key point and appearance by above-mentioned executing subject
State classification determines that the key point that model includes determines submodel, generates the key point letter of the head subject in target cranial image
Breath.Wherein, key point and posture classification determine that model is by such as any embodiment in the above-mentioned method for training pattern
Method training obtains.
In some optional implementations of the present embodiment, target cranial image can be input to by above-mentioned executing subject
Trained key point determines submodel in advance, and the posture classification without being input to trained in advance determines submodel, to generate mesh
Mark the key point information of the head subject in head image.
In some optional implementations of the present embodiment, above-mentioned executing subject can also be executed using following steps
The step 402:
Target cranial image is input to the pass that in advance trained key point and posture classification determine that model includes by step 1
Key point determines that submodel and posture classification determine submodel, obtain the head subject in target cranial image belong to it is predetermined
In the probability and target cranial image of the posture classification of each posture classification information instruction in posture classification information set
The key point information of head subject.
It is appreciated that since posture classification determines that submodel is disaggregated model, thus, it is generally the case that it is needed to defeated
Enter data be normalized index (softmax) processing, with obtain the head subject in target cranial image belong to it is predetermined
Posture classification information set in each posture classification information instruction posture classification probability.It is appreciated that posture classification
The output data for determining the preceding layer for the full articulamentum that submodel includes is usually above-mentioned probability.Wherein, what is exported is each general
Posture classification corresponding to maximum probability in rate is the posture classification of the head subject in the head image of input.
Step 2 is based on obtained probability and key point information, determines head subject in target cranial image most
Whole key point information.Wherein, above-mentioned final key point information can serve to indicate that in head image finally determine, input
The position of the key point of head subject.
In some optional implementations of the present embodiment, above-mentioned executing subject can be executed using following steps
State step 2:
Firstly, determining whether maximum probability is greater than or equal to predetermined probability threshold in obtained each probability
Value.
Then, it is greater than or equal to probability threshold value in response to maximum probability, obtained key point information is determined as mesh
Mark the final key point information of the head subject in head image.
Optionally, if maximum probability is less than above-mentioned probability threshold value, above-mentioned executing subject can will be obtained
Key point information is determined as the final key point information of the head subject in target cranial image, can also will use existing head
The key point information that portion's key point method of determination obtains is determined as the final key point letter of the head subject in target cranial image
Breath.
In some optional implementations of the present embodiment, above-mentioned executing subject can also be executed using following steps
Above-mentioned steps two:
Determine obtained maximum probability and second largest probability (in i.e. obtained probability, except maximum probability it
Maximum probability in other outer probability) difference, if the difference be greater than or equal to predetermined difference threshold,
Obtained key point information can be determined as the final key of the head subject in target cranial image by above-mentioned executing subject
Point information;If the difference is less than above-mentioned difference threshold, above-mentioned executing subject can be true by obtained key point information
It is set to the final key point information of the head subject in target cranial image, alternatively, will determine using existing header key point
The key point information that mode obtains is determined as the final key point information of the head subject in target cranial image.
It is appreciated that maximum probability be greater than or equal to probability threshold value in the case where, can usually determine key point and
Posture classification determines that the posture classification information of model output is relatively accurate, also, since determining for key point information relies on
In posture classification information, thus, key point information obtained in the case is also relatively accurate.Therefore, this is optional
Implementation improves the accuracy for determining final key point information.
It should be noted that the embodiment of the present application can also include reality corresponding with Fig. 2 in addition to documented content above
The same or similar feature of example, effect are applied, details are not described herein.
Figure 4, it is seen that the method for training pattern compared with the corresponding embodiment of Fig. 2, in the present embodiment
Process 400 highlight submodel, the pass of the head subject in Lai Shengcheng head image determined using the obtained key point of training
The step of key point information.The positioning accuracy of header key point can be improved in the scheme of the present embodiment description as a result,.
With further reference to Fig. 5, as the realization to method shown in above-mentioned Fig. 2, present disclose provides one kind for training mould
One embodiment of the device of type, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, except following documented special
Sign is outer, which can also include feature identical or corresponding with embodiment of the method shown in Fig. 2, and generates and scheme
Embodiment of the method shown in 2 is identical or corresponding effect.The device specifically can be applied in various electronic equipments.
As shown in figure 5, the device 500 for training pattern of the present embodiment includes: first acquisition unit 501, it is configured
At obtaining training sample set, wherein the training sample that training sample is concentrated includes head image, the head subject in head image
Key point information and head image in head subject posture classification information;Training unit 502 is configured to utilize machine
Learning algorithm, the head image for including using the training sample that training sample is concentrated is as input data, by the head figure with input
As corresponding key point information and posture classification information are as desired output data, training obtains key point and posture classification determines
Model, wherein key point and posture classification determine that model includes that key point determines that submodel and posture classification determine submodel, close
Key point determines the position of key point of the submodel for determining the head subject in head image, and posture classification determines that submodel is used
In the classification for the posture for determining the head subject in head image.
In the present embodiment, for the available training sample of the first acquisition unit of the device of training pattern 500 501
Collection.Wherein, the training sample that training sample is concentrated include head image, head subject in head image key point information and
The posture classification information of head subject in head image.Herein, above-mentioned head subject can be included in head image
Head image.The quantity of the key point of above-mentioned key point information instruction can be one, be also possible to multiple.In this regard, skill
Art personnel can be not construed as limiting with sets itself, the embodiment of the present application.As an example, the quantity of the key point of key point information instruction
It can be 28,64 or 128 etc..Above-mentioned posture classification information can serve to indicate that the class of the posture of the head subject in head image
Not.
In the present embodiment, above-mentioned training unit 502 can use machine learning algorithm, and first acquisition unit 501 is obtained
The head image that the training sample that the training sample got is concentrated includes, will be corresponding with the head image of input as input data
Key point information and posture classification information as desired output data, training obtains key point and posture classification determines model.
Wherein, key point and posture classification determine that model includes that key point determines that submodel and posture classification determine submodel, key point
Determine the position of key point of the submodel for determining the head subject in head image, posture classification determines that submodel is used for really
Determine the classification of the posture of the head subject in head image.
In some optional implementations of the present embodiment, training unit 502 includes: to obtain module (not shown)
It is configured to obtain initial model, wherein initial model includes the first submodel, the second submodel and third submodel.Training
Module (not shown) is configured to the head figure for using machine learning algorithm, including by the training sample that training sample is concentrated
As the input data as the first submodel, the reality output data of the first submodel are obtained, the reality of the first submodel is defeated
Input data of the data as the second submodel and third submodel out respectively obtains the reality of the second submodel and third submodel
Border output data, reality output data and desired output data based on the second submodel and third submodel adjust introductory die
The parameter of type obtains the initial model of training completion, wherein the desired output data of the second submodel are the key of training sample
Point information, the desired output data of third submodel are the posture classification information of training sample.Determining module (not shown)
It is configured to the first submodel for training the initial model of completion to include and the second submodel being determined as key point to determine submodule
Type, and the first submodel and third submodel that the initial model that training is completed includes are determined as posture classification and determine submodule
Type.
In some optional implementations of the present embodiment, head image is the appearance of face-image and head image
State classification information is used to indicate smile, laughs, cries, any one of anger.
In some optional implementations of the present embodiment, the posture classification information of head image be used to indicate bow,
Any one of new line, side head.
Above-described embodiment of the disclosure provides the device for being used for training pattern, is obtained and is trained by first acquisition unit 501
Sample set, wherein the training sample that training sample is concentrated includes the key point letter of head image, head subject in head image
The posture classification information of head subject in breath and head image, then, training unit 502 utilize machine learning algorithm, will instruct
The head image that training sample in white silk sample set includes is as input data, by key point corresponding with the head image of input
As desired output data, training obtains key point and posture classification determines model, wherein crucial for information and posture classification information
Point and posture classification determine that model includes that key point determines that submodel and posture classification determine submodel, and key point determines submodel
For determining the position of the key point of the head subject in head image, posture classification determines submodel for determining head image
In head subject posture classification, enrich the training method of model, help to improve head based on the obtained model of training
The determination accuracy of the posture classification of the positioning accuracy and head subject of portion's key point.
With continued reference to FIG. 6, present disclose provides one kind for generating letter as the realization to method shown in above-mentioned Fig. 4
One embodiment of the device of breath, the Installation practice is corresponding with embodiment of the method shown in Fig. 4, except following documented special
Sign is outer, which can also include feature identical or corresponding with embodiment of the method shown in Fig. 4, and generates and scheme
Embodiment of the method shown in 4 is identical or corresponding effect.The device specifically can be applied in various electronic equipments.
As shown in fig. 6, the present embodiment includes: second acquisition unit 601 for generating the device 600 of information, it is configured
At acquisition target cranial image;Input unit 602, be configured to for target cranial image being input in advance trained key point and
Posture classification determines that the key point that model includes determines submodel, generates the key point letter of the head subject in target cranial image
Breath, wherein key point and posture classification determine that model is by such as any embodiment in the above-mentioned method for training pattern
Method training obtains.
In the present embodiment, for generating the available target cranial figure of second acquisition unit 601 of the device 600 of information
Picture.Above-mentioned target cranial image can be the head image of the key point information of head subject therein to be determined.Above-mentioned head
Object can be the image on head included in head image.The quantity of the key point of above-mentioned key point information instruction can be
One, it is also possible to multiple.In this regard, technical staff can be not construed as limiting with sets itself, the embodiment of the present application.As an example, closing
The quantity of the key point of key point information instruction can be 28,64 or 128 etc..
In the present embodiment, the target cranial image that above-mentioned input unit 602 can get second acquisition unit 601
It is input to the key point that trained in advance key point and posture classification determine that model includes and determines submodel, generate target cranial figure
The key point information of head subject as in.Wherein, key point and posture classification determine that model is by such as above-mentioned for training
The method training of any embodiment obtains in the method for model.
In some optional implementations of the present embodiment, input unit 602 includes: input module (not shown)
It is true to be configured to for target cranial image being input to the key point that trained in advance key point and posture classification determine that model includes
Stator model and posture classification determine submodel, obtain the head subject in target cranial image and belong to predetermined posture class
The probability of the posture classification of each posture classification information instruction in other information aggregate and the head pair in target cranial image
The key point information of elephant.Determining module (not shown) is configured to determine based on obtained probability and key point information
The final key point information of head subject in target cranial image.
In some optional implementations of the present embodiment, determining module includes: that the first determining submodule (does not show in figure
It is configured to determine whether maximum probability in obtained each probability is greater than or equal to predetermined probability threshold value out).
Second determines that submodule (not shown) is configured in response to maximum probability and is greater than or equal to probability threshold value, will be acquired
Key point information be determined as the final key point information of the head subject in target cranial image.
The device provided by the above embodiment for being used to generate information of the disclosure, passes through second acquisition unit 601 and obtains mesh
Head image is marked, then, target cranial image is input to trained in advance key point and posture classification and determined by input unit 602
The key point that model includes determines submodel, generates the key point information of the head subject in target cranial image, wherein crucial
Point and posture classification determine that model is obtained by the method training of any embodiment in such as above-mentioned method for training pattern
, improve the positioning accuracy of header key point.
Below with reference to Fig. 7, it illustrates the electronic equipment that is suitable for being used to realize embodiment of the disclosure, (example is as shown in figure 1
Server or terminal device) 700 structural schematic diagram.Terminal device in embodiment of the disclosure can include but is not limited to all
As mobile phone, laptop, digit broadcasting receiver, PDA (personal digital assistant), PAD (tablet computer), PMP are (portable
Formula multimedia player), the mobile terminal and such as number TV, desk-top meter of car-mounted terminal (such as vehicle mounted guidance terminal) etc.
The fixed terminal of calculation machine etc..Terminal device/server shown in Fig. 7 is only an example, should not be to the implementation of the disclosure
The function and use scope of example bring any restrictions.
As shown in fig. 7, electronic equipment 700 may include processing unit (such as central processing unit, graphics processor etc.)
701, random access can be loaded into according to the program being stored in read-only memory (ROM) 702 or from storage device 708
Program in memory (RAM) 703 and execute various movements appropriate and processing.In RAM 703, it is also stored with electronic equipment
Various programs and data needed for 700 operations.Processing unit 701, ROM 702 and RAM 703 pass through the phase each other of bus 704
Even.Input/output (I/O) interface 705 is also connected to bus 704.
In general, following device can connect to I/O interface 705: including such as touch screen, touch tablet, keyboard, mouse, taking the photograph
As the input unit 706 of head, microphone, accelerometer, gyroscope etc.;Including such as liquid crystal display (LCD), loudspeaker, vibration
The output device 707 of dynamic device etc.;Storage device 708 including such as tape, hard disk etc.;And communication device 709.Communication device
709, which can permit electronic equipment 700, is wirelessly or non-wirelessly communicated with other equipment to exchange data.Although Fig. 7 shows tool
There is the electronic equipment 700 of various devices, it should be understood that being not required for implementing or having all devices shown.It can be with
Alternatively implement or have more or fewer devices.Each box shown in Fig. 7 can represent a device, can also root
According to needing to represent multiple devices.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communication device 709, or from storage device 708
It is mounted, or is mounted from ROM 702.When the computer program is executed by processing unit 701, the implementation of the disclosure is executed
The above-mentioned function of being limited in the method for example.
It is situated between it should be noted that computer-readable medium described in embodiment of the disclosure can be computer-readable signal
Matter or computer readable storage medium either the two any combination.Computer readable storage medium for example can be with
System, device or the device of --- but being not limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or it is any more than
Combination.The more specific example of computer readable storage medium can include but is not limited to: have one or more conducting wires
Electrical connection, portable computer diskette, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type can be compiled
Journey read-only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device,
Magnetic memory device or above-mentioned any appropriate combination.In embodiment of the disclosure, computer readable storage medium can be with
To be any include or the tangible medium of storage program, the program can be commanded execution system, device or device use or
It is in connection.And in embodiment of the disclosure, computer-readable signal media may include in a base band or conduct
The data-signal that carrier wave a part is propagated, wherein carrying computer-readable program code.The data-signal of this propagation can
To take various forms, including but not limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable letter
Number medium can also be any computer-readable medium other than computer readable storage medium, the computer-readable signal media
It can send, propagate or transmit for by the use of instruction execution system, device or device or journey in connection
Sequence.The program code for including on computer-readable medium can transmit with any suitable medium, including but not limited to: electric wire,
Optical cable, RF (radio frequency) etc. or above-mentioned any appropriate combination.
Above-mentioned computer-readable medium can be included in above-mentioned electronic equipment;It is also possible to individualism, and not
It is fitted into the electronic equipment.Above-mentioned computer-readable medium carries one or more program, when said one or more
When a program is executed by the electronic equipment, so that the electronic equipment: obtaining training sample set, wherein the instruction that training sample is concentrated
Practice the appearance of the head subject in the key point information and head image that sample includes head image, head subject in head image
State classification information;Using machine learning algorithm, the head image for including using the training sample that training sample is concentrated is as input number
According to using key point information corresponding with the head image of input and posture classification information as desired output data, training is obtained
Key point and posture classification determine model, wherein key point and posture classification determine model include key point determine submodel and
Posture classification determines submodel, and key point determines the position of key point of the submodel for determining the head subject in head image
It sets, posture classification determines the classification of posture of the submodel for determining the head subject in head image.Alternatively, making the electronics
Equipment: target cranial image is obtained;Target cranial image is input to trained in advance key point and posture classification and determines model
Including key point determine submodel, generate the key point information of the head subject in target cranial image, wherein key point and
Posture classification determines that model is by as the method training of any embodiment in the above-mentioned method for training pattern obtains.
The behaviour for executing embodiment of the disclosure can be write with one or more programming languages or combinations thereof
The computer program code of work, described program design language include object oriented program language-such as Java,
Smalltalk, C++ further include conventional procedural programming language-such as " C " language or similar program design language
Speech.Program code can be executed fully on the user computer, partly be executed on the user computer, as an independence
Software package execute, part on the user computer part execute on the remote computer or completely in remote computer or
It is executed on server.In situations involving remote computers, remote computer can pass through the network of any kind --- packet
It includes local area network (LAN) or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as
It is connected using ISP by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the disclosure, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in unit involved in embodiment of the disclosure can be realized by way of software, can also be passed through
The mode of hardware is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor
Including first acquisition unit and training unit, alternatively, a kind of processor includes second acquisition unit and input unit.Wherein, this
The title of a little units does not constitute the restriction to the unit itself under certain conditions, for example, first acquisition unit can also quilt
It is described as " obtaining the unit of training sample set ".
Above description is only the preferred embodiment of the disclosure and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that invention scope involved in the disclosure, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above and (but being not limited to) disclosed in the disclosure have it is similar
The technical characteristic of function is replaced mutually and the technical solution that is formed.