Draft CIFAR-10 doc and cleanup example
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Tue, 18 Mar 2014 06:04:17 +0000 (23:04 -0700)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Tue, 18 Mar 2014 06:10:45 +0000 (23:10 -0700)
This is a work-in-progress. A full tutorial should be written up at
some point.

19 files changed:
docs/cifar10.md [new file with mode: 0644]
examples/cifar/TODO.md [deleted file]
examples/cifar/train_18pct.sh [deleted file]
examples/cifar/train_80sec.sh [deleted file]
examples/cifar10/cifar10_full.prototxt [new file with mode: 0644]
examples/cifar10/cifar10_full_solver.prototxt [moved from examples/cifar/cifar10_18pct_solver.prototxt with 88% similarity]
examples/cifar10/cifar10_full_solver_lr1.prototxt [moved from examples/cifar/cifar10_18pct_solver_lr1.prototxt with 88% similarity]
examples/cifar10/cifar10_full_solver_lr2.prototxt [moved from examples/cifar/cifar10_18pct_solver_lr2.prototxt with 88% similarity]
examples/cifar10/cifar10_full_test.prototxt [moved from examples/cifar/cifar10_18pct_test.prototxt with 92% similarity]
examples/cifar10/cifar10_full_train.prototxt [moved from examples/cifar/cifar10_18pct_train.prototxt with 92% similarity]
examples/cifar10/cifar10_quick.prototxt [new file with mode: 0644]
examples/cifar10/cifar10_quick_solver.prototxt [moved from examples/cifar/cifar10_80sec_solver.prototxt with 87% similarity]
examples/cifar10/cifar10_quick_solver_lr1.prototxt [moved from examples/cifar/cifar10_80sec_solver_lr1.prototxt with 87% similarity]
examples/cifar10/cifar10_quick_test.prototxt [moved from examples/cifar/cifar10_80sec_test.prototxt with 91% similarity]
examples/cifar10/cifar10_quick_train.prototxt [moved from examples/cifar/cifar10_80sec_train.prototxt with 91% similarity]
examples/cifar10/convert_cifar_data.cpp [moved from examples/cifar/convert_cifar_data.cpp with 100% similarity]
examples/cifar10/create_cifar10.sh [moved from examples/cifar/create_cifar10.sh with 100% similarity]
examples/cifar10/train_full.sh [new file with mode: 0755]
examples/cifar10/train_quick.sh [new file with mode: 0755]

diff --git a/docs/cifar10.md b/docs/cifar10.md
new file mode 100644 (file)
index 0000000..eb45e64
--- /dev/null
@@ -0,0 +1,95 @@
+---
+layout: default
+title: Caffe
+---
+
+Alex's CIFAR-10 tutorial, Caffe style
+=====================================
+
+Alex Krizhevsky's [cuda-convnet](https://code.google.com/p/cuda-convnet/) details the model definitions, parameters, and training procedure for good performance on CIFAR-10. This example reproduces his results in Caffe.
+
+We will assume that you have Caffe successfully compiled. If not, please refer to the [Installation page](installation.html). In this tutorial, we will assume that your caffe installation is located at `CAFFE_ROOT`.
+
+We thank @chyojn for the pull request that defined the model schemas and solver configurations.
+
+*This example is a work-in-progress. It would be nice to further explain details of the network and training choices and benchmark the full training.*
+
+Prepare the Dataset
+-------------------
+
+You will first need to download and convert the data format from the [CIFAR-10 website](http://www.cs.toronto.edu/~kriz/cifar.html). To do this, simply run the following commands:
+
+    cd $CAFFE_ROOT/data/cifar10
+    ./get_cifar10.sh
+    cd $CAFFE_ROOT/examples/cifar10
+    ./create_cifar10.sh
+
+If it complains that `wget` or `gunzip` are not installed, you need to install them respectively. After running the script there should be the dataset, `./cifar10-leveldb`, and the data set image mean `./mean.binaryproto`.
+
+The Model
+---------
+
+The CIFAR-10 model is a CNN that composes layers of convolution, pooling, rectified linear unit (ReLU) nonlinearities, and local contrast normalization with a linear classifier on top of it all. We have defined the model in the `CAFFE_ROOT/examples/cifar10` directory's `cifar10_quick_train.prototxt`.
+
+Training and Testing the "Quick" Model
+--------------------------------------
+
+Training the model is simple after you have written the network definition protobuf and solver protobuf files. Simply run `train_quick.sh`, or the following command directly:
+
+    cd $CAFFE_ROOT/examples/cifar10
+    ./train_quick.sh
+
+`train_quick.sh` is a simple script, so have a look inside. `GLOG_logtostderr=1` is the google logging flag that prints all the logging messages directly to stderr. The main tool for training is `train_net.bin`, with the solver protobuf text file as its argument.
+
+When you run the code, you will see a lot of messages flying by like this:
+
+    I0317 21:52:48.945710 2008298256 net.cpp:74] Creating Layer conv1
+    I0317 21:52:48.945716 2008298256 net.cpp:84] conv1 <- data
+    I0317 21:52:48.945725 2008298256 net.cpp:110] conv1 -> conv1
+    I0317 21:52:49.298691 2008298256 net.cpp:125] Top shape: 100 32 32 32 (3276800)
+    I0317 21:52:49.298719 2008298256 net.cpp:151] conv1 needs backward computation.
+
+These messages tell you the details about each layer, its connections and its output shape, which may be helpful in debugging. After the initialization, the training will start:
+
+    I0317 21:52:49.309370 2008298256 net.cpp:166] Network initialization done.
+    I0317 21:52:49.309376 2008298256 net.cpp:167] Memory required for Data 23790808
+    I0317 21:52:49.309422 2008298256 solver.cpp:36] Solver scaffolding done.
+    I0317 21:52:49.309447 2008298256 solver.cpp:47] Solving CIFAR10_quick_train
+
+Based on the solver setting, we will print the training loss function every 100 iterations, and test the network every 500 iterations. You will see messages like this:
+
+    I0317 21:53:12.179772 2008298256 solver.cpp:208] Iteration 100, lr = 0.001
+    I0317 21:53:12.185698 2008298256 solver.cpp:65] Iteration 100, loss = 1.73643
+    ...
+    I0317 21:54:41.150030 2008298256 solver.cpp:87] Iteration 500, Testing net
+    I0317 21:54:47.129461 2008298256 solver.cpp:114] Test score #0: 0.5504
+    I0317 21:54:47.129500 2008298256 solver.cpp:114] Test score #1: 1.27805
+
+For each training iteration, `lr` is the learning rate of that iteration, and `loss` is the training function. For the output of the testing phase, **score 0 is the accuracy**, and **score 1 is the testing loss function**.
+
+And after making yourself a cup of coffee, you are done!
+
+    I0317 22:12:19.666914 2008298256 solver.cpp:87] Iteration 5000, Testing net
+    I0317 22:12:25.580330 2008298256 solver.cpp:114] Test score #0: 0.7533
+    I0317 22:12:25.580379 2008298256 solver.cpp:114] Test score #1: 0.739837
+    I0317 22:12:25.587262 2008298256 solver.cpp:130] Snapshotting to cifar10_quick_iter_5000
+    I0317 22:12:25.590215 2008298256 solver.cpp:137] Snapshotting solver state to cifar10_quick_iter_5000.solverstate
+    I0317 22:12:25.592813 2008298256 solver.cpp:81] Optimization Done.
+
+Our model achieved ~75% test accuracy. The model parameters are stored in binary protobuf format in
+
+    cifar10_quick_iter_5000
+
+which is ready-to-deploy in CPU or GPU mode! Refer to the `CAFFE_ROOT/examples/cifar10/cifar10_quick.prototxt` for the deployment model definition that can be called on new data.
+
+Why train on a GPU?
+-------------------
+
+CIFAR-10, while still small, has enough data to make GPU training attractive.
+
+To compare CPU vs. GPU training speed, simply change one line in all the `cifar*solver.prototxt`:
+
+    # solver mode: 0 for CPU and 1 for GPU
+    solver_mode: 0
+
+and you will be using CPU for training.
diff --git a/examples/cifar/TODO.md b/examples/cifar/TODO.md
deleted file mode 100644 (file)
index 5e8dd27..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# CIFAR-10
-
-Contributing a CIFAR-10 example would be welcome! A benchmark against
-cuda-convnet could be interesting too.
diff --git a/examples/cifar/train_18pct.sh b/examples/cifar/train_18pct.sh
deleted file mode 100755 (executable)
index 6a562ec..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env sh
-
-TOOLS=../../build/tools
-
-GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_18pct_solver.prototxt
-
-#reduce learning rate by factor of 10
-GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_18pct_solver_lr1.prototxt cifar10_18pct_iter_60000.solverstate
-
-#reduce learning rate by factor of 10
-GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_18pct_solver_lr2.prototxt cifar10_18pct_iter_65000.solverstate
diff --git a/examples/cifar/train_80sec.sh b/examples/cifar/train_80sec.sh
deleted file mode 100755 (executable)
index a55a870..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env sh
-
-TOOLS=../../build/tools
-
-GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_80sec_solver.prototxt
-
-#reduce learning rate by fctor of 10 after 8 epochs
-GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_80sec_solver_lr1.prototxt cifar10_80sec_iter_4000.solverstate
diff --git a/examples/cifar10/cifar10_full.prototxt b/examples/cifar10/cifar10_full.prototxt
new file mode 100644 (file)
index 0000000..64fb2a8
--- /dev/null
@@ -0,0 +1,153 @@
+name: "CIFAR10_full_deploy"
+# N.B. input image must be in CIFAR-10 format
+# as described at http://www.cs.toronto.edu/~kriz/cifar.html
+input: "data"
+input_dim: 1
+input_dim: 3
+input_dim: 32
+input_dim: 32
+# ------------------------ layer 1 -----------------------------
+layers {
+ layer {
+   name: "conv1"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "data"
+ top: "conv1"
+}
+layers {
+ layer {
+   name: "pool1"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: MAX
+ }
+ bottom: "conv1"
+ top: "pool1"
+}
+layers {
+ layer {
+   name: "relu1"
+   type: "relu"
+ }
+ bottom: "pool1"
+ top: "pool1"
+}
+layers {
+  layer {
+    name: "norm1"
+    type: "lrn"
+    local_size: 3
+    alpha: 0.00005
+    beta: 0.75
+  }
+  bottom: "pool1"
+  top: "norm1"
+}
+# --------------------------- layer 2 ------------------------
+layers {
+ layer {
+   name: "conv2"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   blobs_lr: 1.
+   blobs_lr: 2.
+ }
+ bottom: "norm1"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "relu2"
+   type: "relu"
+ }
+ bottom: "conv2"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "pool2"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv2"
+ top: "pool2"
+}
+layers {
+  layer {
+    name: "norm2"
+    type: "lrn"
+    local_size: 3
+    alpha: 0.00005
+    beta: 0.75
+  }
+  bottom: "pool2"
+  top: "norm2"
+}
+#-----------------------layer 3-------------------------
+layers {
+ layer {
+   name: "conv3"
+   type: "conv"
+   num_output: 64
+   kernelsize: 5
+   pad: 2
+   stride: 1
+ }
+ bottom: "norm2"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "relu3"
+   type: "relu"
+ }
+ bottom: "conv3"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "pool3"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv3"
+ top: "pool3"
+}
+#--------------------------layer 4------------------------
+layers {
+ layer {
+   name: "ip1"
+   type: "innerproduct"
+   num_output: 10
+   blobs_lr: 1.
+   blobs_lr: 2.
+   weight_decay: 250.
+   weight_decay: 0.
+ }
+ bottom: "pool3"
+ top: "ip1"
+}
+#-----------------------output------------------------
+layers {
+ layer {
+   name: "prob"
+   type: "softmax"
+ }
+ bottom: "ip1"
+ top: "prob"
+}
similarity index 88%
rename from examples/cifar/cifar10_18pct_solver.prototxt
rename to examples/cifar10/cifar10_full_solver.prototxt
index 667445b..b985b65 100644 (file)
@@ -2,9 +2,9 @@
 # then another factor of 10 after 10 more epochs (5000 iters)
 
 # The training protocol buffer definition
-train_net: "cifar10_18pct_train.prototxt"
+train_net: "cifar10_full_train.prototxt"
 # The testing protocol buffer definition
-test_net: "cifar10_18pct_test.prototxt"
+test_net: "cifar10_full_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.
@@ -23,6 +23,6 @@ display: 200
 max_iter: 60000
 # snapshot intermediate results
 snapshot: 10000
-snapshot_prefix: "cifar10_18pct"
+snapshot_prefix: "cifar10_full"
 # solver mode: 0 for CPU and 1 for GPU
 solver_mode: 1
@@ -2,9 +2,9 @@
 # then another factor of 10 after 10 more epochs (5000 iters)
 
 # The training protocol buffer definition
-train_net: "cifar10_18pct_train.prototxt"
+train_net: "cifar10_full_train.prototxt"
 # The testing protocol buffer definition
-test_net: "cifar10_18pct_test.prototxt"
+test_net: "cifar10_full_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.
@@ -23,6 +23,6 @@ display: 200
 max_iter: 65000
 # snapshot intermediate results
 snapshot: 5000
-snapshot_prefix: "cifar10_18pct"
+snapshot_prefix: "cifar10_full"
 # solver mode: 0 for CPU and 1 for GPU
 solver_mode: 1
@@ -2,9 +2,9 @@
 # then another factor of 10 after 10 more epochs (5000 iters)
 
 # The training protocol buffer definition
-train_net: "cifar10_18pct_train.prototxt"
+train_net: "cifar10_full_train.prototxt"
 # The testing protocol buffer definition
-test_net: "cifar10_18pct_test.prototxt"
+test_net: "cifar10_full_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.
@@ -23,6 +23,6 @@ display: 200
 max_iter: 70000
 # snapshot intermediate results
 snapshot: 5000
-snapshot_prefix: "cifar10_18pct"
+snapshot_prefix: "cifar10_full"
 # solver mode: 0 for CPU and 1 for GPU
 solver_mode: 1
similarity index 92%
rename from examples/cifar/cifar10_18pct_test.prototxt
rename to examples/cifar10/cifar10_full_test.prototxt
index 8b6c0ff..a77c7d2 100644 (file)
-name: "CIFAR10_18pct_test"\r
-layers {\r
- layer {\r
-   name: "cifar"\r
-   type: "data"\r
-   source: "cifar10-leveldb/cifar-test-leveldb"\r
-   meanfile: "mean.binaryproto"\r
-   batchsize: 100\r
- }\r
- top: "data"\r
- top: "label"\r
-}\r
-# ------------------------ layer 1 -----------------------------\r
-layers {\r
- layer {\r
-   name: "conv1"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.0001\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.\r
-   blobs_lr: 2.\r
- }\r
- bottom: "data"\r
- top: "conv1"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool1"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: MAX\r
- }\r
- bottom: "conv1"\r
- top: "pool1"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu1"\r
-   type: "relu"\r
- }\r
- bottom: "pool1"\r
- top: "pool1"\r
-}\r
-layers {\r
-  layer {\r
-    name: "norm1"\r
-    type: "lrn"\r
-    local_size: 3\r
-    alpha: 0.00005\r
-    beta: 0.75\r
-  }\r
-  bottom: "pool1"\r
-  top: "norm1"\r
-}\r
-# --------------------------- layer 2 ------------------------\r
-layers {\r
- layer {\r
-   name: "conv2"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.\r
-   blobs_lr: 2.\r
- }\r
- bottom: "norm1"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu2"\r
-   type: "relu"\r
- }\r
- bottom: "conv2"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool2"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv2"\r
- top: "pool2"\r
-}\r
-layers {\r
-  layer {\r
-    name: "norm2"\r
-    type: "lrn"\r
-    local_size: 3\r
-    alpha: 0.00005\r
-    beta: 0.75\r
-  }\r
-  bottom: "pool2"\r
-  top: "norm2"\r
-}\r
-#-----------------------layer 3-------------------------\r
-layers {\r
- layer {\r
-   name: "conv3"\r
-   type: "conv"\r
-   num_output: 64\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
- }\r
- bottom: "norm2"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu3"\r
-   type: "relu"\r
- }\r
- bottom: "conv3"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool3"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv3"\r
- top: "pool3"\r
-}\r
-#--------------------------layer 4------------------------\r
-layers {\r
- layer {\r
-   name: "ip1"\r
-   type: "innerproduct"\r
-   num_output: 10\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.\r
-   blobs_lr: 2.\r
-   weight_decay: 250.\r
-   weight_decay: 0.\r
- }\r
- bottom: "pool3"\r
- top: "ip1"\r
-}\r
-#-----------------------output------------------------\r
-layers {\r
- layer {\r
-   name: "prob"\r
-   type: "softmax"\r
- }\r
- bottom: "ip1"\r
- top: "prob"\r
-}\r
-layers {\r
-  layer {\r
-    name: "accuracy"\r
-    type: "accuracy"\r
-  }\r
-  bottom: "prob"\r
-  bottom: "label"\r
-  top: "accuracy"\r
-}\r
+name: "CIFAR10_full_test"
+layers {
+ layer {
+   name: "cifar"
+   type: "data"
+   source: "cifar10-leveldb/cifar-test-leveldb"
+   meanfile: "mean.binaryproto"
+   batchsize: 100
+ }
+ top: "data"
+ top: "label"
+}
+# ------------------------ layer 1 -----------------------------
+layers {
+ layer {
+   name: "conv1"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.0001
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.
+   blobs_lr: 2.
+ }
+ bottom: "data"
+ top: "conv1"
+}
+layers {
+ layer {
+   name: "pool1"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: MAX
+ }
+ bottom: "conv1"
+ top: "pool1"
+}
+layers {
+ layer {
+   name: "relu1"
+   type: "relu"
+ }
+ bottom: "pool1"
+ top: "pool1"
+}
+layers {
+  layer {
+    name: "norm1"
+    type: "lrn"
+    local_size: 3
+    alpha: 0.00005
+    beta: 0.75
+  }
+  bottom: "pool1"
+  top: "norm1"
+}
+# --------------------------- layer 2 ------------------------
+layers {
+ layer {
+   name: "conv2"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.
+   blobs_lr: 2.
+ }
+ bottom: "norm1"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "relu2"
+   type: "relu"
+ }
+ bottom: "conv2"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "pool2"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv2"
+ top: "pool2"
+}
+layers {
+  layer {
+    name: "norm2"
+    type: "lrn"
+    local_size: 3
+    alpha: 0.00005
+    beta: 0.75
+  }
+  bottom: "pool2"
+  top: "norm2"
+}
+#-----------------------layer 3-------------------------
+layers {
+ layer {
+   name: "conv3"
+   type: "conv"
+   num_output: 64
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+ }
+ bottom: "norm2"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "relu3"
+   type: "relu"
+ }
+ bottom: "conv3"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "pool3"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv3"
+ top: "pool3"
+}
+#--------------------------layer 4------------------------
+layers {
+ layer {
+   name: "ip1"
+   type: "innerproduct"
+   num_output: 10
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.
+   blobs_lr: 2.
+   weight_decay: 250.
+   weight_decay: 0.
+ }
+ bottom: "pool3"
+ top: "ip1"
+}
+#-----------------------output------------------------
+layers {
+ layer {
+   name: "prob"
+   type: "softmax"
+ }
+ bottom: "ip1"
+ top: "prob"
+}
+layers {
+  layer {
+    name: "accuracy"
+    type: "accuracy"
+  }
+  bottom: "prob"
+  bottom: "label"
+  top: "accuracy"
+}
similarity index 92%
rename from examples/cifar/cifar10_18pct_train.prototxt
rename to examples/cifar10/cifar10_full_train.prototxt
index d185f53..28e4612 100644 (file)
-name: "CIFAR10_18pct_train"\r
-layers {\r
- layer {\r
-   name: "cifar"\r
-   type: "data"\r
-   source: "cifar10-leveldb/cifar-train-leveldb"\r
-   meanfile: "mean.binaryproto"\r
-   batchsize: 100\r
- }\r
- top: "data"\r
- top: "label"\r
-}\r
-# ------------------------ layer 1 -----------------------------\r
-layers {\r
- layer {\r
-   name: "conv1"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.0001\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.\r
-   blobs_lr: 2.\r
- }\r
- bottom: "data"\r
- top: "conv1"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool1"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: MAX\r
- }\r
- bottom: "conv1"\r
- top: "pool1"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu1"\r
-   type: "relu"\r
- }\r
- bottom: "pool1"\r
- top: "pool1"\r
-}\r
-layers {\r
-  layer {\r
-    name: "norm1"\r
-    type: "lrn"\r
-    local_size: 3\r
-    alpha: 0.00005\r
-    beta: 0.75\r
-  }\r
-  bottom: "pool1"\r
-  top: "norm1"\r
-}\r
-# --------------------------- layer 2 ------------------------\r
-layers {\r
- layer {\r
-   name: "conv2"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.\r
-   blobs_lr: 2.\r
- }\r
- bottom: "norm1"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu2"\r
-   type: "relu"\r
- }\r
- bottom: "conv2"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool2"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv2"\r
- top: "pool2"\r
-}\r
-layers {\r
-  layer {\r
-    name: "norm2"\r
-    type: "lrn"\r
-    local_size: 3\r
-    alpha: 0.00005\r
-    beta: 0.75\r
-  }\r
-  bottom: "pool2"\r
-  top: "norm2"\r
-}\r
-#-----------------------layer 3-------------------------\r
-layers {\r
- layer {\r
-   name: "conv3"\r
-   type: "conv"\r
-   num_output: 64\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
- }\r
- bottom: "norm2"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu3"\r
-   type: "relu"\r
- }\r
- bottom: "conv3"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool3"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv3"\r
- top: "pool3"\r
-}\r
-#--------------------------layer 4------------------------\r
-layers {\r
- layer {\r
-   name: "ip1"\r
-   type: "innerproduct"\r
-   num_output: 10\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.\r
-   blobs_lr: 2.\r
-   weight_decay: 250.\r
-   weight_decay: 0.\r
- }\r
- bottom: "pool3"\r
- top: "ip1"\r
-}\r
-#-----------------------output------------------------\r
-layers {\r
- layer {\r
-   name: "loss"\r
-   type: "softmax_loss"\r
- }\r
- bottom: "ip1"\r
- bottom: "label"\r
-}\r
+name: "CIFAR10_full_train"
+layers {
+ layer {
+   name: "cifar"
+   type: "data"
+   source: "cifar10-leveldb/cifar-train-leveldb"
+   meanfile: "mean.binaryproto"
+   batchsize: 100
+ }
+ top: "data"
+ top: "label"
+}
+# ------------------------ layer 1 -----------------------------
+layers {
+ layer {
+   name: "conv1"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.0001
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.
+   blobs_lr: 2.
+ }
+ bottom: "data"
+ top: "conv1"
+}
+layers {
+ layer {
+   name: "pool1"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: MAX
+ }
+ bottom: "conv1"
+ top: "pool1"
+}
+layers {
+ layer {
+   name: "relu1"
+   type: "relu"
+ }
+ bottom: "pool1"
+ top: "pool1"
+}
+layers {
+  layer {
+    name: "norm1"
+    type: "lrn"
+    local_size: 3
+    alpha: 0.00005
+    beta: 0.75
+  }
+  bottom: "pool1"
+  top: "norm1"
+}
+# --------------------------- layer 2 ------------------------
+layers {
+ layer {
+   name: "conv2"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.
+   blobs_lr: 2.
+ }
+ bottom: "norm1"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "relu2"
+   type: "relu"
+ }
+ bottom: "conv2"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "pool2"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv2"
+ top: "pool2"
+}
+layers {
+  layer {
+    name: "norm2"
+    type: "lrn"
+    local_size: 3
+    alpha: 0.00005
+    beta: 0.75
+  }
+  bottom: "pool2"
+  top: "norm2"
+}
+#-----------------------layer 3-------------------------
+layers {
+ layer {
+   name: "conv3"
+   type: "conv"
+   num_output: 64
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+ }
+ bottom: "norm2"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "relu3"
+   type: "relu"
+ }
+ bottom: "conv3"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "pool3"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv3"
+ top: "pool3"
+}
+#--------------------------layer 4------------------------
+layers {
+ layer {
+   name: "ip1"
+   type: "innerproduct"
+   num_output: 10
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.
+   blobs_lr: 2.
+   weight_decay: 250.
+   weight_decay: 0.
+ }
+ bottom: "pool3"
+ top: "ip1"
+}
+#-----------------------output------------------------
+layers {
+ layer {
+   name: "loss"
+   type: "softmax_loss"
+ }
+ bottom: "ip1"
+ bottom: "label"
+}
diff --git a/examples/cifar10/cifar10_quick.prototxt b/examples/cifar10/cifar10_quick.prototxt
new file mode 100644 (file)
index 0000000..6161caa
--- /dev/null
@@ -0,0 +1,143 @@
+name: "CIFAR10_quick_test"
+# N.B. input image must be in CIFAR-10 format
+# as described at http://www.cs.toronto.edu/~kriz/cifar.html
+input: "data"
+input_dim: 1
+input_dim: 3
+input_dim: 32
+input_dim: 32
+# ------------------------ layer 1 -----------------------------
+layers {
+ layer {
+   name: "conv1"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "data"
+ top: "conv1"
+}
+layers {
+ layer {
+   name: "pool1"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: MAX
+ }
+ bottom: "conv1"
+ top: "pool1"
+}
+layers {
+ layer {
+   name: "relu1"
+   type: "relu"
+ }
+ bottom: "pool1"
+ top: "pool1"
+}
+# --------------------------- layer 2 ------------------------
+layers {
+ layer {
+   name: "conv2"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool1"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "relu2"
+   type: "relu"
+ }
+ bottom: "conv2"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "pool2"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv2"
+ top: "pool2"
+}
+#-----------------------layer 3-------------------------
+layers {
+ layer {
+   name: "conv3"
+   type: "conv"
+   num_output: 64
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool2"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "relu3"
+   type: "relu"
+ }
+ bottom: "conv3"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "pool3"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv3"
+ top: "pool3"
+}
+#--------------------------layer 4------------------------
+layers {
+ layer {
+   name: "ip1"
+   type: "innerproduct"
+   num_output: 64
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool3"
+ top: "ip1"
+}
+#--------------------------layer 5------------------------
+layers {
+ layer {
+   name: "ip2"
+   type: "innerproduct"
+   num_output: 10
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "ip1"
+ top: "ip2"
+}
+#-----------------------output------------------------
+layers {
+ layer {
+   name: "prob"
+   type: "softmax"
+ }
+ bottom: "ip2"
+ top: "prob"
+}
@@ -1,9 +1,9 @@
 # reduce the learning rate after 8 epochs (4000 iters) by a factor of 10
 
 # The training protocol buffer definition
-train_net: "cifar10_80sec_train.prototxt"
+train_net: "cifar10_quick_train.prototxt"
 # The testing protocol buffer definition
-test_net: "cifar10_80sec_test.prototxt"
+test_net: "cifar10_quick_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.
@@ -22,6 +22,6 @@ display: 100
 max_iter: 4000
 # snapshot intermediate results
 snapshot: 4000
-snapshot_prefix: "cifar10_80sec"
+snapshot_prefix: "cifar10_quick"
 # solver mode: 0 for CPU and 1 for GPU
 solver_mode: 1
@@ -1,9 +1,9 @@
 # reduce the learning rate after 8 epochs (4000 iters) by a factor of 10
 
 # The training protocol buffer definition
-train_net: "cifar10_80sec_train.prototxt"
+train_net: "cifar10_quick_train.prototxt"
 # The testing protocol buffer definition
-test_net: "cifar10_80sec_test.prototxt"
+test_net: "cifar10_quick_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.
@@ -22,6 +22,6 @@ display: 100
 max_iter: 5000
 # snapshot intermediate results
 snapshot: 5000
-snapshot_prefix: "cifar10_80sec"
+snapshot_prefix: "cifar10_quick"
 # solver mode: 0 for CPU and 1 for GPU
 solver_mode: 1
similarity index 91%
rename from examples/cifar/cifar10_80sec_test.prototxt
rename to examples/cifar10/cifar10_quick_test.prototxt
index 71714da..a937df5 100644 (file)
-# 80sec config\r
-name: "CIFAR10_80sec_test"\r
-layers {\r
- layer {\r
-   name: "cifar"\r
-   type: "data"\r
-   source: "cifar10-leveldb/cifar-test-leveldb"\r
-   meanfile: "mean.binaryproto"\r
-   batchsize: 100\r
- }\r
- top: "data"\r
- top: "label"\r
-}\r
-# ------------------------ layer 1 -----------------------------\r
-layers {\r
- layer {\r
-   name: "conv1"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.0001\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "data"\r
- top: "conv1"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool1"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: MAX\r
- }\r
- bottom: "conv1"\r
- top: "pool1"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu1"\r
-   type: "relu"\r
- }\r
- bottom: "pool1"\r
- top: "pool1"\r
-}\r
-# --------------------------- layer 2 ------------------------\r
-layers {\r
- layer {\r
-   name: "conv2"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "pool1"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu2"\r
-   type: "relu"\r
- }\r
- bottom: "conv2"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool2"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv2"\r
- top: "pool2"\r
-}\r
-#-----------------------layer 3-------------------------\r
-layers {\r
- layer {\r
-   name: "conv3"\r
-   type: "conv"\r
-   num_output: 64\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "pool2"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu3"\r
-   type: "relu"\r
- }\r
- bottom: "conv3"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool3"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv3"\r
- top: "pool3"\r
-}\r
-#--------------------------layer 4------------------------\r
-layers {\r
- layer {\r
-   name: "ip1"\r
-   type: "innerproduct"\r
-   num_output: 64 \r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.1\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "pool3"\r
- top: "ip1"\r
-}\r
-#--------------------------layer 5------------------------\r
-layers {\r
- layer {\r
-   name: "ip2"\r
-   type: "innerproduct"\r
-   num_output: 10\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.1\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "ip1"\r
- top: "ip2"\r
-}\r
-#-----------------------output------------------------\r
-layers {\r
- layer {\r
-   name: "prob"\r
-   type: "softmax"\r
- }\r
- bottom: "ip2"\r
- top: "prob"\r
-}\r
-layers {\r
-  layer {\r
-    name: "accuracy"\r
-    type: "accuracy"\r
-  }\r
-  bottom: "prob"\r
-  bottom: "label"\r
-  top: "accuracy"\r
-}\r
+# quick config
+name: "CIFAR10_quick_test"
+layers {
+ layer {
+   name: "cifar"
+   type: "data"
+   source: "cifar10-leveldb/cifar-test-leveldb"
+   meanfile: "mean.binaryproto"
+   batchsize: 100
+ }
+ top: "data"
+ top: "label"
+}
+# ------------------------ layer 1 -----------------------------
+layers {
+ layer {
+   name: "conv1"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.0001
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "data"
+ top: "conv1"
+}
+layers {
+ layer {
+   name: "pool1"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: MAX
+ }
+ bottom: "conv1"
+ top: "pool1"
+}
+layers {
+ layer {
+   name: "relu1"
+   type: "relu"
+ }
+ bottom: "pool1"
+ top: "pool1"
+}
+# --------------------------- layer 2 ------------------------
+layers {
+ layer {
+   name: "conv2"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool1"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "relu2"
+   type: "relu"
+ }
+ bottom: "conv2"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "pool2"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv2"
+ top: "pool2"
+}
+#-----------------------layer 3-------------------------
+layers {
+ layer {
+   name: "conv3"
+   type: "conv"
+   num_output: 64
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool2"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "relu3"
+   type: "relu"
+ }
+ bottom: "conv3"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "pool3"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv3"
+ top: "pool3"
+}
+#--------------------------layer 4------------------------
+layers {
+ layer {
+   name: "ip1"
+   type: "innerproduct"
+   num_output: 64
+   weight_filler {
+     type: "gaussian"
+     std: 0.1
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool3"
+ top: "ip1"
+}
+#--------------------------layer 5------------------------
+layers {
+ layer {
+   name: "ip2"
+   type: "innerproduct"
+   num_output: 10
+   weight_filler {
+     type: "gaussian"
+     std: 0.1
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "ip1"
+ top: "ip2"
+}
+#-----------------------output------------------------
+layers {
+ layer {
+   name: "prob"
+   type: "softmax"
+ }
+ bottom: "ip2"
+ top: "prob"
+}
+layers {
+  layer {
+    name: "accuracy"
+    type: "accuracy"
+  }
+  bottom: "prob"
+  bottom: "label"
+  top: "accuracy"
+}
similarity index 91%
rename from examples/cifar/cifar10_80sec_train.prototxt
rename to examples/cifar10/cifar10_quick_train.prototxt
index 624d988..2d3a10a 100644 (file)
-# 80sec config\r
-name: "CIFAR10_80sec_train"\r
-layers {\r
- layer {\r
-   name: "cifar"\r
-   type: "data"\r
-   source: "cifar10-leveldb/cifar-train-leveldb"\r
-   meanfile: "mean.binaryproto"\r
-   batchsize: 100\r
- }\r
- top: "data"\r
- top: "label"\r
-}\r
-# ------------------------ layer 1 -----------------------------\r
-layers {\r
- layer {\r
-   name: "conv1"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.0001\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "data"\r
- top: "conv1"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool1"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: MAX\r
- }\r
- bottom: "conv1"\r
- top: "pool1"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu1"\r
-   type: "relu"\r
- }\r
- bottom: "pool1"\r
- top: "pool1"\r
-}\r
-# --------------------------- layer 2 ------------------------\r
-layers {\r
- layer {\r
-   name: "conv2"\r
-   type: "conv"\r
-   num_output: 32\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "pool1"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu2"\r
-   type: "relu"\r
- }\r
- bottom: "conv2"\r
- top: "conv2"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool2"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv2"\r
- top: "pool2"\r
-}\r
-#-----------------------layer 3-------------------------\r
-layers {\r
- layer {\r
-   name: "conv3"\r
-   type: "conv"\r
-   num_output: 64\r
-   kernelsize: 5\r
-   pad: 2\r
-   stride: 1\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.01\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "pool2"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "relu3"\r
-   type: "relu"\r
- }\r
- bottom: "conv3"\r
- top: "conv3"\r
-}\r
-layers {\r
- layer {\r
-   name: "pool3"\r
-   type: "pool"\r
-   kernelsize: 3\r
-   stride: 2\r
-   pool: AVE\r
- }\r
- bottom: "conv3"\r
- top: "pool3"\r
-}\r
-#--------------------------layer 4------------------------\r
-layers {\r
- layer {\r
-   name: "ip1"\r
-   type: "innerproduct"\r
-   num_output: 64 \r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.1\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "pool3"\r
- top: "ip1"\r
-}\r
-#--------------------------layer 5------------------------\r
-layers {\r
- layer {\r
-   name: "ip2"\r
-   type: "innerproduct"\r
-   num_output: 10\r
-   weight_filler {\r
-     type: "gaussian"\r
-     std: 0.1\r
-   }\r
-   bias_filler {\r
-     type: "constant"\r
-   }\r
-   blobs_lr: 1.0\r
-   blobs_lr: 2.0\r
- }\r
- bottom: "ip1"\r
- top: "ip2"\r
-}\r
-#-----------------------output------------------------\r
-layers {\r
- layer {\r
-   name: "loss"\r
-   type: "softmax_loss"\r
- }\r
- bottom: "ip2"\r
- bottom: "label"\r
-}\r
+# quick config
+name: "CIFAR10_quick_train"
+layers {
+ layer {
+   name: "cifar"
+   type: "data"
+   source: "cifar10-leveldb/cifar-train-leveldb"
+   meanfile: "mean.binaryproto"
+   batchsize: 100
+ }
+ top: "data"
+ top: "label"
+}
+# ------------------------ layer 1 -----------------------------
+layers {
+ layer {
+   name: "conv1"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.0001
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "data"
+ top: "conv1"
+}
+layers {
+ layer {
+   name: "pool1"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: MAX
+ }
+ bottom: "conv1"
+ top: "pool1"
+}
+layers {
+ layer {
+   name: "relu1"
+   type: "relu"
+ }
+ bottom: "pool1"
+ top: "pool1"
+}
+# --------------------------- layer 2 ------------------------
+layers {
+ layer {
+   name: "conv2"
+   type: "conv"
+   num_output: 32
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool1"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "relu2"
+   type: "relu"
+ }
+ bottom: "conv2"
+ top: "conv2"
+}
+layers {
+ layer {
+   name: "pool2"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv2"
+ top: "pool2"
+}
+#-----------------------layer 3-------------------------
+layers {
+ layer {
+   name: "conv3"
+   type: "conv"
+   num_output: 64
+   kernelsize: 5
+   pad: 2
+   stride: 1
+   weight_filler {
+     type: "gaussian"
+     std: 0.01
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool2"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "relu3"
+   type: "relu"
+ }
+ bottom: "conv3"
+ top: "conv3"
+}
+layers {
+ layer {
+   name: "pool3"
+   type: "pool"
+   kernelsize: 3
+   stride: 2
+   pool: AVE
+ }
+ bottom: "conv3"
+ top: "pool3"
+}
+#--------------------------layer 4------------------------
+layers {
+ layer {
+   name: "ip1"
+   type: "innerproduct"
+   num_output: 64
+   weight_filler {
+     type: "gaussian"
+     std: 0.1
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "pool3"
+ top: "ip1"
+}
+#--------------------------layer 5------------------------
+layers {
+ layer {
+   name: "ip2"
+   type: "innerproduct"
+   num_output: 10
+   weight_filler {
+     type: "gaussian"
+     std: 0.1
+   }
+   bias_filler {
+     type: "constant"
+   }
+   blobs_lr: 1.0
+   blobs_lr: 2.0
+ }
+ bottom: "ip1"
+ top: "ip2"
+}
+#-----------------------output------------------------
+layers {
+ layer {
+   name: "loss"
+   type: "softmax_loss"
+ }
+ bottom: "ip2"
+ bottom: "label"
+}
diff --git a/examples/cifar10/train_full.sh b/examples/cifar10/train_full.sh
new file mode 100755 (executable)
index 0000000..1767da6
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+TOOLS=../../build/tools
+
+GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_full_solver.prototxt
+
+#reduce learning rate by factor of 10
+GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_full_solver_lr1.prototxt cifar10_full_iter_60000.solverstate
+
+#reduce learning rate by factor of 10
+GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_full_solver_lr2.prototxt cifar10_full_iter_65000.solverstate
diff --git a/examples/cifar10/train_quick.sh b/examples/cifar10/train_quick.sh
new file mode 100755 (executable)
index 0000000..1d954b5
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env sh
+
+TOOLS=../../build/tools
+
+GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_quick_solver.prototxt
+
+#reduce learning rate by fctor of 10 after 8 epochs
+GLOG_logtostderr=1 $TOOLS/train_net.bin cifar10_quick_solver_lr1.prototxt cifar10_quick_iter_4000.solverstate