【发布时间】:2018-09-26 08:09:17
【问题描述】:
这是我的 blob 形状和图层:
-------------------------------- 斑点
data 4096 4.10e+03 (1, 2, 1, 2048)
Convolution1 32736 3.27e+04 (1, 16, 1, 2046)
ReLU1 32736 3.27e+04 (1, 16, 1, 2046)
Convolution2 32704 3.27e+04 (1, 16, 1, 2044)
ReLU2 32704 3.27e+04 (1, 16, 1, 2044)
...
Crop4 4224 4.22e+03 (1, 16, 1, 264)
Concat4 8448 8.45e+03 (1, 32, 1, 264)
Convolution17 4192 4.19e+03 (1, 16, 1, 262)
ReLU21 4192 4.19e+03 (1, 16, 1, 262)
Convolution18 4160 4.16e+03 (1, 16, 1, 260)
unet1 4160 4.16e+03 (1, 16, 1, 260)
ampl0 4096 4.10e+03 (1, 4096)
Reshape0 4096 4.10e+03 (1, 1, 1, 4096)
conv1 65472 6.55e+04 (1, 16, 1, 4092)
conv1_conv1_0_split_0 65472 6.55e+04 (1, 16, 1, 4092)
conv1_conv1_0_split_1 65472 6.55e+04 (1, 16, 1, 4092)
Scale1 65472 6.55e+04 (1, 16, 1, 4092)
ReLU22 65472 6.55e+04 (1, 16, 1, 4092)
Scale2 65472 6.55e+04 (1, 16, 1, 4092)
...
ReLU28 517120 5.17e+05 (1, 128, 8, 505)
Scale8 517120 5.17e+05 (1, 128, 8, 505)
ReLU29 517120 5.17e+05 (1, 128, 8, 505)
crelu4 1034240 1.03e+06 (1, 128, 16, 505)
maxPool4 518144 5.18e+05 (1, 128, 16, 253)
ampl 21 2.10e+01 (1, 21)
我在损失层遇到的错误:
F0416 15:43:21.957676 95620 loss_layer.cpp:19] Check failed: bottom[0]->shape(0) == bottom[1]->shape(0) (1 vs. 10) The data and label should have the same first dimension.
注意:我在CNN层中间添加了一个全连接层(ampl0)+重塑(Reshape0)层后出现了错误。没有它们,它工作得很好!
感谢您的帮助。 更新:那些全连接层和 Reshape 层是:
layer {
name: "ampl0"
type: "InnerProduct"
bottom: "unet1"
top: "ampl0"
param {
lr_mult: 1
decay_mult: 1
}
inner_product_param {
num_output: 4096
bias_term: false
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.2
}
}
}
layer {
name: "Reshape0"
type: "Reshape"
bottom: "ampl0"
top: "Reshape0"
reshape_param {
shape {
dim: 1
dim: 1
dim: 1
dim:-1
}
}
}
【问题讨论】:
-
“标签”blob 在哪里?它的尺寸是多少?哪一层会发出这个错误?该层的输入 blob 的形状是什么?如果你能清楚地回答这些问题,我相信你会得到你的问题的答案。
-
所以我有一个可以正常工作的传统 8 层 CNN。我在第 4 层之后添加了一个“InnerProduct”层(和 Reshape 层)。数据层和标签层是相同的,所以它们的尺寸。其他(理论上)没有任何改变!
-
我将这些添加的图层更新为主要问题
-
所以我终于取得了一些进展。我的 batch_size 是 10。当我将其更改为 1 时,一切正常!知道为什么会这样吗?这就是检查失败的原因:bottom[0]->shape(0) == bottom[1]->shape(0) (1 vs. 10) 正在发生...
-
你的重塑层强制批量大小为一。尝试在 conv1 参数上使用 axis:0 而不是 reshape
标签: neural-network deep-learning caffe conv-neural-network pycaffe