Deconvolution.md 1.9 KB
Newer Older
S
sunyanfang01 已提交
1 2 3 4 5
## Deconvolution


### [Deconvolution](http://caffe.berkeleyvision.org/tutorial/layers/deconvolution.html)
```
S
SunAhong1993 已提交
6
layer {
S
sunyanfang01 已提交
7 8 9
    name: "deconv"
    type: "Deconvolution"
    bottom: "data"
S
SunAhong1993 已提交
10 11 12
    top: "deconv"
    # 卷积核的局部学习率和权值衰减因子
    param {
S
sunyanfang01 已提交
13 14 15
	lr_mult: 1
	decay_mult: 1
    }
S
SunAhong1993 已提交
16 17
    # 偏置项的局部学习率和权值衰减因子
    param {
S
sunyanfang01 已提交
18 19 20
	lr_mult: 2
	decay_mult: 0
    }
S
SunAhong1993 已提交
21 22 23
    convolution_param {
	num_output: 20    # 必填项
	kernel_size: 3    # 必填项
S
sunyanfang01 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
	stride: 1
	pad: 0
	group: 1
	bias_term: True
	weight_filler {
	    type: "gaussian"
	    value: 0.01
	}
	bias_filler {
	    type: "constant"
	    value: 0
	}
    }
}
```


### [paddle.fluid.layers.conv2d_transpose](http://paddlepaddle.org/documentation/docs/zh/1.3/api_cn/layers_cn.html#permalink-46-conv2d_transpose)
```python
paddle.fluid.layers.conv2d_transpose(
    input,
    num_filters,
    output_size,
    stride = 1,
    padding = 0,
    dilation = 1,
    groups = None,
S
SunAhong1993 已提交
51 52 53 54 55
    param_attr = None,
    bias_attr = None,
    use_cudnn = True,
    act = None,
    name = None
S
sunyanfang01 已提交
56 57 58 59
)
```  

### 功能差异
J
Jason 已提交
60 61 62 63 64
#### 参数初始化
Caffe:Layer定义中共有两个结构体`param`用于设置局部学习率和权值衰减因子,其中第一个用于设置卷积核,第二个则用于设置偏值项;卷积核和偏置项的初始化参数在`convolution_param`中进行设置;是否使用偏置项可以使用`bias_term`进行设置;  
PaddlePaddle:卷积核和偏置项的参数分别使用`param_attr``bias_attr`进行配置,配置参数如下所示,此外将`bias_attr`直接设为`False`表示不使用偏置项。
```
paddle.fluid.ParamAttr(
S
SunAhong1993 已提交
65 66 67 68 69 70 71
    name = None, 
    initializer = None, 
    learning_rate = 1.0, 
    regularizer = None, 
    trainable = True, 
    gradient_clip = None, 
    do_model_average = False
J
Jason 已提交
72 73 74 75 76
)
```
#### 空洞卷积
Caffe:无法使用空洞卷积;                  
PaddlePaddle:使用`dilation`参数来设置空洞卷积。