【问题标题】:labels should start from 0 or 1 in caffe if use softmaxwithLoss as loss layer?如果使用 softmaxwithLoss 作为损失层,caffe 中的标签应该从 0 或 1 开始?
【发布时间】:2018-06-25 06:18:24
【问题描述】:

两个问题:

1.对于MultinomialLogisticLoss,标签应该从1开始,但是caffe文档说应该从0开始。http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1SoftmaxWithLossLayer.html

2.score(bottom[0]) 的形状为 NCH*W,Label(bottom[1]) 为 MultinomialLogisticLoss 的形状为 N*1*1*1。 在segmentation task中,label shape和bottom[0]一样,也就是N*1*H*W,但是caffe在我的测试中没有报错。

虽然我已经阅读了一些文档和分段项目代码,但这两个问题让我感到困惑。

【问题讨论】:

    标签: neural-network computer-vision deep-learning caffe image-segmentation


    【解决方案1】:
    1. 标签应该从零开始:caffe 使用标签来索引预测数组。
    2. 使用"SoftmaxWithLoss" 和axis 参数,您可以告诉caffe 将axis 维度视为概率向量,并且每批有多个预测(即Nx1xHxW)。在这种情况下,标签形状应匹配 Nx1xHxW 而不是 Nx1x1x1。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-06
      • 1970-01-01
      • 2016-11-17
      • 2017-03-09
      • 2017-11-19
      • 1970-01-01
      • 2018-03-08
      • 2017-05-27
      相关资源
      最近更新 更多