在训练阶段如何在PyCaffe上获得Top-k准确性?

时间:2019-06-20 00:25:48

标签: caffe pycaffe

我想知道在进行训练时是否有办法在PyCaffe上获得top-k错误。

我知道.prototxt文件有top_k参数,但是我可以在PyCaffe上使用它吗?

layer {
  name: "accuracy"
  type: "Accuracy"
  bottom: "..."
  bottom: "label"
  top: "accuracy"
  accuracy_param {
    top_k: 5
  }
  include {
    phase: TEST
  }
}

1 个答案:

答案 0 :(得分:0)

对于想知道我只是发现您需要放置具有不同top-k值的多个精度层的人。这是前三位准确性的示例。

layer {
    name: "accuracy1"
    type: "Accuracy"
    bottom: "score"
    bottom: "label"
    top: "accuracy1"
    include {
      phase: TEST
    }
  }
  layer {
    name: "accuracy2"
    type: "Accuracy"
    bottom: "score"
    bottom: "label"
    top: "accuracy2"
    accuracy_param {
        top_k: 2
    }
    include {
      phase: TEST
    }
  }
  layer {
    name: "accuracy3"
    type: "Accuracy"
    bottom: "score"
    bottom: "label"
    top: "accuracy3"
    accuracy_param {
        top_k: 3
    }
    include {
      phase: TEST
    }
  }