赞
踩
#yolov3.cfg
# Training
batch=128
subdivisions=16
max_batches = 500200
batch = 128 表示没batch个样本更新一次参数 如果显存不够大,可以将batch进行划分成subdivisions份;网络会进行subdivisions前馈过程后,再进行一次后馈过程参数更新
因此,每次iteration能够处理的图片个数为:batch/subdivisions
如果你的图片总数为n,则完全epoch一次所有样本,需要的iteration = n*subdivisions/batch
一般情况下,epoch需要设置为200次以上,网络才会收敛
因此max_batches = epochnsubdivisions/batch
layer { name: "data" type: "Data" top: "data" top: "label" include { phase: TRAIN } transform_param { mirror: true mean_value:118 mean_value:95 mean_value:86 #scale: 0.00390625 #mean_file: "data/train_lmdb.binaryproto" } data_param { source: "data/train_lmdb" batch_size: 32 backend: LMDB } } max_iter: 100000 #最大迭代次数,参数意义同darknet的max_batches
python main.py ctdet --exp_id coco_dla --batch_size 32 --master_batch 15 --lr 1.25e-4 --num_epochs 200 --gpus 0,1
batch_size 一次参数更新,处理的图片个数
num_epochs 对完整训练数据迭代的次数
master_batch batch_size中,分配给主GPU的的图片个数
以实际场景的火灾检测为例,来看下不同epochs次数下,网络的测试验证结果
验证环境是
pytorch 环境下的centernet算法,数据格式为COCO,训练数据量为大概为两完整
算法训练结束后,会打印以下COCO检测指标训练结果
COCO检测指标
INFO HboxContainer: Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.791 INFO HboxContainer: Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.564 INFO HboxContainer: Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.768 INFO HboxContainer: Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.812 HboxContainer: DONE (t=17.93s). HboxContainer: Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.766 HboxContainer: Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.954 HboxContainer: Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.607 HboxContainer: Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.379 HboxContainer: Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.726 HboxContainer: Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.422 HboxContainer: Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.664 HboxContainer: Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.829
基于以上测试指标的理解,我们统计了不同epochs下的,训练结果对比
如上结果所示,针对我们的测试数据,epochs在400次迭代的时候,训练结果达到基本稳定
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。