最近在整MTCNN相关的东西,于是从github大佬处clone了一份,无奈本人手残,跑起来处处是报错。帖子上的询问均是石沉大海,只有边搞边记录了,希望能坚持到跑通的那一天吧= =。
博文CSDN:https://blog.csdn.net/weixin_36474809/article/details/82752199
博文代码: https://github.com/AITTSMD/MTCNN-Tensorflow。
README
- Download Wider Face Training part only from Official Website , unzip to replace
WIDER_train
and put it intoprepare_data
folder. - Download landmark training data from [here]((http://mmlab.ie.cuhk.edu.hk/archive/CNN_FacePoint.htm )),unzip and put them into
prepare_data
folder. - Run
prepare_data/gen_12net_data.py
to generate training data(Face Detection Part) for PNet. - Run
gen_landmark_aug_12.py
to generate training data(Face Landmark Detection Part) for PNet. - Run
gen_imglist_pnet.py
to merge two parts of training data. - Run
gen_PNet_tfrecords.py
to generate tfrecord for PNet. - After training PNet, run
gen_hard_example
to generate training data(Face Detection Part) for RNet. - Run
gen_landmark_aug_24.py
to generate training data(Face Landmark Detection Part) for RNet. - Run
gen_imglist_rnet.py
to merge two parts of training data. - Run
gen_RNet_tfrecords.py
to generate tfrecords for RNet.(you should run this script four times to generate tfrecords of neg,pos,part and landmark respectively) - After training RNet, run
gen_hard_example
to generate training data(Face Detection Part) for ONet. - Run
gen_landmark_aug_48.py
to generate training data(Face Landmark Detection Part) for ONet. - Run
gen_imglist_onet.py
to merge two parts of training data.
开始受苦
我们根据文章先去下有关数据集(官网就有,觉得慢就用迅雷之类的下,注意这里要下载的文件数量),然后放到对应文件夹位置(prepare_data)。
有需要可以去下阉割版的:https://pan.baidu.com/s/1mf0hM5VqtpdMfTpf2VRELA 提取码:kuqw (感谢网上大佬的资源)(不过我还是推荐下原版文件,虽然很大)
又或者(更新):链接: https://pan.baidu.com/s/1LIYlK5sVx4qsK9tvEuJ4cw 提取码: 2yvx
在遇见具体的代码问题之前,有几个常规报错需要了解:
1.
这里是显卡的显存的问题,手动调整显卡的占用率:
import tensorflow as tf
gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.333)
sess = tf.compat.v1.Session(config=tf.ConfigProto(gpu_options=gpu_options))
2.
遇到no module之类的问题,我们查找资料发现:
根据官方通讯ensorflow 2.x与1.x相比发生了重大变化。tf.contrib将从核心Tensor