代码之家  ›  专栏  ›  技术社区  ›  Nima

caffe:欧氏损失误差:输入必须具有相同的维数

  •  1
  • Nima  · 技术社区  · 7 年前

    我在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.
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Shai    7 年前

    你的错误不言而喻:

    Inputs must have the same dimension
    

    你在计算 "EuclideanLoss" 之间 "ampl" "label" . 这么做,你 必须 “小精灵” “标签” 是具有相同数量元素的blob(又名 count() )然而,似乎 “AMPL” 有10个元素, “标签” 只有一个元素。