Win10 + YOLOv3训练VOC数据集-----How to train Pascal VOC Data

Win10 + YOLOv3训练VOC数据集-----How to train Pascal VOC Data

  How to train (Pascal VOC Data):

  1. Download pre-trained weights for the convolutional layers (154 MB): http://pjreddie.com/media/files/darknet53.conv.74and put to the directory build\darknet\x64

  2. Download The Pascal VOC Data and unpack it to directory build\darknet\x64\data\voc will be created dir build\darknet\x64\data\voc\VOCdevkit\:

              三个文件都要下载每个文件都要解压,右键选择“解压到”,填写解压到的地址:H:\YOLOV3\darknet-master\build\darknet\x64\data\voc

    解压三次,三次“解压到”的地址填的都是同一个。

               

 

  1. 2.1 Download file voc_label.py to dir build\darknet\x64\data\vochttp://pjreddie.com/media/files/voc_label.py

  2. Download and install Python for Windows: https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe

  3. Run command: python build\darknet\x64\data\voc\voc_label.py (to generate files: 2007_test.txt, 2007_train.txt, 2007_val.txt, 2012_train.txt, 2012_val.txt)

 

    (cmd下进入H:\YOLOV3\darknet-master\build\darknet\x64\data\voc  运行命令python voc_label.py,之后就会生成下面几个文件)

 

              

 

 

  1. Run command: type 2007_train.txt 2007_val.txt 2012_*.txt > train.txt

    命令的作用就是将四个txt文件合并成一个txt文件(2007_test.txt 训练时不使用) ,所以会生成一个新的 train.txt 文件,文件大小就是前面四个文件的和。

    

 

  1. Set batch=64 and subdivisions=8 in the file yolov3-voc.cfglink

    文件位置:H:\YOLOV3\darknet-master\cfg

  1. Start training by using train_voc.cmd or by using the command line:

    darknet.exe detector train data/voc.data cfg/yolov3-voc.cfg darknet53.conv.74

    我的train_voc.cmd 文件中的代码不是上面这一行,运行会提示找不到 darknet19_48.conv.23。我将原来的代码注释掉了,添加了上面上面这一行代码。

    

    之后双击运行 train_voc.cmd 文件,运行2秒闪退,提示:CUDA Error:out of memory 

    参考:https://blog.csdn.net/dcrmg/article/details/78565350 修改如下:

    1.GPU=1  CUDNN=1 修改之前都是 0 。

 

    

    根据训练时需要执行的语句:darknet.exe detector train data/voc.data cfg/yolov3-voc.cfg darknet53.conv.74

    来修改对应文件中的代码(注意:darknet官网所给的voc.data文件位置是错误的的,这两个需要修改的文件都应该和 train_voc.cmd文件 在相同的目录下):

    voc.datayolov3-voc.cfg 分别修改成如下:

    (如果不修改,或者按照修改成其他文件时会提示:could not open file:darknet19_48.conv.23 或者提示错误: CUDA Error:out of memory )

    

    

    修改好后,双击运行train_voc.cmd文件,就开始训练了。

    截图纪念如下:

    

 

 

    

 

 

 

(Note: To disable Loss-Window use flag -dont_show. If you are using CPU, try darknet_no_gpu.exe instead of darknet.exe.)

If required change pathes in the file build\darknet\x64\data\voc.data

More information about training by the link: http://pjreddie.com/darknet/yolo/#train-voc

Note: If during training you see nan values for avg (loss) field - then training goes wrong, but if nan is in some other lines - then training goes well.

posted @ 2018-08-18 17:23 YangZhaonan 阅读(...) 评论(...) 编辑 收藏

  • 3
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值