Use unified train/test nets in examples.

This commit is contained in:
Jeff Donahue 2014-07-18 15:07:13 -07:00
Родитель cb4555c052
Коммит e526e2ddd7
24 изменённых файлов: 177 добавлений и 1331 удалений

Просмотреть файл

@ -1,10 +1,8 @@
# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10
# then another factor of 10 after 10 more epochs (5000 iters)
# The training protocol buffer definition
train_net: "cifar10_full_train.prototxt"
# The testing protocol buffer definition
test_net: "cifar10_full_test.prototxt"
# The train/test net protocol buffer definition
net: "cifar10_full_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.

Просмотреть файл

@ -1,10 +1,8 @@
# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10
# then another factor of 10 after 10 more epochs (5000 iters)
# The training protocol buffer definition
train_net: "cifar10_full_train.prototxt"
# The testing protocol buffer definition
test_net: "cifar10_full_test.prototxt"
# The train/test net protocol buffer definition
net: "cifar10_full_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.

Просмотреть файл

@ -1,10 +1,8 @@
# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10
# then another factor of 10 after 10 more epochs (5000 iters)
# The training protocol buffer definition
train_net: "cifar10_full_train.prototxt"
# The testing protocol buffer definition
test_net: "cifar10_full_test.prototxt"
# The train/test net protocol buffer definition
net: "cifar10_full_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.

Просмотреть файл

@ -1,174 +0,0 @@
name: "CIFAR10_full_train"
layers {
name: "cifar"
type: DATA
top: "data"
top: "label"
data_param {
source: "cifar10-leveldb/cifar-train-leveldb"
mean_file: "mean.binaryproto"
batch_size: 100
}
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.0001
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool1"
type: POOLING
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layers {
name: "relu1"
type: RELU
bottom: "pool1"
top: "pool1"
}
layers {
name: "norm1"
type: LRN
bottom: "pool1"
top: "norm1"
lrn_param {
norm_region: WITHIN_CHANNEL
local_size: 3
alpha: 5e-05
beta: 0.75
}
}
layers {
name: "conv2"
type: CONVOLUTION
bottom: "norm1"
top: "conv2"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu2"
type: RELU
bottom: "conv2"
top: "conv2"
}
layers {
name: "pool2"
type: POOLING
bottom: "conv2"
top: "pool2"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layers {
name: "norm2"
type: LRN
bottom: "pool2"
top: "norm2"
lrn_param {
norm_region: WITHIN_CHANNEL
local_size: 3
alpha: 5e-05
beta: 0.75
}
}
layers {
name: "conv3"
type: CONVOLUTION
bottom: "norm2"
top: "conv3"
convolution_param {
num_output: 64
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu3"
type: RELU
bottom: "conv3"
top: "conv3"
}
layers {
name: "pool3"
type: POOLING
bottom: "conv3"
top: "pool3"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layers {
name: "ip1"
type: INNER_PRODUCT
bottom: "pool3"
top: "ip1"
blobs_lr: 1
blobs_lr: 2
weight_decay: 250
weight_decay: 0
inner_product_param {
num_output: 10
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "ip1"
bottom: "label"
}

Просмотреть файл

@ -1,4 +1,16 @@
name: "CIFAR10_full_test"
name: "CIFAR10_full"
layers {
name: "cifar"
type: DATA
top: "data"
top: "label"
data_param {
source: "cifar10-leveldb/cifar-train-leveldb"
mean_file: "mean.binaryproto"
batch_size: 100
}
include: { phase: TRAIN }
}
layers {
name: "cifar"
type: DATA
@ -9,6 +21,7 @@ layers {
mean_file: "mean.binaryproto"
batch_size: 100
}
include: { phase: TEST }
}
layers {
name: "conv1"
@ -172,6 +185,7 @@ layers {
bottom: "ip1"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}
layers {
name: "loss"

Просмотреть файл

@ -1,9 +1,7 @@
# reduce the learning rate after 8 epochs (4000 iters) by a factor of 10
# The training protocol buffer definition
train_net: "cifar10_quick_train.prototxt"
# The testing protocol buffer definition
test_net: "cifar10_quick_test.prototxt"
# The train/test net protocol buffer definition
net: "cifar10_quick_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.

Просмотреть файл

@ -1,9 +1,7 @@
# reduce the learning rate after 8 epochs (4000 iters) by a factor of 10
# The training protocol buffer definition
train_net: "cifar10_quick_train.prototxt"
# The testing protocol buffer definition
test_net: "cifar10_quick_test.prototxt"
# The train/test net protocol buffer definition
net: "cifar10_quick_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.

Просмотреть файл

@ -1,168 +0,0 @@
name: "CIFAR10_quick_train"
layers {
name: "cifar"
type: DATA
top: "data"
top: "label"
data_param {
source: "cifar10-leveldb/cifar-train-leveldb"
mean_file: "mean.binaryproto"
batch_size: 100
}
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.0001
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool1"
type: POOLING
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layers {
name: "relu1"
type: RELU
bottom: "pool1"
top: "pool1"
}
layers {
name: "conv2"
type: CONVOLUTION
bottom: "pool1"
top: "conv2"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu2"
type: RELU
bottom: "conv2"
top: "conv2"
}
layers {
name: "pool2"
type: POOLING
bottom: "conv2"
top: "pool2"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layers {
name: "conv3"
type: CONVOLUTION
bottom: "pool2"
top: "conv3"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 64
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu3"
type: RELU
bottom: "conv3"
top: "conv3"
}
layers {
name: "pool3"
type: POOLING
bottom: "conv3"
top: "pool3"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layers {
name: "ip1"
type: INNER_PRODUCT
bottom: "pool3"
top: "ip1"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 64
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "ip2"
type: INNER_PRODUCT
bottom: "ip1"
top: "ip2"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 10
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "ip2"
bottom: "label"
}

Просмотреть файл

@ -1,4 +1,16 @@
name: "CIFAR10_quick_test"
name: "CIFAR10_quick"
layers {
name: "cifar"
type: DATA
top: "data"
top: "label"
data_param {
source: "cifar10-leveldb/cifar-train-leveldb"
mean_file: "mean.binaryproto"
batch_size: 100
}
include: { phase: TRAIN }
}
layers {
name: "cifar"
type: DATA
@ -9,6 +21,7 @@ layers {
mean_file: "mean.binaryproto"
batch_size: 100
}
include: { phase: TEST }
}
layers {
name: "conv1"
@ -166,6 +179,7 @@ layers {
bottom: "ip2"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}
layers {
name: "loss"

Просмотреть файл

@ -1,5 +1,4 @@
train_net: "alexnet_train.prototxt"
test_net: "alexnet_val.prototxt"
net: "alexnet_train_val.prototxt"
test_iter: 1000
test_interval: 1000
base_lr: 0.01

Просмотреть файл

@ -2,6 +2,8 @@ name: "AlexNet"
layers {
name: "data"
type: DATA
top: "data"
top: "label"
data_param {
source: "ilsvrc12_train_leveldb"
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
@ -9,8 +11,21 @@ layers {
crop_size: 227
mirror: true
}
include: { phase: TRAIN }
}
layers {
name: "data"
type: DATA
top: "data"
top: "label"
data_param {
source: "ilsvrc12_val_leveldb"
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
batch_size: 50
crop_size: 227
mirror: false
}
include: { phase: TEST }
}
layers {
name: "conv1"
@ -308,6 +323,14 @@ layers {
bottom: "fc7"
top: "fc8"
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "fc8"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}
layers {
name: "loss"
type: SOFTMAX_LOSS

Просмотреть файл

@ -1,228 +0,0 @@
name: "AlexNet"
layers {
name: "data"
type: DATA
data_param {
source: "ilsvrc12_val_leveldb"
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
batch_size: 50
crop_size: 227
mirror: false
}
top: "data"
top: "label"
}
layers {
name: "conv1"
type: CONVOLUTION
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
}
bottom: "data"
top: "conv1"
}
layers {
name: "relu1"
type: RELU
bottom: "conv1"
top: "conv1"
}
layers {
name: "norm1"
type: LRN
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
bottom: "conv1"
top: "norm1"
}
layers {
name: "pool1"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
bottom: "norm1"
top: "pool1"
}
layers {
name: "conv2"
type: CONVOLUTION
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
}
bottom: "pool1"
top: "conv2"
}
layers {
name: "relu2"
type: RELU
bottom: "conv2"
top: "conv2"
}
layers {
name: "norm2"
type: LRN
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
bottom: "conv2"
top: "norm2"
}
layers {
name: "pool2"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
bottom: "norm2"
top: "pool2"
}
layers {
name: "conv3"
type: CONVOLUTION
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
}
bottom: "pool2"
top: "conv3"
}
layers {
name: "relu3"
type: RELU
bottom: "conv3"
top: "conv3"
}
layers {
name: "conv4"
type: CONVOLUTION
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
}
bottom: "conv3"
top: "conv4"
}
layers {
name: "relu4"
type: RELU
bottom: "conv4"
top: "conv4"
}
layers {
name: "conv5"
type: CONVOLUTION
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
}
bottom: "conv4"
top: "conv5"
}
layers {
name: "relu5"
type: RELU
bottom: "conv5"
top: "conv5"
}
layers {
name: "pool5"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
bottom: "conv5"
top: "pool5"
}
layers {
name: "fc6"
type: INNER_PRODUCT
inner_product_param {
num_output: 4096
}
bottom: "pool5"
top: "fc6"
}
layers {
name: "relu6"
type: RELU
bottom: "fc6"
top: "fc6"
}
layers {
name: "drop6"
type: DROPOUT
dropout_param {
dropout_ratio: 0.5
}
bottom: "fc6"
top: "fc6"
}
layers {
name: "fc7"
type: INNER_PRODUCT
inner_product_param {
num_output: 4096
}
bottom: "fc6"
top: "fc7"
}
layers {
name: "relu7"
type: RELU
bottom: "fc7"
top: "fc7"
}
layers {
name: "drop7"
type: DROPOUT
dropout_param {
dropout_ratio: 0.5
}
bottom: "fc7"
top: "fc7"
}
layers {
name: "fc8"
type: INNER_PRODUCT
inner_product_param {
num_output: 1000
}
bottom: "fc7"
top: "fc8"
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "fc8"
bottom: "label"
top: "accuracy"
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "fc8"
bottom: "label"
top: "loss"
}

Просмотреть файл

@ -1,5 +1,4 @@
train_net: "imagenet_train.prototxt"
test_net: "imagenet_val.prototxt"
net: "imagenet_train_val.prototxt"
test_iter: 1000
test_interval: 1000
base_lr: 0.01

Просмотреть файл

@ -11,6 +11,21 @@ layers {
crop_size: 227
mirror: true
}
include: { phase: TRAIN }
}
layers {
name: "data"
type: DATA
top: "data"
top: "label"
data_param {
source: "ilsvrc12_val_leveldb"
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
batch_size: 50
crop_size: 227
mirror: false
}
include: { phase: TEST }
}
layers {
name: "conv1"
@ -308,6 +323,14 @@ layers {
}
}
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "fc8"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}
layers {
name: "loss"
type: SOFTMAX_LOSS

Просмотреть файл

@ -1,228 +0,0 @@
name: "CaffeNet"
layers {
name: "data"
type: DATA
top: "data"
top: "label"
data_param {
source: "ilsvrc12_val_leveldb"
mean_file: "../../data/ilsvrc12/imagenet_mean.binaryproto"
batch_size: 50
crop_size: 227
mirror: false
}
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
}
}
layers {
name: "relu1"
type: RELU
bottom: "conv1"
top: "conv1"
}
layers {
name: "pool1"
type: POOLING
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layers {
name: "norm1"
type: LRN
bottom: "pool1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layers {
name: "conv2"
type: CONVOLUTION
bottom: "norm1"
top: "conv2"
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
}
}
layers {
name: "relu2"
type: RELU
bottom: "conv2"
top: "conv2"
}
layers {
name: "pool2"
type: POOLING
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layers {
name: "norm2"
type: LRN
bottom: "pool2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layers {
name: "conv3"
type: CONVOLUTION
bottom: "norm2"
top: "conv3"
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
}
}
layers {
name: "relu3"
type: RELU
bottom: "conv3"
top: "conv3"
}
layers {
name: "conv4"
type: CONVOLUTION
bottom: "conv3"
top: "conv4"
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
}
}
layers {
name: "relu4"
type: RELU
bottom: "conv4"
top: "conv4"
}
layers {
name: "conv5"
type: CONVOLUTION
bottom: "conv4"
top: "conv5"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
}
}
layers {
name: "relu5"
type: RELU
bottom: "conv5"
top: "conv5"
}
layers {
name: "pool5"
type: POOLING
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layers {
name: "fc6"
type: INNER_PRODUCT
bottom: "pool5"
top: "fc6"
inner_product_param {
num_output: 4096
}
}
layers {
name: "relu6"
type: RELU
bottom: "fc6"
top: "fc6"
}
layers {
name: "drop6"
type: DROPOUT
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
}
}
layers {
name: "fc7"
type: INNER_PRODUCT
bottom: "fc6"
top: "fc7"
inner_product_param {
num_output: 4096
}
}
layers {
name: "relu7"
type: RELU
bottom: "fc7"
top: "fc7"
}
layers {
name: "drop7"
type: DROPOUT
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layers {
name: "fc8"
type: INNER_PRODUCT
bottom: "fc7"
top: "fc8"
inner_product_param {
num_output: 1000
}
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "fc8"
bottom: "label"
top: "accuracy"
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "fc8"
bottom: "label"
top: "loss"
}

Просмотреть файл

@ -72,12 +72,11 @@ We will also lay out a protocol buffer for running the solver. Let's make a few
* The network will be trained with momentum 0.9 and a weight decay of 0.0005.
* For every 10,000 iterations, we will take a snapshot of the current status.
Sound good? This is implemented in `examples/imagenet/imagenet_solver.prototxt`. Again, you will need to change the first two lines:
Sound good? This is implemented in `examples/imagenet/imagenet_solver.prototxt`. Again, you will need to change the first line:
train_net: "imagenet_train.prototxt"
test_net: "imagenet_val.prototxt"
net: "imagenet_train_val.prototxt"
to point to the actual path if you have changed them.
to point to the actual path if you have changed it.
Training ImageNet
-----------------

Просмотреть файл

@ -30,8 +30,19 @@ random_seed: 1701
# solver mode: CPU or GPU
solver_mode: GPU
# The training protocol buffer definition
train_net_param {
# We test on both the test and train set using "stages". The TEST DATA layers
# each have a stage, either 'test-on-train-set' or 'test-on-test-set'.
# 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
test_state: { stage: "test-on-test-set" }
# The train set has 60K images, so we run 600 test iters (600 * 100 = 60K).
test_iter: 600
test_state: { stage: "test-on-train-set" }
# The net protocol buffer definition
net_param {
name: "LeNet"
layers {
name: "mnist"
@ -43,122 +54,8 @@ train_net_param {
scale: 0.00390625
batch_size: 64
}
include: { phase: TRAIN }
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 20
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool1"
type: POOLING
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
name: "conv2"
type: CONVOLUTION
bottom: "pool1"
top: "conv2"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 50
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool2"
type: POOLING
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
name: "ip1"
type: INNER_PRODUCT
bottom: "pool2"
top: "ip1"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 500
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu1"
type: RELU
bottom: "ip1"
top: "ip1"
}
layers {
name: "ip2"
type: INNER_PRODUCT
bottom: "ip1"
top: "ip2"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 10
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "ip2"
bottom: "label"
}
}
# 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
# The testing protocol buffer definition
test_net_param {
name: "LeNet-test"
layers {
name: "mnist"
type: DATA
@ -169,120 +66,11 @@ test_net_param {
scale: 0.00390625
batch_size: 100
}
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
convolution_param {
num_output: 20
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
include: {
phase: TEST
stage: "test-on-test-set"
}
}
layers {
name: "pool1"
type: POOLING
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
name: "conv2"
type: CONVOLUTION
bottom: "pool1"
top: "conv2"
convolution_param {
num_output: 50
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool2"
type: POOLING
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
name: "ip1"
type: INNER_PRODUCT
bottom: "pool2"
top: "ip1"
inner_product_param {
num_output: 500
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu1"
type: RELU
bottom: "ip1"
top: "ip1"
}
layers {
name: "ip2"
type: INNER_PRODUCT
bottom: "ip1"
top: "ip2"
inner_product_param {
num_output: 10
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "ip2"
bottom: "label"
top: "accuracy"
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "ip2"
bottom: "label"
top: "loss"
}
}
# The train set has 60K images, so we run 600 test iters (600 * 100 = 60K).
test_iter: 600
# The protocol buffer definition to test on the train set
test_net_param {
name: "LeNet-test-on-train"
layers {
name: "mnist"
type: DATA
@ -293,12 +81,18 @@ test_net_param {
scale: 0.00390625
batch_size: 100
}
include: {
phase: TEST
stage: "test-on-train-set"
}
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 20
kernel_size: 5
@ -327,6 +121,8 @@ test_net_param {
type: CONVOLUTION
bottom: "pool1"
top: "conv2"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 50
kernel_size: 5
@ -355,6 +151,8 @@ test_net_param {
type: INNER_PRODUCT
bottom: "pool2"
top: "ip1"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 500
weight_filler {
@ -376,6 +174,8 @@ test_net_param {
type: INNER_PRODUCT
bottom: "ip1"
top: "ip2"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 10
weight_filler {
@ -392,6 +192,7 @@ test_net_param {
bottom: "ip2"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}
layers {
name: "loss"

Просмотреть файл

@ -1,7 +1,5 @@
# The training protocol buffer definition
train_net: "lenet_train.prototxt"
# The testing protocol buffer definition
test_net: "lenet_test.prototxt"
# The train/test net protocol buffer definition
net: "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.

Просмотреть файл

@ -1,118 +0,0 @@
name: "LeNet-test"
layers {
name: "mnist"
type: DATA
top: "data"
top: "label"
data_param {
source: "mnist-test-leveldb"
scale: 0.00390625
batch_size: 100
}
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
convolution_param {
num_output: 20
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool1"
type: POOLING
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
name: "conv2"
type: CONVOLUTION
bottom: "pool1"
top: "conv2"
convolution_param {
num_output: 50
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool2"
type: POOLING
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
name: "ip1"
type: INNER_PRODUCT
bottom: "pool2"
top: "ip1"
inner_product_param {
num_output: 500
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu1"
type: RELU
bottom: "ip1"
top: "ip1"
}
layers {
name: "ip2"
type: INNER_PRODUCT
bottom: "ip1"
top: "ip2"
inner_product_param {
num_output: 10
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "ip2"
bottom: "label"
top: "accuracy"
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "ip2"
bottom: "label"
top: "loss"
}

Просмотреть файл

@ -9,7 +9,21 @@ layers {
scale: 0.00390625
batch_size: 64
}
include: { phase: TRAIN }
}
layers {
name: "mnist"
type: DATA
top: "data"
top: "label"
data_param {
source: "mnist-test-leveldb"
scale: 0.00390625
batch_size: 100
}
include: { phase: TEST }
}
layers {
name: "conv1"
type: CONVOLUTION
@ -110,9 +124,18 @@ layers {
}
}
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "ip2"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "ip2"
bottom: "label"
top: "loss"
}

Просмотреть файл

@ -8,6 +8,18 @@ layers {
scale: 0.0039215684
batch_size: 100
}
include: { phase: TRAIN }
}
layers {
top: "data"
name: "data"
type: DATA
data_param {
source: "mnist-test-leveldb"
scale: 0.0039215684
batch_size: 100
}
include: { phase: TEST }
}
layers {
bottom: "data"
@ -232,4 +244,20 @@ layers {
bottom: "flatdata"
name: "loss"
type: SIGMOID_CROSS_ENTROPY_LOSS
include: { phase: TRAIN }
}
layers {
bottom: "decode1"
top: "decode1neuron"
name: "decode1neuron"
type: SIGMOID
include: { phase: TEST }
}
layers {
bottom: "decode1neuron"
bottom: "flatdata"
name: "loss"
type: EUCLIDEAN_LOSS
top: "loss"
include: { phase: TEST }
}

Просмотреть файл

@ -1,5 +1,4 @@
train_net: "mnist_autoencoder_train.prototxt"
test_net: "mnist_autoencoder_test.prototxt"
net: "mnist_autoencoder.prototxt"
test_iter: 50
test_interval: 100
test_compute_loss: true

Просмотреть файл

@ -1,146 +0,0 @@
name: "MNISTAutoencoder"
layers {
top: "data"
name: "data"
type: DATA
data_param {
source: "mnist-test-leveldb"
scale: 0.0039215684
batch_size: 100
}
}
layers {
bottom: "data"
top: "flatdata"
name: "flatdata"
type: FLATTEN
}
layers {
bottom: "data"
top: "encode1"
name: "encode1"
type: INNER_PRODUCT
inner_product_param {
num_output: 1000
}
}
layers {
bottom: "encode1"
top: "encode1neuron"
name: "encode1neuron"
type: SIGMOID
}
layers {
bottom: "encode1neuron"
top: "encode2"
name: "encode2"
type: INNER_PRODUCT
inner_product_param {
num_output: 500
}
}
layers {
bottom: "encode2"
top: "encode2neuron"
name: "encode2neuron"
type: SIGMOID
}
layers {
bottom: "encode2neuron"
top: "encode3"
name: "encode3"
type: INNER_PRODUCT
inner_product_param {
num_output: 250
}
}
layers {
bottom: "encode3"
top: "encode3neuron"
name: "encode3neuron"
type: SIGMOID
}
layers {
bottom: "encode3neuron"
top: "encode4"
name: "encode4"
type: INNER_PRODUCT
blobs_lr: 1
blobs_lr: 1
weight_decay: 1
weight_decay: 0
inner_product_param {
num_output: 30
}
}
layers {
bottom: "encode4"
top: "decode4"
name: "decode4"
type: INNER_PRODUCT
blobs_lr: 1
blobs_lr: 1
weight_decay: 1
weight_decay: 0
inner_product_param {
num_output: 250
}
}
layers {
bottom: "decode4"
top: "decode4neuron"
name: "decode4neuron"
type: SIGMOID
}
layers {
bottom: "decode4neuron"
top: "decode3"
name: "decode3"
type: INNER_PRODUCT
inner_product_param {
num_output: 500
}
}
layers {
bottom: "decode3"
top: "decode3neuron"
name: "decode3neuron"
type: SIGMOID
}
layers {
bottom: "decode3neuron"
top: "decode2"
name: "decode2"
type: INNER_PRODUCT
inner_product_param {
num_output: 1000
}
}
layers {
bottom: "decode2"
top: "decode2neuron"
name: "decode2neuron"
type: SIGMOID
}
layers {
bottom: "decode2neuron"
top: "decode1"
name: "decode1"
type: INNER_PRODUCT
inner_product_param {
num_output: 784
}
}
layers {
bottom: "decode1"
top: "decode1neuron"
name: "decode1neuron"
type: SIGMOID
}
layers {
bottom: "decode1neuron"
bottom: "flatdata"
name: "loss"
type: EUCLIDEAN_LOSS
top: "loss"
}

Просмотреть файл

@ -177,10 +177,8 @@ The `softmax_loss` layer implements both the softmax and the multinomial logisti
Check out the comments explaining each line in the prototxt:
# The training protocol buffer definition
train_net: "lenet_train.prototxt"
# The testing protocol buffer definition
test_net: "lenet_test.prototxt"
# The train/test net protocol buffer definition
net: "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.