Caffe: euclidean loss error: Inputs must have the same dimensions

Caffe: euclidean loss error: Inputs must have the same dimensions

我在 python 中使用 caffe。所以这是我的斑点形状:

data                        3072     3.07e+03    (1, 3, 32, 32)
conv2d1                    12544     1.25e+04    (1, 16, 28, 28)
maxPool1                    3136     3.14e+03    (1, 16, 14, 14)
fc1                           10     1.00e+01    (1, 10)
ampl                          10     1.00e+01    (1, 10)
-------------------------------- params: name,w,(b)
conv2d1                     1200     1.20e+03    (16, 3, 5, 5)    
fc1                        31360     3.14e+04    (10, 3136)

这是我在 proto.txt 文件中的最后两层:

...
layer {
  name: "ampl"
  type: "Softmax"
  bottom: "fc1"
  top: "ampl"
  softmax_param {
    axis: 1
  }
}
layer {
  name: "loss"
  type: "EuclideanLoss"
  bottom: "ampl"
  bottom: "label"
  top: "loss"
}

我得到这个错误:

euclidean_loss_layer.cpp:12] Check failed: bottom[0]->count(1) == bottom[1]->count(1) (10 vs. 1) Inputs must have the same dimension.

你的错误很容易解释:

Inputs must have the same dimension

您正试图在 "ampl""label" 之间计算 "EuclideanLoss"。为此,您 必须 使 "ampl""label" 成为具有相同数量元素(又名 count())的 blob。但是,似乎 "ampl" 有 10 个元素,而 "label" 只有一个元素。