diff --git a/ml/cmsisnn/models/cifar10/cifar10.network b/ml/cmsisnn/models/cifar10/cifar10.network index d39a1258f..dd38418ad 100644 Binary files a/ml/cmsisnn/models/cifar10/cifar10.network and b/ml/cmsisnn/models/cifar10/cifar10.network differ diff --git a/ml/cmsisnn/models/cifar10/cifar10_iter_300000.caffemodel.h5 b/ml/cmsisnn/models/cifar10/cifar10_iter_300000.caffemodel.h5 deleted file mode 100644 index 2a4c5874a..000000000 Binary files a/ml/cmsisnn/models/cifar10/cifar10_iter_300000.caffemodel.h5 and /dev/null differ diff --git a/ml/cmsisnn/models/cifar10/cifar10_solver.prototxt b/ml/cmsisnn/models/cifar10/cifar10_solver.prototxt new file mode 100644 index 000000000..29c6c35a9 --- /dev/null +++ b/ml/cmsisnn/models/cifar10/cifar10_solver.prototxt @@ -0,0 +1,27 @@ +# 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.001 +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: 60000 +# snapshot intermediate results +snapshot: 10000 +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_lr1.prototxt b/ml/cmsisnn/models/cifar10/cifar10_solver_lr1.prototxt new file mode 100644 index 000000000..221a58ecc --- /dev/null +++ b/ml/cmsisnn/models/cifar10/cifar10_solver_lr1.prototxt @@ -0,0 +1,27 @@ +# 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 new file mode 100644 index 000000000..48ada9740 --- /dev/null +++ b/ml/cmsisnn/models/cifar10/cifar10_solver_lr2.prototxt @@ -0,0 +1,27 @@ +# 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/test.sh b/ml/cmsisnn/models/cifar10/test.sh new file mode 100755 index 000000000..432ba1520 --- /dev/null +++ b/ml/cmsisnn/models/cifar10/test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe test \ + --model=models/cifar10/cifar10_train_test.prototxt \ + --weights=models/cifar10/cifar10_iter_70000.caffemodel.h5 $@ diff --git a/ml/cmsisnn/models/cifar10/train.sh b/ml/cmsisnn/models/cifar10/train.sh new file mode 100755 index 000000000..2b6ae0b8c --- /dev/null +++ b/ml/cmsisnn/models/cifar10/train.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe train \ + --solver=models/cifar10/cifar10_solver.prototxt $@ + +# 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 $@ + +# 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 $@ diff --git a/ml/cmsisnn/models/cifar10_fast/cifar10_fast.network b/ml/cmsisnn/models/cifar10_fast/cifar10_fast.network index 4a73f5730..acbaded90 100644 Binary files a/ml/cmsisnn/models/cifar10_fast/cifar10_fast.network and b/ml/cmsisnn/models/cifar10_fast/cifar10_fast.network differ diff --git a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_iter_70000.caffemodel.h5 b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_iter_70000.caffemodel.h5 deleted file mode 100644 index 295f915a6..000000000 Binary files a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_iter_70000.caffemodel.h5 and /dev/null differ diff --git a/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver.prototxt b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver.prototxt new file mode 100644 index 000000000..22e304396 --- /dev/null +++ b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver.prototxt @@ -0,0 +1,27 @@ +# 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.001 +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: 60000 +# snapshot intermediate results +snapshot: 10000 +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_lr1.prototxt b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr1.prototxt new file mode 100644 index 000000000..86f683aa6 --- /dev/null +++ b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr1.prototxt @@ -0,0 +1,27 @@ +# 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 new file mode 100644 index 000000000..034e9f5e8 --- /dev/null +++ b/ml/cmsisnn/models/cifar10_fast/cifar10_fast_solver_lr2.prototxt @@ -0,0 +1,27 @@ +# 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/test.sh b/ml/cmsisnn/models/cifar10_fast/test.sh new file mode 100755 index 000000000..953f06062 --- /dev/null +++ b/ml/cmsisnn/models/cifar10_fast/test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe test \ + --model=models/cifar10_fast/cifar10_fast_train_test.prototxt \ + --weights=models/cifar10_fast/cifar10_fast_iter_70000.caffemodel.h5 $@ diff --git a/ml/cmsisnn/models/cifar10_fast/train.sh b/ml/cmsisnn/models/cifar10_fast/train.sh new file mode 100755 index 000000000..f3508aa73 --- /dev/null +++ b/ml/cmsisnn/models/cifar10_fast/train.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe train \ + --solver=models/cifar10_fast/cifar10_fast_solver.prototxt $@ + +# 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 $@ + +# 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 $@ diff --git a/ml/cmsisnn/models/lenet/lenet.network b/ml/cmsisnn/models/lenet/lenet.network index 46f490e37..fb914d3fb 100644 Binary files a/ml/cmsisnn/models/lenet/lenet.network and b/ml/cmsisnn/models/lenet/lenet.network differ diff --git a/ml/cmsisnn/models/lenet/lenet_iter_10000.caffemodel b/ml/cmsisnn/models/lenet/lenet_iter_10000.caffemodel deleted file mode 100644 index 8ce621844..000000000 Binary files a/ml/cmsisnn/models/lenet/lenet_iter_10000.caffemodel and /dev/null differ diff --git a/ml/cmsisnn/models/lenet/lenet_solver.prototxt b/ml/cmsisnn/models/lenet/lenet_solver.prototxt new file mode 100644 index 000000000..0a6587c24 --- /dev/null +++ b/ml/cmsisnn/models/lenet/lenet_solver.prototxt @@ -0,0 +1,25 @@ +# The train/test net protocol buffer definition +net: "models/lenet/lenet_train_test.prototxt" +# test_iter specifies how many forward passes the test should carry out. +# In the case of MNIST, we have test batch size 100 and 100 test iterations, +# covering the full 10,000 testing images. +test_iter: 100 +# Carry out testing every 500 training iterations. +test_interval: 500 +# The base learning rate, momentum and the weight decay of the network. +base_lr: 0.01 +momentum: 0.9 +weight_decay: 0.0005 +# The learning rate policy +lr_policy: "inv" +gamma: 0.0001 +power: 0.75 +# Display every 100 iterations +display: 100 +# The maximum number of iterations +max_iter: 10000 +# snapshot intermediate results +snapshot: 5000 +snapshot_prefix: "models/lenet/lenet" +# solver mode: CPU or GPU +solver_mode: GPU diff --git a/ml/cmsisnn/models/lenet/lenet_train_test.prototxt b/ml/cmsisnn/models/lenet/lenet_train_test.prototxt index 7ea5f40f6..ba77248d0 100644 --- a/ml/cmsisnn/models/lenet/lenet_train_test.prototxt +++ b/ml/cmsisnn/models/lenet/lenet_train_test.prototxt @@ -7,6 +7,9 @@ layer { include { phase: TRAIN } + transform_param { + scale: 0.00390625 + } data_param { source: "caffe/examples/mnist/mnist_train_lmdb" batch_size: 64 diff --git a/ml/cmsisnn/models/lenet/test.sh b/ml/cmsisnn/models/lenet/test.sh new file mode 100755 index 000000000..b7102c97e --- /dev/null +++ b/ml/cmsisnn/models/lenet/test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe test \ + --model=models/lenet/lenet_train_test.prototxt \ + --weights=models/lenet/lenet_iter_10000.caffemodel $@ diff --git a/ml/cmsisnn/models/lenet/train.sh b/ml/cmsisnn/models/lenet/train.sh new file mode 100755 index 000000000..8af4b0fe2 --- /dev/null +++ b/ml/cmsisnn/models/lenet/train.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe train \ + --solver=models/lenet/lenet_solver.prototxt $@ diff --git a/ml/cmsisnn/models/smile/smile.network b/ml/cmsisnn/models/smile/smile.network index bc1baf73f..09b8b74a7 100644 Binary files a/ml/cmsisnn/models/smile/smile.network and b/ml/cmsisnn/models/smile/smile.network differ diff --git a/ml/cmsisnn/models/smile/smile_iter_200000.caffemodel b/ml/cmsisnn/models/smile/smile_iter_200000.caffemodel deleted file mode 100644 index 5bb3ddeb2..000000000 Binary files a/ml/cmsisnn/models/smile/smile_iter_200000.caffemodel and /dev/null differ diff --git a/ml/cmsisnn/models/smile/smile_solver.prototxt b/ml/cmsisnn/models/smile/smile_solver.prototxt new file mode 100644 index 000000000..e12d64a29 --- /dev/null +++ b/ml/cmsisnn/models/smile/smile_solver.prototxt @@ -0,0 +1,23 @@ +# The train/test net protocol buffer definition +net: "models/smile/smile_train_test.prototxt" +# test_iter specifies how many forward passes the test should carry out. +test_iter: 100 +# Carry out testing every 500 training iterations. +test_interval: 500 +# The base learning rate, momentum and the weight decay of the network. +base_lr: 0.01 +momentum: 0.9 +weight_decay: 0.0005 +# The learning rate policy +lr_policy: "inv" +gamma: 0.0001 +power: 0.75 +# Display every 100 iterations +display: 100 +# The maximum number of iterations +max_iter: 10000 +# snapshot intermediate results +snapshot: 5000 +snapshot_prefix: "models/smile/smile" +# solver mode: CPU or GPU +solver_mode: GPU diff --git a/ml/cmsisnn/models/smile/test.sh b/ml/cmsisnn/models/smile/test.sh new file mode 100755 index 000000000..69091c5a0 --- /dev/null +++ b/ml/cmsisnn/models/smile/test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe test \ + --model=models/smile/smile_train_test.prototxt \ + --weights=models/smile/smile_iter_10000.caffemodel $@ diff --git a/ml/cmsisnn/models/smile/train.sh b/ml/cmsisnn/models/smile/train.sh new file mode 100755 index 000000000..4f69ddb14 --- /dev/null +++ b/ml/cmsisnn/models/smile/train.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh +set -e + +TOOLS=./caffe/build/tools + +$TOOLS/caffe train \ + --solver=models/smile/smile_solver.prototxt $@