Skip to content
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

Simplify input scaling on LeNet network #976

Merged
merged 2 commits into from
Aug 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions digits/standard-networks/caffe/lenet.prototxt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ name: "LeNet"
layer {
name: "train-data"
type: "Data"
top: "scaled"
top: "data"
top: "label"
transform_param {
# 1/(standard deviation)
scale: 0.0125
}
data_param {
batch_size: 64
}
Expand All @@ -17,28 +13,23 @@ layer {
layer {
name: "val-data"
type: "Data"
top: "scaled"
top: "data"
top: "label"
transform_param {
# 1/(standard deviation)
scale: 0.0125
}
data_param {
batch_size: 32
}
include { stage: "val" }
}
layer {
# Use Power layer in deploy phase for input scaling
# Use Power layer for input scaling
name: "scale"
bottom: "data"
top: "scaled"
type: "Power"
power_param {
# 1/(standard deviation)
# 1/(standard deviation on MNIST dataset)
scale: 0.0125
}
include { stage: "deploy" }
}
layer {
name: "conv1"
Expand Down
2 changes: 1 addition & 1 deletion digits/standard-networks/torch/lenet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ return function(params)
-- -- This is a LeNet model. For more information: http://yann.lecun.com/exdb/lenet/

local lenet = nn.Sequential()
lenet:add(nn.MulConstant(0.00390625))
lenet:add(nn.MulConstant(0.0125)) -- 1/(standard deviation on MNIST dataset)
lenet:add(backend.SpatialConvolution(channels,20,5,5,1,1,0)) -- channels*28*28 -> 20*24*24
lenet:add(backend.SpatialMaxPooling(2, 2, 2, 2)) -- 20*24*24 -> 20*12*12
lenet:add(backend.SpatialConvolution(20,50,5,5,1,1,0)) -- 20*12*12 -> 50*8*8
Expand Down