MTCNN训练代码的相关问题

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

最近在整MTCNN相关的东西,于是从github大佬处clone了一份,无奈本人手残,跑起来处处是报错。帖子上的询问均是石沉大海,只有边搞边记录了,希望能坚持到跑通的那一天吧= =。

博文优快云:https://blog.youkuaiyun.com/weixin_36474809/article/details/82752199
博文代码: https://github.com/AITTSMD/MTCNN-Tensorflow

README

  1. Download Wider Face Training part only from Official Website , unzip to replace WIDER_train and put it into prepare_data folder.
  2. Download landmark training data from [here]((http://mmlab.ie.cuhk.edu.hk/archive/CNN_FacePoint.htm )),unzip and put them into prepare_data folder.
  3. Run prepare_data/gen_12net_data.py to generate training data(Face Detection Part) for PNet.
  4. Run gen_landmark_aug_12.py to generate training data(Face Landmark Detection Part) for PNet.
  5. Run gen_imglist_pnet.py to merge two parts of training data.
  6. Run gen_PNet_tfrecords.py to generate tfrecord for PNet.
  7. After training PNet, run gen_hard_example to generate training data(Face Detection Part) for RNet.
  8. Run gen_landmark_aug_24.py to generate training data(Face Landmark Detection Part) for RNet.
  9. Run gen_imglist_rnet.py to merge two parts of training data.
  10. 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)
  11. After training RNet, run gen_hard_example to generate training data(Face Detection Part) for ONet.
  12. Run gen_landmark_aug_48.py to generate training data(Face Landmark Detection Part) for ONet.
  13. 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.S
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值