Skip to content

Commit eea8c56

Browse files
committed
Facial attribute extraction
1 parent db4ad9a commit eea8c56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+22042
-1
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
## [released]
5+
- V 1.0.0
6+
7+
## [1.0.0] - 2020-07-14
8+
9+
### Added
10+
- Added facenet for face detection for mxnet
11+
12+
### Removed
13+
- Removed Dlib face detection

Dataset/004005.jpg

7.18 KB
Loading

README.md

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,141 @@
1-
# AIML-Human-Attributes-Detection-with-Facial-Feature-Extraction
1+
# AI ML - Human Attributes Detection with Facial Feature Extraction
2+
3+
## Age, Emotion, Gender recognition with Facial feature extraction
4+
5+
This facial attribute extraction program detects facial coordinates using FaceNet model and uses MXNet facial attribute extraction model for extracting 40 types of facial attributes. This solution detects Emotion, Age and Gender along with facial attributes.
6+
7+
Deep Learning Models used for the library are,
8+
9+
- FaceNet model used for facial landmark recognition.
10+
- A trained lightened moon Mxnet model used for facial attribute extraction.
11+
- AgeNet pre-trained caffe model used for Age detection.
12+
- GenderNet caffe model used for Gender detection.
13+
14+
## Table of contents
15+
16+
- [Getting started](#getting-started)
17+
- [Features](#features)
18+
- [Facial Attribute Classes](#facial-attribute-classes)
19+
- [Emotion Detection Classes](#emotion-detection-classes)
20+
- [Gender Detection Classes](#gender-detection-classes)
21+
- [Age Detection Classes](#age-detection-classes)
22+
- [Usage](#usage)
23+
- [Results](#results)
24+
- [Want to Contribute?](#want-to-contribute)
25+
- [Need Help / Support?](#need-help)
26+
- [Collection of Other Components](#collection-of-components)
27+
- [Changelog](#changelog)
28+
- [Credits](#credits)
29+
- [License](#license)
30+
- [Keywords](#Keywords)
31+
32+
## Getting started
33+
34+
Prerequisites for running the code are:
35+
36+
- Python == 3.6
37+
- python-opencv == 4.2.0
38+
- numpy == 1.18.5
39+
- pandas == 0.24.2
40+
- mxnet == 1.6.0
41+
- python-dotenv == 0.14.0
42+
43+
We have tested our program in above version, however you can use it in other versions as well.
44+
45+
## Features
46+
47+
- Face detection using FaceNet model
48+
- Detects facial attribute of a face in an image.
49+
- Detects Emotions on the face.
50+
- Predicts Gender of the detected face.
51+
- Predicts Age of the detected face.
52+
53+
### Facial Attribute Classes
54+
55+
["5_o_Clock_Shadow","Arched_Eyebrows","Attractive","Bags_Under_Eyes","Bald", "Bangs","Big_Lips","Big_Nose",
56+
"Black_Hair","Blond_Hair","Blurry","Brown_Hair","Bushy_Eyebrows","Chubby","Double_Chin","Eyeglasses","Goatee",
57+
"Gray_Hair", "Heavy_Makeup","High_Cheekbones","Male","Mouth_Slightly_Open","Mustache","Narrow_Eyes","No_Beard",
58+
"Oval_Face","Pale_Skin","Pointy_Nose","Receding_Hairline","Rosy_Cheeks","Sideburns","Smiling","Straight_Hair",
59+
"Wavy_Hair","Wearing_Earrings","Wearing_Hat","Wearing_Lipstick","Wearing_Necklace","Wearing_Necktie","Young"]
60+
61+
### Emotion Detection Classes
62+
63+
- Happy
64+
- Neutral
65+
- Surprise
66+
- Angry
67+
- Fear
68+
- Sad
69+
- Disgust
70+
71+
### Gender Detection Classes
72+
73+
- Male
74+
- Female
75+
76+
### Age Detection Classes
77+
78+
['(0-2)', '(4-6)', '(8-12)', '(15-20)', '(25-32)', '(38-43)', '(48-53)', '(60-100)']
79+
80+
## Usage
81+
82+
Inside the project's directory run:
83+
84+
```
85+
python predict.py
86+
```
87+
You can find sample images in the Dataset folder and results can be seen on the terminal. Results directory contains images with detected faces.
88+
89+
90+
### Results
91+
#### Original Image
92+
93+
<img src="images/image1.jpg" width = "300" height = "225"/>
94+
<img src="images/image2.jpg" width = "300" height = "225"/>
95+
96+
#### Detection Results
97+
98+
<img src="images/result1.png" />
99+
100+
## Want to Contribute?
101+
102+
- Created something awesome, made this code better, added some functionality, or whatever (this is the hardest part).
103+
- [Fork it](http://help.github.com/forking/).
104+
- Create new branch to contribute your changes.
105+
- Commit all your changes to your branch.
106+
- Submit a [pull request](http://help.github.com/pull-requests/).
107+
108+
-----
109+
110+
## Need Help?
111+
112+
We also provide a free, basic support for all users who want to use image processing techniques for their projects. In case you want to customize this image enhancement technique for your development needs, then feel free to contact our [AI/ML developers](https://www.weblineindia.com/ai-ml-dl-development.html).
113+
114+
-----
115+
116+
## Collection of Components
117+
118+
We have built many other components and free resources for software development in various programming languages. Kindly click here to view our [Free Resources for Software Development](https://www.weblineindia.com/software-development-resources.html).
119+
120+
------
121+
122+
## Changelog
123+
124+
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
125+
126+
## Credits
127+
128+
- Refered mxnet-face for attribute extraction. [mxnet-face](https://github.com/tornadomeet/mxnet-face).
129+
- Refered fer2013/IMDB for emotional classification. [fer2013/IMDB](https://github.com/oarriaga/face_classification).
130+
- Refered AgeGender recognition. [AgeGender](https://github.com/spmallick/learnopencv/tree/master/AgeGender).
131+
132+
## License
133+
134+
[MIT](LICENSE)
135+
136+
[mit]: https://github.com/miguelmota/is-valid-domain/blob/e48e90f3ecd55431bbdba950eea013c2072d2fac/LICENSE
137+
138+
## Keywords
139+
140+
Mxnet_face, facial_attribute_extraction, Age_recognition, gender_recognition, emotion_recognition, caffemodel, fer2013
141+

images/image1.jpg

7.18 KB
Loading

images/image2.jpg

16.7 KB
Loading

images/result1.png

56.4 KB
Loading
2.7 KB
Binary file not shown.

model/age/age_deploy.prototxt

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: "CaffeNet"
2+
input: "data"
3+
input_dim: 1
4+
input_dim: 3
5+
input_dim: 227
6+
input_dim: 227
7+
layers {
8+
name: "conv1"
9+
type: CONVOLUTION
10+
bottom: "data"
11+
top: "conv1"
12+
convolution_param {
13+
num_output: 96
14+
kernel_size: 7
15+
stride: 4
16+
}
17+
}
18+
layers {
19+
name: "relu1"
20+
type: RELU
21+
bottom: "conv1"
22+
top: "conv1"
23+
}
24+
layers {
25+
name: "pool1"
26+
type: POOLING
27+
bottom: "conv1"
28+
top: "pool1"
29+
pooling_param {
30+
pool: MAX
31+
kernel_size: 3
32+
stride: 2
33+
}
34+
}
35+
layers {
36+
name: "norm1"
37+
type: LRN
38+
bottom: "pool1"
39+
top: "norm1"
40+
lrn_param {
41+
local_size: 5
42+
alpha: 0.0001
43+
beta: 0.75
44+
}
45+
}
46+
layers {
47+
name: "conv2"
48+
type: CONVOLUTION
49+
bottom: "norm1"
50+
top: "conv2"
51+
convolution_param {
52+
num_output: 256
53+
pad: 2
54+
kernel_size: 5
55+
}
56+
}
57+
layers {
58+
name: "relu2"
59+
type: RELU
60+
bottom: "conv2"
61+
top: "conv2"
62+
}
63+
layers {
64+
name: "pool2"
65+
type: POOLING
66+
bottom: "conv2"
67+
top: "pool2"
68+
pooling_param {
69+
pool: MAX
70+
kernel_size: 3
71+
stride: 2
72+
}
73+
}
74+
layers {
75+
name: "norm2"
76+
type: LRN
77+
bottom: "pool2"
78+
top: "norm2"
79+
lrn_param {
80+
local_size: 5
81+
alpha: 0.0001
82+
beta: 0.75
83+
}
84+
}
85+
layers {
86+
name: "conv3"
87+
type: CONVOLUTION
88+
bottom: "norm2"
89+
top: "conv3"
90+
convolution_param {
91+
num_output: 384
92+
pad: 1
93+
kernel_size: 3
94+
}
95+
}
96+
layers{
97+
name: "relu3"
98+
type: RELU
99+
bottom: "conv3"
100+
top: "conv3"
101+
}
102+
layers {
103+
name: "pool5"
104+
type: POOLING
105+
bottom: "conv3"
106+
top: "pool5"
107+
pooling_param {
108+
pool: MAX
109+
kernel_size: 3
110+
stride: 2
111+
}
112+
}
113+
layers {
114+
name: "fc6"
115+
type: INNER_PRODUCT
116+
bottom: "pool5"
117+
top: "fc6"
118+
inner_product_param {
119+
num_output: 512
120+
}
121+
}
122+
layers {
123+
name: "relu6"
124+
type: RELU
125+
bottom: "fc6"
126+
top: "fc6"
127+
}
128+
layers {
129+
name: "drop6"
130+
type: DROPOUT
131+
bottom: "fc6"
132+
top: "fc6"
133+
dropout_param {
134+
dropout_ratio: 0.5
135+
}
136+
}
137+
layers {
138+
name: "fc7"
139+
type: INNER_PRODUCT
140+
bottom: "fc6"
141+
top: "fc7"
142+
inner_product_param {
143+
num_output: 512
144+
}
145+
}
146+
layers {
147+
name: "relu7"
148+
type: RELU
149+
bottom: "fc7"
150+
top: "fc7"
151+
}
152+
layers {
153+
name: "drop7"
154+
type: DROPOUT
155+
bottom: "fc7"
156+
top: "fc7"
157+
dropout_param {
158+
dropout_ratio: 0.5
159+
}
160+
}
161+
layers {
162+
name: "fc8"
163+
type: INNER_PRODUCT
164+
bottom: "fc7"
165+
top: "fc8"
166+
inner_product_param {
167+
num_output: 8
168+
}
169+
}
170+
layers {
171+
name: "prob"
172+
type: SOFTMAX
173+
bottom: "fc8"
174+
top: "prob"
175+
}

model/age/age_net.caffemodel

43.5 MB
Binary file not shown.
95.1 MB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)