MobileNet-SSD(二):训练模型

二、训练模型
1、将下载的源码,解压到caffe-ssd/examples/目录下。
2、修改、运行gen_model.sh文件,获取相关prototxt文件:
gen_model.sh generate my own training prototxt
./gen_model.sh 11

#!/bin/sh
if test -z $1 ;then
	echo usage: $0 CLASSNUM
        echo "        for voc the classnum is 21"
	exit 1
fi
echo $1 |grep '^[0-9]*$' >/dev/null 2>&1
if [ $? != 0 ];then
	echo usage: $0 CLASSNUM
        echo "        for voc the classnum is 21"
	exit 1
fi
cls_num=$1
cls_num3=$(expr $1 \* 3)
cls_num6=$(expr $1 \* 6)
trainfile=example/MobileNetSSD_train.prototxt
testfile=example/MobileNetSSD_test.prototxt
deploybnfile=example/MobileNetSSD_deploy_bn.prototxt
deployfile=example/MobileNetSSD_deploy.prototxt

mkdir -p example

cp template/MobileNetSSD_train_template.prototxt $trainfile
sed -i "s/cls6x/${cls_num6}/g" $trainfile
sed -i "s/cls3x/${cls_num3}/g" $trainfile
sed -i "s/cls1x/${cls_num}/g" $trainfile

cp template/MobileNetSSD_test_template.prototxt $testfile
sed -i "s/cls6x/${cls_num6}/g" $testfile
sed -i "s/cls3x/${cls_num3}/g" $testfile
sed -i "s/cls1x/${cls_num}/g" $testfile

#cp template/MobileNetSSD_deploy_bn_template.prototxt $deploybnfile
#sed -i "s/cls6x/${cls_num6}/g" $deploybnfile
#sed -i "s/cls3x/${cls_num3}/g" $deploybnfile
#sed -i "s/cls1x/${cls_num}/g" $deploybnfile

cp template/MobileNetSSD_deploy_template.prototxt $deployfile
sed -i "s/cls6x/${cls_num6}/g" $deployfile
sed -i "s/cls3x/${cls_num3}/g" $deployfile
sed -i "s/cls1x/${cls_num}/g" $deployfile

3、根据实际路径修改,生成的trainfile、testfile等文件中的相关文件路径。
4、修改/caffe-ssd/examples/MobileNet-SSD-master/solver_train.prototxt,然后运行train.sh

train_net: "example/MobileNetSSD_train.prototxt"
test_net: "example/MobileNetSSD_test.prototxt"
test_iter: 673
test_interval: 10000
base_lr: 0.0005
display: 10
max_iter: 120000
lr_policy: "multistep"
gamma: 0.5
weight_decay: 0.00005
snapshot: 1000
snapshot_prefix: "snapshot/mobilenet"
solver_mode: GPU
debug_info: false
snapshot_after_train: true
test_initialization: false
average_loss: 10
stepvalue: 20000
stepvalue: 40000
iter_size: 1
type: "RMSProp"
eval_type: "detection"
ap_version: "11point"
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值