From b7de96eeec6f63c4de48c0d84a6c1eec06dbdcce Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 2 May 2019 18:20:50 +0000 Subject: [PATCH] optimized solver for cifar10/cifar10_fast --- .../models/cifar10/cifar10_solver.prototxt | 7 +++-- .../cifar10/cifar10_solver_lr1.prototxt | 27 ------------------- .../cifar10/cifar10_solver_lr2.prototxt | 27 ------------------- ml/cmsisnn/models/cifar10/train.sh | 10 ------- .../cifar10_fast/cifar10_fast_solver.prototxt | 7 +++-- .../cifar10_fast_solver_lr1.prototxt | 27 ------------------- .../cifar10_fast_solver_lr2.prototxt | 27 ------------------- ml/cmsisnn/models/cifar10_fast/train.sh | 10 ------- 8 files changed, 10 insertions(+), 132 deletions(-) delete mode 100644 ml/cmsisnn/models/cifar10/cifar10_solver_lr1.prototxt delete mode 100644 ml/cmsisnn/models/cifar10/cifar10_solver_lr2.prototxt delete mode 100644 ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr1.prototxt delete mode 100644 ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr2.prototxt diff --git a/ml/cmsisnn/models/cifar10/cifar10_solver.prototxt b/ml/cmsisnn/models/cifar10/cifar10_solver.prototxt index 29c6c35a9..f0dd05e4b 100644 --- a/ml/cmsisnn/models/cifar10/cifar10_solver.prototxt +++ b/ml/cmsisnn/models/cifar10/cifar10_solver.prototxt @@ -14,11 +14,14 @@ base_lr: 0.001 momentum: 0.9 weight_decay: 0.004 # The learning rate policy -lr_policy: "fixed" +lr_policy: "multistep" +gamma: 0.1 +stepvalue: 60000 +stepvalue: 65000 # Display every 200 iterations display: 200 # The maximum number of iterations -max_iter: 60000 +max_iter: 70000 # snapshot intermediate results snapshot: 10000 snapshot_format: HDF5 diff --git a/ml/cmsisnn/models/cifar10/cifar10_solver_lr1.prototxt b/ml/cmsisnn/models/cifar10/cifar10_solver_lr1.prototxt deleted file mode 100644 index 221a58ecc..000000000 --- a/ml/cmsisnn/models/cifar10/cifar10_solver_lr1.prototxt +++ /dev/null @@ -1,27 +0,0 @@ -# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10 -# then another factor of 10 after 10 more epochs (5000 iters) - -# The train/test net protocol buffer definition -net: "models/cifar10/cifar10_train_test.prototxt" -# test_iter specifies how many forward passes the test should carry out. -# In the case of CIFAR10, we have test batch size 100 and 100 test iterations, -# covering the full 10,000 testing images. -test_iter: 100 -# Carry out testing every 1000 training iterations. -test_interval: 1000 -# The base learning rate, momentum and the weight decay of the network. -base_lr: 0.0001 -momentum: 0.9 -weight_decay: 0.004 -# The learning rate policy -lr_policy: "fixed" -# Display every 200 iterations -display: 200 -# The maximum number of iterations -max_iter: 65000 -# snapshot intermediate results -snapshot: 5000 -snapshot_format: HDF5 -snapshot_prefix: "models/cifar10/cifar10" -# solver mode: CPU or GPU -solver_mode: GPU diff --git a/ml/cmsisnn/models/cifar10/cifar10_solver_lr2.prototxt b/ml/cmsisnn/models/cifar10/cifar10_solver_lr2.prototxt deleted file mode 100644 index 48ada9740..000000000 --- a/ml/cmsisnn/models/cifar10/cifar10_solver_lr2.prototxt +++ /dev/null @@ -1,27 +0,0 @@ -# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10 -# then another factor of 10 after 10 more epochs (5000 iters) - -# The train/test net protocol buffer definition -net: "models/cifar10/cifar10_train_test.prototxt" -# test_iter specifies how many forward passes the test should carry out. -# In the case of CIFAR10, we have test batch size 100 and 100 test iterations, -# covering the full 10,000 testing images. -test_iter: 100 -# Carry out testing every 1000 training iterations. -test_interval: 1000 -# The base learning rate, momentum and the weight decay of the network. -base_lr: 0.00001 -momentum: 0.9 -weight_decay: 0.004 -# The learning rate policy -lr_policy: "fixed" -# Display every 200 iterations -display: 200 -# The maximum number of iterations -max_iter: 70000 -# snapshot intermediate results -snapshot: 5000 -snapshot_format: HDF5 -snapshot_prefix: "models/cifar10/cifar10" -# solver mode: CPU or GPU -solver_mode: GPU diff --git a/ml/cmsisnn/models/cifar10/train.sh b/ml/cmsisnn/models/cifar10/train.sh index 93549ea08..80c2b8600 100755 --- a/ml/cmsisnn/models/cifar10/train.sh +++ b/ml/cmsisnn/models/cifar10/train.sh @@ -6,13 +6,3 @@ TOOLS=./caffe/build/tools $TOOLS/caffe train \ --solver=models/cifar10/cifar10_solver.prototxt $@ 2>&1 | tee $DIR/training.log - -# reduce learning rate by factor of 10 -$TOOLS/caffe train \ - --solver=models/cifar10/cifar10_solver_lr1.prototxt \ - --snapshot=models/cifar10/cifar10_iter_60000.solverstate.h5 $@ 2>&1 | tee -a $DIR/training.log - -# reduce learning rate by factor of 10 -$TOOLS/caffe train \ - --solver=models/cifar10/cifar10_solver_lr2.prototxt \ - --snapshot=models/cifar10/cifar10_iter_65000.solverstate.h5 $@ 2>&1 | tee -a $DIR/training.log diff --git a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver.prototxt b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver.prototxt index 22e304396..2b9a41edb 100644 --- a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver.prototxt +++ b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver.prototxt @@ -14,11 +14,14 @@ base_lr: 0.001 momentum: 0.9 weight_decay: 0.004 # The learning rate policy -lr_policy: "fixed" +lr_policy: "multistep" +gamma: 0.1 +stepvalue: 60000 +stepvalue: 65000 # Display every 200 iterations display: 200 # The maximum number of iterations -max_iter: 60000 +max_iter: 70000 # snapshot intermediate results snapshot: 10000 snapshot_format: HDF5 diff --git a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr1.prototxt b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr1.prototxt deleted file mode 100644 index 86f683aa6..000000000 --- a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr1.prototxt +++ /dev/null @@ -1,27 +0,0 @@ -# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10 -# then another factor of 10 after 10 more epochs (5000 iters) - -# The train/test net protocol buffer definition -net: "models/cifar10_fast/cifar10_fast_train_test.prototxt" -# test_iter specifies how many forward passes the test should carry out. -# In the case of CIFAR10, we have test batch size 100 and 100 test iterations, -# covering the full 10,000 testing images. -test_iter: 100 -# Carry out testing every 1000 training iterations. -test_interval: 1000 -# The base learning rate, momentum and the weight decay of the network. -base_lr: 0.0001 -momentum: 0.9 -weight_decay: 0.004 -# The learning rate policy -lr_policy: "fixed" -# Display every 200 iterations -display: 200 -# The maximum number of iterations -max_iter: 65000 -# snapshot intermediate results -snapshot: 5000 -snapshot_format: HDF5 -snapshot_prefix: "models/cifar10_fast/cifar10_fast" -# solver mode: CPU or GPU -solver_mode: GPU diff --git a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr2.prototxt b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr2.prototxt deleted file mode 100644 index 034e9f5e8..000000000 --- a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr2.prototxt +++ /dev/null @@ -1,27 +0,0 @@ -# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10 -# then another factor of 10 after 10 more epochs (5000 iters) - -# The train/test net protocol buffer definition -net: "models/cifar10_fast/cifar10_fast_train_test.prototxt" -# test_iter specifies how many forward passes the test should carry out. -# In the case of CIFAR10, we have test batch size 100 and 100 test iterations, -# covering the full 10,000 testing images. -test_iter: 100 -# Carry out testing every 1000 training iterations. -test_interval: 1000 -# The base learning rate, momentum and the weight decay of the network. -base_lr: 0.00001 -momentum: 0.9 -weight_decay: 0.004 -# The learning rate policy -lr_policy: "fixed" -# Display every 200 iterations -display: 200 -# The maximum number of iterations -max_iter: 70000 -# snapshot intermediate results -snapshot: 5000 -snapshot_format: HDF5 -snapshot_prefix: "models/cifar10_fast/cifar10_fast" -# solver mode: CPU or GPU -solver_mode: GPU diff --git a/ml/cmsisnn/models/cifar10_fast/train.sh b/ml/cmsisnn/models/cifar10_fast/train.sh index f884ec06b..f1e6a690a 100755 --- a/ml/cmsisnn/models/cifar10_fast/train.sh +++ b/ml/cmsisnn/models/cifar10_fast/train.sh @@ -6,13 +6,3 @@ TOOLS=./caffe/build/tools $TOOLS/caffe train \ --solver=models/cifar10_fast/cifar10_fast_solver.prototxt $@ 2>&1 | tee $DIR/training.log - -# reduce learning rate by factor of 10 -$TOOLS/caffe train \ - --solver=models/cifar10_fast/cifar10_fast_solver_lr1.prototxt \ - --snapshot=models/cifar10_fast/cifar10_fast_iter_60000.solverstate.h5 $@ 2>&1 | tee -a $DIR/training.log - -# reduce learning rate by factor of 10 -$TOOLS/caffe train \ - --solver=models/cifar10_fast/cifar10_fast_solver_lr2.prototxt \ - --snapshot=models/cifar10_fast/cifar10_fast_iter_65000.solverstate.h5 $@ 2>&1 | tee -a $DIR/training.log