IP Library Granted Patent US 11,335,124
Granted Patent B2
US 11,335,124 · App. 16/927,812 · Granted May 17, 2022

Face recognition method and apparatus, classification model training method and apparatus, storage medium and computer device

Inventors: Anping Li (Shenzhen, CN); Shaoxin Li (Shenzhen, CN); Chao Chen (Shenzhen, CN); Pengcheng Shen (Shenzhen, CN); Jilin Li (Shenzhen, CN)
Assignee: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
G06V40/172G06K9/6262G06V40/168
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,335,124
App. No.
16/927,812
Granted
May 17, 2022
Kind
B2
Abstract

This application relates to a face recognition method performed at a computer server. After obtaining a to-be-recognized face image, the server inputs the to-be-recognized face image into a classification model. The server then obtains a recognition result of the to-be-recognized face image through the classification model. The classification model is obtained by inputting a training sample marked with class information into the classification model, outputting an output result of the training sample, calculating a loss of the classification model in a training process according to the output result, the class information and model parameters of the classification model, and performing back propagation optimization on the classification model according to the loss.

Claims (99)

1. A face recognition method, applied to a server having one or more processors and memory storing a plurality of computer programs to be executed by the one or more processors, the method comprising:

obtaining a to-be-recognized face image;

inputting the face image into a classification model; and

obtaining a recognition result of the to-be-recognized face image through the classification model,

wherein the classification model is obtained by:

inputting a training sample marked with class information into the classification model,

outputting an output result of the training sample,

calculating a loss of the classification model in a training process according to the output result, the class information and model parameters of the classification model, wherein the classification model comprises a hypersphere feature projection space, the model parameters of the classification model comprise (i) a space radius corresponding to the hypersphere feature projection space and (ii) a margin value between the training sample and a class in the classification model, the calculating the loss of the classification model further comprising:

calculating a hypersphere radius loss of the space radius corresponding to the hypersphere feature projection space;

calculating a margin loss according to the margin value and the output result of the training sample;

obtaining the loss of the classification model according to the hypersphere radius loss and the margin loss; and

performing back propagation optimization on the classification model according to the loss, further comprising adjusting the model parameters of the classification model according to the hypersphere radius loss and the margin loss.

2. The method according to claim 1 , wherein

the hypersphere radius loss is used for representing a loss of the space radius corresponding to the hypersphere feature projection space; and

the margin loss is used for representing an incidental loss of the classification model in a recognition process.

3. The method according to claim 2 , wherein,

before the inputting a training sample marked with class information into a classification model, the method comprises:

obtaining a loss calculated in a last training of the classification model, and calculating a change amount of the classification model; and

calculating, according to the change amount of the classification model and the space radius applied in the last training, the space radius of the hypersphere feature projection space applied in the current training; and

the calculating the hypersphere radius loss of the space radius corresponding to the hypersphere feature projection space further comprises:

calculating the hypersphere radius loss according to the space radius of the hypersphere feature projection space applied in the current training.

4. The method according to claim 2 , wherein the calculating the margin loss according to the margin value and the output result of the training sample further comprises:

determining, according to the output result of the training sample, a cosine similarity between the training sample and a corresponding class of the class information;

calculating, according to the cosine similarity, the margin value between the training sample and the corresponding class; and

calculating the margin loss according to the margin value and the output result.

5. The method according to claim 4 , wherein the output result comprises a projection feature of the training sample in the hypersphere feature projection space; and

the calculating the margin loss according to the margin value and the output result comprises:

calculating the margin loss according to the projection feature, the corresponding class of the training sample, the margin value, and the cosine similarity.

6. The method according to claim 5 , wherein the method comprises:

projecting, according to the space radius of the hypersphere feature projection space applied in the current training, a multi-dimensional feature vector of the training sample into the hypersphere feature projection space, to obtain the projection feature.

7. The method according to claim 1 , wherein the obtaining the loss of the classification model according to the hypersphere radius loss and the margin loss comprises:

determining a first product of the hypersphere radius loss and a first weight, and a second product of the margin loss and a second weight; and

determining a sum of the first product and the second product as the loss of the classification model.

8. The method according to claim 6 , wherein the projecting a multi-dimensional feature vector of the training sample into the hypersphere feature projection space, to obtain the projection feature further comprises:

performing L 2 regularization on the multi-dimensional feature vector, to obtain a regularized multi-dimensional feature vector; and

projecting the regularized multi-dimensional feature vector into the hypersphere feature projection space, to obtain the projection feature.

9. The method according to claim 1 , wherein the classification model comprises a fully connected layer;

before the inputting a training sample marked with class information into a classification model and outputting an output result of the training sample, the method further comprises:

performing L 2 regularization on parameters of the fully connected layer, to obtain regularized parameters of the fully connected layer; and

applying the regularized parameters of the fully connected layer to the fully connected layer.

10. A server, comprising one or more processors and memory, the memory storing a plurality of computer programs, and the computer programs, when executed by the one or more processors, causing the server to perform a plurality of operations including:

obtaining a to-be-recognized face image;

inputting the face image into a classification model; and

obtaining a recognition result of the to-be-recognized face image through the classification model,

wherein the classification model is obtained by:

inputting a training sample marked with class information into the classification model,

outputting an output result of the training sample,

calculating a loss of the classification model in a training process according to the output result, the class information and model parameters of the classification model, wherein the classification model comprises a hypersphere feature projection space, the model parameters of the classification model comprise (i) a space radius corresponding to the hypersphere feature projection space and (ii) a margin value between the training sample and a class in the classification model, the calculating the loss of the classification model further comprising:

calculating a hypersphere radius loss of the space radius corresponding to the hypersphere feature projection space;

calculating a margin loss according to the margin value and the output result of the training sample;

obtaining the loss of the classification model according to the hypersphere radius loss and the margin loss; and

performing back propagation optimization on the classification model according to the loss, further comprising adjusting the model parameters of the classification model according to the hypersphere radius loss and the margin loss.

11. The server according to claim 10 , wherein

the hypersphere radius loss is used for representing a loss of the space radius corresponding to the hypersphere feature projection space; and

the margin loss is used for representing an incidental loss of the classification model in a recognition process.

12. The server according to claim 11 , wherein the plurality of operations further comprise:

before inputting a training sample marked with class information into a classification model;

obtaining a loss calculated in a last training of the classification model, and calculating a change amount of the classification model; and

calculating, according to the change amount of the classification model and the space radius applied in the last training, the space radius of the hypersphere feature projection space applied in the current training; and

the calculating the hypersphere radius loss of the space radius corresponding to the hypersphere feature projection space further comprises;

calculating the hypersphere radius loss according to the space radius of the hypersphere feature projection space applied in the current training.

13. The server according to claim 11 , wherein the calculating the margin loss according to the margin value and the output result of the training sample further comprises:

determining, according to the output result of the training sample, a cosine similarity between the training sample and a corresponding class of the class information;

calculating, according to the cosine similarity, the margin value between the training sample and the corresponding class; and

calculating the margin loss according to the margin value and the output result.

14. The server according to claim 13 , wherein the output result comprises a projection feature of the training sample in the hypersphere feature projection space; and

the calculating the margin loss according to the margin value and the output result comprises:

calculating the margin loss according to the projection feature, the corresponding class of the training sample, the margin value, and the cosine similarity.

15. The server according to claim 14 , wherein the plurality of operations further comprise:

projecting, according to the space radius of the hypersphere feature projection space applied in the current training, a multi-dimensional feature vector of the training sample into the hypersphere feature projection space, to obtain the projection feature.

16. The server according to claim 10 , wherein the obtaining the loss of the classification model according to the hypersphere radius loss and the margin loss comprises:

determining a first product of the hypersphere radius loss and a first weight, and a second product of the margin loss and a second weight; and

determining a sum of the first product and the second product as the loss of the classification model.

17. The server according to claim 15 , wherein the projecting a multi-dimensional feature vector of the training sample into the hypersphere feature projection space, to obtain the projection feature further comprises:

performing L 2 regularization on the multi-dimensional feature vector, to obtain a regularized multi-dimensional feature vector; and

projecting the regularized multi-dimensional feature vector into the hypersphere feature projection space, to obtain the projection feature.

18. A non-transitory computer-readable storage medium, storing a plurality of computer programs, the computer programs, when executed by one or more processors of a server, causing the server to perform a plurality of operations including:

obtaining a to-be-recognized face image;

inputting the face image into a classification model; and

obtaining a recognition result of the to-be-recognized face image through the classification model,

wherein the classification model is obtained by:

inputting a training sample marked with class information into the classification model,

outputting an output result of the training sample,

calculating a loss of the classification model in a training process according to the output result, the class information and model parameters of the classification model, wherein the classification model comprises a hypersphere feature projection space, the model parameters of the classification model comprise (i) a space radius corresponding to the hypersphere feature projection space and (ii) a margin value between the training sample and a class in the classification model, the calculating the loss of the classification model further comprising:

calculating a hypersphere radius loss of the space radius corresponding to the hypersphere feature projection space;

calculating a margin loss according to the margin value and the output result of the training sample;

obtaining the loss of the classification model according to the hypersphere radius loss and the margin loss; and

performing back propagation optimization on the classification model according to the loss, further comprising adjusting the model parameters of the classification model according to the hypersphere radius loss and the margin loss.

19. The non-transitory computer-readable storage medium according to claim 18 , wherein the hypersphere radius loss is used for representing a loss of the space radius corresponding to the hypersphere feature projection space; and the margin loss is used for representing an incidental loss of the classification model in a recognition process.

20. The non-transitory computer-readable storage medium according to claim 19 , wherein the plurality of operations further comprise:

before inputting a training sample marked with class information into a classification model;

obtaining a loss calculated in a last training of the classification model, and calculating a change amount of the classification model; and

calculating, according to the change amount of the classification model and the space radius applied in the last training, the space radius of the hypersphere feature projection space applied in the current training; and

the calculating the hypersphere radius loss of the space radius corresponding to the hypersphere feature projection space further comprises;

calculating the hypersphere radius loss according to the space radius of the hypersphere feature projection space applied in the current training; and

the calculating the margin loss according to the margin value and the output result of the training sample further comprises;

determining, according to the output result of the training sample, a cosine similarity between the training sample and a corresponding class of the class information;

calculating, according to the cosine similarity, the margin value between the training sample and the corresponding class; and

calculating the margin loss according to the margin value and the output result.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 9, 2020
From: LI, ANPING; LI, SHAOXIN; CHEN, CHAO; SHEN, PENGCHENG; LI, JILIN
To: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Reel/Frame 054019/0326 →
Priority Claims (1)
CN 201810566938.8 · Jun 5, 2018 · national
Continuity (2)
Continuation PCTCN2019085462 · May 5, 2019
Related Publication 20200342214A1 · Oct 29, 2020