-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathREADME.t
63 lines (45 loc) · 3.36 KB
/
README.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 同时识别年龄与性别
基于PyTorch 实现多任务学习,在同时识别年龄与性别。
## 数据集
[IMDB-WIKI](https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/) 数据集,460,723张图片。
![image](https://github.com/foamliu/Joint-Estimation-of-Age-and-Gender/raw/master/images/imdb-wiki-teaser.png)
这里为简洁只使用 IMDB 数据集。
### 年龄分布:
460723张照片为平衡每个年龄最多只保存5000张,清洗后得到163065张,按年龄分布作图:
![image](https://github.com/foamliu/Joint-Estimation-of-Age-and-Gender/raw/master/images/age.png)
## 用法
### 数据预处理
提取163065张图片:
```bash
$ python pre_process.py
```
### 训练
```bash
$ python train.py
```
### 准确度比较
#|图片大小|网络|性别准确度(验证集)|年龄MAE(验证集)|年龄损失函数|批量大小|Loss|年龄权重|
|---|---|---|---|---|---|---|---|---|
|1|112x112|ResNet-18|90.756%|5.710|回归(L1Loss)|32|0.9757|0.1|
|2|224x224|ResNet-18|90.887%|5.694|回归(L1Loss)|32|0.9719|0.1|
|3|112x112|ResNet-18|90.140%|5.986|回归(L2Loss)|32|1.121|0.01|
|4|224x224|ResNet-18|90.064%|8.475|分类(交叉熵)|32|TBD|TBD|
|5|224x224|ResNet-50|90.034%|TBD|分类(交叉熵)|32|TBD|TBD|
### Demo
下载预训练的模型 [Link](https://github.com/foamliu/Age-and-Gender/releases/download/1.0/BEST_checkpoint_.pth.tar),执行:
```bash
$ python demo.py
```
效果图如下:
原图 | 校准 | 识别 | 标注 |
|---|---|---|---|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/0_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/0_img.jpg)|$(result_out_0)|$(result_true_0)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/1_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/1_img.jpg)|$(result_out_1)|$(result_true_1)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/2_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/2_img.jpg)|$(result_out_2)|$(result_true_2)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/3_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/3_img.jpg)|$(result_out_3)|$(result_true_3)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/4_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/4_img.jpg)|$(result_out_4)|$(result_true_4)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/5_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/5_img.jpg)|$(result_out_5)|$(result_true_5)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/6_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/6_img.jpg)|$(result_out_6)|$(result_true_6)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/7_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/7_img.jpg)|$(result_out_7)|$(result_true_7)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/8_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/8_img.jpg)|$(result_out_8)|$(result_true_8)|
|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/9_raw.jpg)|![image](https://github.com/foamliu/Age-and-Gender/raw/master/images/9_img.jpg)|$(result_out_9)|$(result_true_9)|