最近在整MTCNN相关的东西,于是从github大佬处clone了一份,无奈本人手残,跑起来处处是报错。帖子上的询问均是石沉大海,只有边搞边记录了,希望能坚持到跑通的那一天吧= =。
博文优快云:https://blog.youkuaiyun.com/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_trainand put it intoprepare_datafolder. - Download landmark training data from [here]((http://mmlab.ie.cuhk.edu.hk/archive/CNN_FacePoint.htm )),unzip and put them into
prepare_datafolder. - Run
prepare_data/gen_12net_data.pyto generate training data(Face Detection Part) for PNet. - Run
gen_landmark_aug_12.pyto generate training data(Face Landmark Detection Part) for PNet. - Run
gen_imglist_pnet.pyto merge two parts of training data. - Run
gen_PNet_tfrecords.pyto generate tfrecord for PNet. - After training PNet, run
gen_hard_exampleto generate training data(Face Detection Part) for RNet. - Run
gen_landmark_aug_24.pyto generate training data(Face Landmark Detection Part) for RNet. - Run
gen_imglist_rnet.pyto merge two parts of training data. - Run
gen_RNet_tfrecords.pyto 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_exampleto generate training data(Face Detection Part) for ONet. - Run
gen_landmark_aug_48.pyto generate training data(Face Landmark Detection Part) for ONet. - Run
gen_imglist_onet.pyto 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.S

本文记录了在训练MTCNN过程中遇到的错误和解决方案,包括数据下载、目录结构、Python环境问题以及训练脚本的错误处理。通过解决显卡显存、模块导入、版本兼容、CUDA配置等问题,逐步进行数据准备和模型训练。
最低0.47元/天 解锁文章
4042





