How to use the Batch Normalization layer with video-caffe?
rpand002 opened this issue · comments
Does video-caffe supports batch normalization layer? How can I use the Batch normalization layer (BN), with this caffe version? Thank you for your assistance.
Batch normalization should work as it's already included in this version of Caffe (both master / refactor branches): https://github.com/chuckcho/video-caffe/blob/master/include/caffe/layers/batch_norm_layer.hpp
Thanks for your response. I have tried using the batch normalization layer before each relu layer but getting error. I have added the following lines in the prototxt file.
----- 1st group -----
layer {
name: "conv1a"
type: "NdConvolution"
bottom: "data"
top: "conv1a"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 64
kernel_shape { dim: 3 dim: 3 dim: 3 }
stride_shape { dim: 1 dim: 1 dim: 1 }
pad_shape { dim: 1 dim: 1 dim: 1 }
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "bn1"
type: "BatchNorm"
bottom: "conv1a"
top: "bn1"
param {
lr_mult: 0
}
param {
lr_mult: 0
}
param {
lr_mult: 0
}
}
layer {
name: "relu1a"
type: "ReLU"
bottom: "bn1"
top: "relu1a"
}
layer {
name: "pool1"
type: "NdPooling"
bottom: "relu1a"
top: "pool1"
pooling_param {
pool: MAX
kernel_shape { dim: 1 dim: 2 dim: 2 }
stride_shape { dim: 1 dim: 2 dim: 2 }
}
}
------ Error-----
Check failed: target_blobs[j]->shape() == source_blob->shape() Cannot share param 0 weights from layer 'bn1'; shape mismatch. Source param shape is 128 (128); target param shape is 64 (64).
Can you please look into this? Thanks for your assistance.
i didn't encounter any issue. look at the following snippet:
layer {
name: "conv1a"
type: "NdConvolution"
bottom: "data"
top: "conv1a"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 64
kernel_shape { dim: 3 dim: 3 dim: 3 }
stride_shape { dim: 1 dim: 1 dim: 1 }
pad_shape { dim: 1 dim: 1 dim: 1 }
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "bn1"
type: "BatchNorm"
bottom: "conv1a"
top: "bn1"
param { lr_mult: 0 }
param { lr_mult: 0 }
param { lr_mult: 0 }
}
layer {
name: "relu1a"
type: "ReLU"
bottom: "bn1"
top: "bn1"
}
layer {
name: "pool1"
type: "NdPooling"
bottom: "bn1"
top: "pool1"
pooling_param {
pool: MAX
kernel_shape { dim: 1 dim: 2 dim: 2 }
stride_shape { dim: 1 dim: 2 dim: 2 }
}
}```
closing as this doesn't seem like an issue