Caffe Checkerboard 人工制品,如何解决这个问题?
Caffe Checkerboard artefacts, how to fix this?
我正在使用 Caffe,我使用我的反卷积层是这样的:
layer {
name: "name"
type: "Deconvolution"
bottom: "bottom
top: "top"
param {
lr_mult: 0
decay_mult: 0
}
convolution_param {
num_output: 256
bias_term: false
pad: 0
kernel_size: 2
group: 256
stride: 2
weight_filler {
type: "bilinear"
}
}
}
完成训练和验证我的网络时,我收到奇怪的棋盘伪像。我找不到任何有关如何在 Caffe 中解决此问题的信息,所以我想问问是否有人对此有解决方案?
这个问题不是Caffe特有的,是反卷积引起的。 http://distill.pub/2016/deconv-checkerboard/提供了一个很好的分析和解决方案有几个简单的方法可以防止这个问题:
- 使用一步。
- 减少网络中反卷积的使用,比如只在最后一层使用。
- 在应用Deconvolution(文中提到的resize-convolution)之前对feature map进行Upsample。
答案很简单:
layer {
name: "name"
type: "Deconvolution"
bottom: "bottom
top: "top"
param {
lr_mult: 0
decay_mult: 0
}
convolution_param {
num_output: 256
bias_term: false
pad: 1
kernel_size: 4 # <-- changing kernel size fixed the problem.
group: 256
stride: 2
weight_filler {
type: "bilinear"
}
}
}
下面提供了一个例子link
为了通过某些已知因子执行双线性上采样,仅制作具有双线性权重填充器的反卷积层是不够的。您还需要正确设置步幅、填充和内核大小。
如果我们把整个过程想象成绘画,kernel 就是我们的画笔,stride 描述了我们触摸它到 canvas 的频率。选择太小的内核和太大的步长会导致输出看起来像我们把微小的油漆点分开得很远。内核太大会导致过度模糊。当您的内核未正确初始化时出现棋盘 - 当前 (latest commit when typing this), caffe contains a bug with bilinear filter generation and for some sizes it will not actually be bilinear (proposed fix in PR #5713).
select 右边 size/stride/padding 的公式在 BilinearFiller documentation 中给出。
我正在使用 Caffe,我使用我的反卷积层是这样的:
layer {
name: "name"
type: "Deconvolution"
bottom: "bottom
top: "top"
param {
lr_mult: 0
decay_mult: 0
}
convolution_param {
num_output: 256
bias_term: false
pad: 0
kernel_size: 2
group: 256
stride: 2
weight_filler {
type: "bilinear"
}
}
}
完成训练和验证我的网络时,我收到奇怪的棋盘伪像。我找不到任何有关如何在 Caffe 中解决此问题的信息,所以我想问问是否有人对此有解决方案?
这个问题不是Caffe特有的,是反卷积引起的。 http://distill.pub/2016/deconv-checkerboard/提供了一个很好的分析和解决方案有几个简单的方法可以防止这个问题:
- 使用一步。
- 减少网络中反卷积的使用,比如只在最后一层使用。
- 在应用Deconvolution(文中提到的resize-convolution)之前对feature map进行Upsample。
答案很简单:
layer {
name: "name"
type: "Deconvolution"
bottom: "bottom
top: "top"
param {
lr_mult: 0
decay_mult: 0
}
convolution_param {
num_output: 256
bias_term: false
pad: 1
kernel_size: 4 # <-- changing kernel size fixed the problem.
group: 256
stride: 2
weight_filler {
type: "bilinear"
}
}
}
下面提供了一个例子link
为了通过某些已知因子执行双线性上采样,仅制作具有双线性权重填充器的反卷积层是不够的。您还需要正确设置步幅、填充和内核大小。
如果我们把整个过程想象成绘画,kernel 就是我们的画笔,stride 描述了我们触摸它到 canvas 的频率。选择太小的内核和太大的步长会导致输出看起来像我们把微小的油漆点分开得很远。内核太大会导致过度模糊。当您的内核未正确初始化时出现棋盘 - 当前 (latest commit when typing this), caffe contains a bug with bilinear filter generation and for some sizes it will not actually be bilinear (proposed fix in PR #5713).
select 右边 size/stride/padding 的公式在 BilinearFiller documentation 中给出。