【人脸属性】Age-Gender-Estimate-TF复现步骤

https://github.com/BoyuanJiang/Age-Gender-Estimate-TF

0.环境

ubuntu16.04
python3.6

tensorflow==1.10.0
dlib==19.8.1
opencv-python==4.1.0.25
matplotlib==3.3.1
imutils==0.4.3
numpy==1.19.2
pandas==1.1.2
scipy
scikit-learn
scikit-image
tqdm

1.准备与处理数据

https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/static/imdb_crop.tar

https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/static/wiki_crop.tar

处理数据,首先修改convert_to_records_multiCPU.py,在line 120行替换为如下:

'file_name': _bytes_feature(bytes(file_name[index][0], 'utf-8'))}))

再运行下面的,转换为tfrecord: 

python convert_to_records_multiCPU.py --imdb --nworks 8

(这个过程太漫长了,一度以为出错了。7个多小时) 

以/data/train目录为例:

2.准备预训练模型

 https://pan.baidu.com/s/1dFewgqH(大概80多M),按照作者的要求,放到models目录下。

cp ./weight_from_facenet_20170512-110547.zip ./models/
cd models/ && unzip ./weight_from_facenet_20170512-110547.zip && cd ..

3.训练

CUDA_VISIBLE_DEVICES=1 python train.py --lr 1e-3 --weight_decay 1e-5 --epoch 6 --batch_size 128 --keep_prob 0.8 --cuda

这是作者复现的tensorboard可视化结果。 

4.测试

测试部分作者写得很详细:

https://github.com/BoyuanJiang/Age-Gender-Estimate-TF

猜你喜欢

转载自blog.csdn.net/qq_35975447/article/details/110927062