-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yet another batch normalization PR #3229
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 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: "examples/cifar10/cifar10_full_sigmoid_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: 10 | ||
# 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: "step" | ||
gamma: 1 | ||
stepsize: 5000 | ||
# Display every 200 iterations | ||
display: 100 | ||
# The maximum number of iterations | ||
max_iter: 60000 | ||
# snapshot intermediate results | ||
snapshot: 10000 | ||
snapshot_prefix: "examples/cifar10_full_sigmoid" | ||
# solver mode: CPU or GPU | ||
solver_mode: GPU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 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: "examples/cifar10/cifar10_full_sigmoid_train_test_bn.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: 10 | ||
# 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: "step" | ||
gamma: 1 | ||
stepsize: 5000 | ||
# Display every 200 iterations | ||
display: 100 | ||
# The maximum number of iterations | ||
max_iter: 60000 | ||
# snapshot intermediate results | ||
snapshot: 10000 | ||
snapshot_prefix: "examples/cifar10_full_sigmoid_bn" | ||
# solver mode: CPU or GPU | ||
solver_mode: GPU |
212 changes: 212 additions & 0 deletions
212
examples/cifar10/cifar10_full_sigmoid_train_test.prototxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
name: "CIFAR10_full" | ||
layer { | ||
name: "cifar" | ||
type: "Data" | ||
top: "data" | ||
top: "label" | ||
include { | ||
phase: TRAIN | ||
} | ||
transform_param { | ||
mean_file: "examples/cifar10/mean.binaryproto" | ||
} | ||
data_param { | ||
source: "examples/cifar10/cifar10_train_lmdb" | ||
batch_size: 111 | ||
backend: LMDB | ||
} | ||
} | ||
layer { | ||
name: "cifar" | ||
type: "Data" | ||
top: "data" | ||
top: "label" | ||
include { | ||
phase: TEST | ||
} | ||
transform_param { | ||
mean_file: "examples/cifar10/mean.binaryproto" | ||
} | ||
data_param { | ||
source: "examples/cifar10/cifar10_test_lmdb" | ||
batch_size: 1000 | ||
backend: LMDB | ||
} | ||
} | ||
layer { | ||
name: "conv1" | ||
type: "Convolution" | ||
bottom: "data" | ||
top: "conv1" | ||
param { | ||
lr_mult: 1 | ||
} | ||
param { | ||
lr_mult: 2 | ||
} | ||
convolution_param { | ||
num_output: 32 | ||
pad: 2 | ||
kernel_size: 5 | ||
stride: 1 | ||
weight_filler { | ||
type: "gaussian" | ||
std: 0.0001 | ||
} | ||
bias_filler { | ||
type: "constant" | ||
} | ||
} | ||
} | ||
layer { | ||
name: "pool1" | ||
type: "Pooling" | ||
bottom: "conv1" | ||
top: "pool1" | ||
pooling_param { | ||
pool: MAX | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
|
||
|
||
|
||
layer { | ||
name: "Sigmoid1" | ||
type: "Sigmoid" | ||
bottom: "pool1" | ||
top: "Sigmoid1" | ||
} | ||
|
||
layer { | ||
name: "conv2" | ||
type: "Convolution" | ||
bottom: "Sigmoid1" | ||
top: "conv2" | ||
param { | ||
lr_mult: 1 | ||
} | ||
param { | ||
lr_mult: 2 | ||
} | ||
convolution_param { | ||
num_output: 32 | ||
pad: 2 | ||
kernel_size: 5 | ||
stride: 1 | ||
weight_filler { | ||
type: "gaussian" | ||
std: 0.01 | ||
} | ||
bias_filler { | ||
type: "constant" | ||
} | ||
} | ||
} | ||
|
||
|
||
layer { | ||
name: "Sigmoid2" | ||
type: "Sigmoid" | ||
bottom: "conv2" | ||
top: "Sigmoid2" | ||
} | ||
layer { | ||
name: "pool2" | ||
type: "Pooling" | ||
bottom: "Sigmoid2" | ||
top: "pool2" | ||
pooling_param { | ||
pool: AVE | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
layer { | ||
name: "conv3" | ||
type: "Convolution" | ||
bottom: "pool2" | ||
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" | ||
} | ||
} | ||
param { | ||
lr_mult: 1 | ||
} | ||
param { | ||
lr_mult: 1 | ||
} | ||
|
||
} | ||
|
||
layer { | ||
name: "Sigmoid3" | ||
type: "Sigmoid" | ||
bottom: "conv3" | ||
top: "Sigmoid3" | ||
} | ||
|
||
layer { | ||
name: "pool3" | ||
type: "Pooling" | ||
bottom: "Sigmoid3" | ||
top: "pool3" | ||
pooling_param { | ||
pool: AVE | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
|
||
layer { | ||
name: "ip1" | ||
type: "InnerProduct" | ||
bottom: "pool3" | ||
top: "ip1" | ||
param { | ||
lr_mult: 1 | ||
decay_mult: 0 | ||
} | ||
param { | ||
lr_mult: 2 | ||
decay_mult: 0 | ||
} | ||
inner_product_param { | ||
num_output: 10 | ||
weight_filler { | ||
type: "gaussian" | ||
std: 0.01 | ||
} | ||
bias_filler { | ||
type: "constant" | ||
} | ||
} | ||
} | ||
layer { | ||
name: "accuracy" | ||
type: "Accuracy" | ||
bottom: "ip1" | ||
bottom: "label" | ||
top: "accuracy" | ||
include { | ||
phase: TEST | ||
} | ||
} | ||
layer { | ||
name: "loss" | ||
type: "SoftmaxWithLoss" | ||
bottom: "ip1" | ||
bottom: "label" | ||
top: "loss" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat unrelated to batch normalization, but is it intentional to use
conv -> pooling -> sigmoid
in the first layer andconv -> sigmoid -> pooling
in the second layer?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not. Intention was to reduce memory usage by conv -> pooling -> sigmoid, but missed it in 2nd layer.