IP Library › Granted Patent US 11,710,335
Granted Patent B2
US 11,710,335 · App. 17/504,682 · Granted Jul 25, 2023

Human body attribute recognition method and apparatus, electronic device, and storage medium

Inventors: Keke He (Shenzhen, CN); Jing Liu (Shenzhen, CN); Yanhao Ge (Shenzhen, CN); Chengjie Wang (Shenzhen, CN); Jilin Li (Shenzhen, CN)
Assignee: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
G06V40/103G06F18/217G06F18/25G06V10/40G06V10/98
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,710,335
App. No.
17/504,682
Granted
Jul 25, 2023
Kind
B2
Abstract

The present disclosure describes human body attribute recognition methods and apparatus, electronic devices, and a storage medium. The method includes acquiring a sample image containing a plurality of to-be-detected areas being labeled with true values of human body attributes; generating, through a recognition model, a heat map of the sample image and heat maps of the to-be-detected areas to obtain a global heat map and local heat maps; fusing the global and the local heat maps to obtain a fused image, and performing human body attribute recognition on the fused image to obtain predicted values; determining a focus area of each type of human body attribute according to the global and the local heat maps; correcting the recognition model by using the focus area, the true values, and the predicted values; and performing, based on the corrected recognition model, human body attribute recognition on a to-be-recognized image.

Claims (111)

1. A method for recognizing human body attributes, the method comprising:

acquiring, by a device comprising a memory storing instructions and a memory in communication with the memory, a sample image of human body, the sample image containing a plurality of to-be-detected areas, the to-be-detected areas being labeled with true values of human body attributes;

generating, by the device through a recognition model, a heat map of the sample image and heat maps of the to-be-detected areas to obtain a global heat map and local heat maps corresponding to the sample image;

fusing, by the device, the global heat map and the local heat maps to obtain a fused image, and performing human body attribute recognition on the fused image to obtain predicted values of human body attribute of the sample image;

determining, by the device, a focus area of each type of human body attribute according to the global heat map and the local heat maps;

correcting, by the device, the recognition model according to a target loss function based on the focus area, the true values of human body attributes, and the predicted values of human body attributes; and

performing, by the device based on the corrected recognition model, human body attribute recognition on a to-be-recognized image.

2. The method according to claim 1 , wherein the determining the focus area of each type of human body attribute according to the global heat map and the local heat maps comprises:

generating a class activation map corresponding to each type of human body attribute according to the global heat map and the local heat maps; and

correcting the class activation map, and determining the focus area of each type of human body attribute based on a result of the correction.

3. The method according to claim 2 , wherein the correcting the class activation map, and determining the focus area of each type of human body attribute based on the result of the correction comprises:

mirroring the global heat map and the local heat maps respectively to obtain a mirrored global heat map and mirrored local heat maps;

generating a mirrored class activation map of each type of human body attribute based on the mirrored global heat map and the mirrored local heat maps; and

determining the focus area of each type of human body attribute according to the class activation map and the mirrored class activation map.

4. The method according to claim 3 , wherein the determining the focus area of each type of human body attribute according to the class activation map and the mirrored class activation map comprises:

obtaining a plurality of first feature points corresponding to the class activation map and a plurality of second feature points corresponding to the mirrored class activation map, each first feature point corresponding to a second feature point;

extracting heat values of the first feature points to obtain first heat values corresponding to the first feature points;

extracting heat values of the second feature points to obtain second heat values corresponding to the second feature points; and

constructing the focus area of each type of human body attribute based on the first heat values and the second heat values.

5. The method according to claim 4 , wherein the constructing the focus area of each type of human body attribute based on the first heat values and the second heat values comprises:

determining whether each first heat value meets a preset condition; and

in response to determining that a first feature point meets the preset condition:

selecting the first feature point that meets the preset condition from the plurality of first feature points to obtain a first reference point;

constructing a first reference area of a human body attribute corresponding to the first reference point;

acquiring a second feature point corresponding to the first reference point to obtain a second reference point;

constructing a second reference area of a human body attribute corresponding to the second reference point;

mirroring the second reference area to obtain a mirrored second reference area; and

adjusting a size of the first reference area by using the mirrored second reference area to obtain the focus area of the human body attribute.

6. The method according to claim 2 , wherein the generating the class activation map corresponding to each type of human body attribute according to the global heat map and the local heat maps comprises:

vectorizing the global heat map to obtain a feature vector corresponding to the global heat map;

determining, based on distribution of the local heat maps in the global heat map, human body attributes focused by the local heat maps;

generating weight matrixes corresponding to the local heat maps according to the human body attributes focused by the local heat maps; and

calculating products of the feature vector and the weight matrixes respectively to obtain the class activation map corresponding to each type of human body attribute.

7. The method according to claim 1 , wherein the correcting the recognition model according to the target loss function based on the focus area, the true values of human body attributes, and the human body attribute predicted values comprises:

calculating a first loss function of the recognition model based on the true values of human body attributes and predicted values of human body attributes;

acquiring a second loss function corresponding to the focus area through the recognition model;

superimposing the first loss function and the second loss function to obtain the target loss function of the recognition model; and

correcting the recognition model according to the target loss function.

8. An apparatus for recognizing human body attributes, the apparatus comprising:

a memory storing instructions; and

a processor in communication with the memory, wherein, when the processor executes the instructions, the processor is configured to cause the apparatus to perform:

acquiring a sample image of human body, the sample image containing a plurality of to-be-detected areas, the to-be-detected areas being labeled with true values of human body attributes,

generating, through a recognition model, a heat map of the sample image and heat maps of the to-be-detected areas to obtain a global heat map and local heat maps corresponding to the sample image,

fusing the global heat map and the local heat maps to obtain a fused image, and performing human body attribute recognition on the fused image to obtain predicted values of human body attribute of the sample image,

determining a focus area of each type of human body attribute according to the global heat map and the local heat maps,

correcting the recognition model according to a target loss function based on the focus area, the true values of human body attributes, and the predicted values of human body attributes, and

performing, based on the corrected recognition model, human body attribute recognition on a to-be-recognized image.

9. The apparatus according to claim 8 , wherein, when the processor is configured to cause the apparatus to perform determining the focus area of each type of human body attribute according to the global heat map and the local heat maps, the processor is configured to cause the apparatus to perform:

generating a class activation map corresponding to each type of human body attribute according to the global heat map and the local heat maps; and

correcting the class activation map, and determining the focus area of each type of human body attribute based on a result of the correction.

10. The apparatus according to claim 9 , wherein, when the processor is configured to cause the apparatus to perform correcting the class activation map, and determining the focus area of each type of human body attribute based on the result of the correction, the processor is configured to cause the apparatus to perform:

mirroring the global heat map and the local heat maps respectively to obtain a mirrored global heat map and mirrored local heat maps;

generating a mirrored class activation map of each type of human body attribute based on the mirrored global heat map and the mirrored local heat maps; and

determining the focus area of each type of human body attribute according to the class activation map and the mirrored class activation map.

11. The apparatus according to claim 10 , wherein, when the processor is configured to cause the apparatus to perform determining the focus area of each type of human body attribute according to the class activation map and the mirrored class activation map, the processor is configured to cause the apparatus to perform:

obtaining a plurality of first feature points corresponding to the class activation map and a plurality of second feature points corresponding to the mirrored class activation map, each first feature point corresponding to a second feature point;

extracting heat values of the first feature points to obtain first heat values corresponding to the first feature points;

extracting heat values of the second feature points to obtain second heat values corresponding to the second feature points; and

constructing the focus area of each type of human body attribute based on the first heat values and the second heat values.

12. The apparatus according to claim 11 , wherein, when the processor is configured to cause the apparatus to perform constructing the focus area of each type of human body attribute based on the first heat values and the second heat values, the processor is configured to cause the apparatus to perform:

determining whether each first heat value meets a preset condition; and

in response to determining that a first feature point meets the preset condition:

selecting the first feature point that meets the preset condition from the plurality of first feature points to obtain a first reference point;

constructing a first reference area of a human body attribute corresponding to the first reference point;

acquiring a second feature point corresponding to the first reference point to obtain a second reference point;

constructing a second reference area of a human body attribute corresponding to the second reference point;

mirroring the second reference area to obtain a mirrored second reference area; and

adjusting a size of the first reference area by using the mirrored second reference area to obtain the focus area of the human body attribute.

13. The apparatus according to claim 9 , wherein, when the processor is configured to cause the apparatus to perform generating the class activation map corresponding to each type of human body attribute according to the global heat map and the local heat maps, the processor is configured to cause the apparatus to perform:

vectorizing the global heat map to obtain a feature vector corresponding to the global heat map;

determining, based on distribution of the local heat maps in the global heat map, human body attributes focused by the local heat maps;

generating weight matrixes corresponding to the local heat maps according to the human body attributes focused by the local heat maps; and

calculating products of the feature vector and the weight matrixes respectively to obtain the class activation map corresponding to each type of human body attribute.

14. The apparatus according to claim 8 , wherein, when the processor is configured to cause the apparatus to perform correcting the recognition model according to the target loss function based on the focus area, the true values of human body attributes, and the human body attribute predicted values, the processor is configured to cause the apparatus to perform:

calculating a first loss function of the recognition model based on the true values of human body attributes and predicted values of human body attributes;

acquiring a second loss function corresponding to the focus area through the recognition model;

superimposing the first loss function and the second loss function to obtain the target loss function of the recognition model; and

correcting the recognition model according to the target loss function.

15. A non-transitory computer-readable storage medium storing computer-readable instructions, wherein, the computer-readable instructions, when executed by a processor, are configured to cause the processor to perform:

acquiring a sample image of human body, the sample image containing a plurality of to-be-detected areas, the to-be-detected areas being labeled with true values of human body attributes;

generating, through a recognition model, a heat map of the sample image and heat maps of the to-be-detected areas to obtain a global heat map and local heat maps corresponding to the sample image;

fusing the global heat map and the local heat maps to obtain a fused image, and performing human body attribute recognition on the fused image to obtain predicted values of human body attribute of the sample image;

determining a focus area of each type of human body attribute according to the global heat map and the local heat maps;

correcting the recognition model according to a target loss function based on the focus area, the true values of human body attributes, and the predicted values of human body attributes; and

performing, based on the corrected recognition model, human body attribute recognition on a to-be-recognized image.

16. The non-transitory computer-readable storage medium according to claim 15 , wherein, when the computer-readable instructions are configured to cause the processor to perform determining the focus area of each type of human body attribute according to the global heat map and the local heat maps, the computer-readable instructions are configured to cause the processor to perform:

generating a class activation map corresponding to each type of human body attribute according to the global heat map and the local heat maps; and

correcting the class activation map, and determining the focus area of each type of human body attribute based on a result of the correction.

17. The non-transitory computer-readable storage medium according to claim 16 , wherein, when the computer-readable instructions are configured to cause the processor to perform correcting the class activation map, and determining the focus area of each type of human body attribute based on the result of the correction, the computer-readable instructions are configured to cause the processor to perform:

mirroring the global heat map and the local heat maps respectively to obtain a mirrored global heat map and mirrored local heat maps;

generating a mirrored class activation map of each type of human body attribute based on the mirrored global heat map and the mirrored local heat maps; and

determining the focus area of each type of human body attribute according to the class activation map and the mirrored class activation map.

18. The non-transitory computer-readable storage medium according to claim 17 , wherein, when the computer-readable instructions are configured to cause the processor to perform determining the focus area of each type of human body attribute according to the class activation map and the mirrored class activation map, the computer-readable instructions are configured to cause the processor to perform:

obtaining a plurality of first feature points corresponding to the class activation map and a plurality of second feature points corresponding to the mirrored class activation map, each first feature point corresponding to a second feature point;

extracting heat values of the first feature points to obtain first heat values corresponding to the first feature points;

extracting heat values of the second feature points to obtain second heat values corresponding to the second feature points; and

constructing the focus area of each type of human body attribute based on the first heat values and the second heat values.

19. The non-transitory computer-readable storage medium according to claim 18 , wherein, when the computer-readable instructions are configured to cause the processor to perform constructing the focus area of each type of human body attribute based on the first heat values and the second heat values, the computer-readable instructions are configured to cause the processor to perform:

determining whether each first heat value meets a preset condition; and

in response to determining that a first feature point meets the preset condition:

selecting the first feature point that meets the preset condition from the plurality of first feature points to obtain a first reference point;

constructing a first reference area of a human body attribute corresponding to the first reference point;

acquiring a second feature point corresponding to the first reference point to obtain a second reference point;

constructing a second reference area of a human body attribute corresponding to the second reference point;

mirroring the second reference area to obtain a mirrored second reference area; and

adjusting a size of the first reference area by using the mirrored second reference area to obtain the focus area of the human body attribute.

20. The non-transitory computer-readable storage medium according to claim 16 , wherein, when the computer-readable instructions are configured to cause the processor to perform generating the class activation map corresponding to each type of human body attribute according to the global heat map and the local heat maps, the computer-readable instructions are configured to cause the processor to perform:

vectorizing the global heat map to obtain a feature vector corresponding to the global heat map;

determining, based on distribution of the local heat maps in the global heat map, human body attributes focused by the local heat maps;

generating weight matrixes corresponding to the local heat maps according to the human body attributes focused by the local heat maps; and

calculating products of the feature vector and the weight matrixes respectively to obtain the class activation map corresponding to each type of human body attribute.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 19, 2021
From: HE, KEKE; LIU, JING; GE, YANHAO; WANG, CHENGJIE; LI, JILIN
To: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Reel/Frame 057835/0095 →
Priority Claims (1)
CN 201911268088.4 · Dec 11, 2019 · national
Continuity (2)
Continuation PCTCN2020117441 · Sep 24, 2020
Related Publication 20220036059A1 · Feb 3, 2022