Skip to content

Commit

Permalink
add attribution for dilation in convolution
Browse files Browse the repository at this point in the history
  • Loading branch information
fyu committed Dec 25, 2015
1 parent 8fdc7ee commit 4c0a5f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/caffe/layers/base_conv_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ void BaseConvolutionLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
for (int i = 0; i < num_spatial_axes_; ++i) {
dilation_data[i] = (num_dilation_dims == 0) ? kDefaultDilation :
conv_param.dilation((num_dilation_dims == 1) ? 0 : i);
if (reverse_dimensions()) {
CHECK_EQ(dilation_data[i], 1) << "Deconvolution doesn't support dilation";
}
}
// Special case: im2col is the identity for 1x1 convolution with stride 1
// and no padding, so flag for skipping the buffer and transformation.
Expand Down
7 changes: 7 additions & 0 deletions src/caffe/proto/caffe.proto
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,13 @@ message ConvolutionParameter {
repeated uint32 pad = 3; // The padding size; defaults to 0
repeated uint32 kernel_size = 4; // The kernel size
repeated uint32 stride = 6; // The stride; defaults to 1
// Properties of dilated convolution are described in
// F. Yu et al, Multi-Scale Context Aggregation by Dilated Convolutions, 2015.
// "dilation" was first proposed and used in a trous algorithm, as decribed in
// Holschneider et al. A Real-Time Algorithm for Signal Analysis
// with the Help of the Wavelet Transform, 1987.
// It was called filter rarefaction in Long* and Shelhamer* and Darrell,
// Fully Convolutional Networks for Semantic Segmentation, 2014.
repeated uint32 dilation = 18; // The dilation; defaults to 1

// For 2D convolution only, the *_h and *_w versions may also be used to
Expand Down
2 changes: 1 addition & 1 deletion src/caffe/solvers/adam_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void AdamSolver<Dtype>::ComputeUpdateValue(int param_id, Dtype rate) {
Blob<Dtype>* val_v = this->history_[param_id + update_history_offset].get();
Blob<Dtype>* val_t = this->temp_[param_id].get();

const int t = this->iter_ + 1;
const int t = this->iter_ + 1;
const Dtype correction = std::sqrt(Dtype(1) - pow(beta2, t)) /
(Dtype(1.) - pow(beta1, t));
const int N = net_params[param_id]->count();
Expand Down

0 comments on commit 4c0a5f5

Please sign in to comment.