多个测试阶段的结果不正确

Result of multiple test stages is incorrect

我在训练时尝试使用 caffe 求解器中的 test_state 功能。为了实现这一点,我将以下代码添加到 solver.prototxt

test_state: { stage: 'test-on-testSet0' }
test_iter: 726
test_state: { stage: 'test-on-testSet1' }
test_iter: 363

然后我把train_val.prototxt修改成这样:

layer {
  name: "data"
  type: "ImageData"
  top: "data"
  top: "label"
  include {
    phase: TEST
    stage: "test-on-testSet0"
  }
  transform_param {
    mirror: false
    scale: 0.0039215684
  }
  image_data_param {
    source: "./set0.lst"
    batch_size: 1
  }
}

layer {
  name: "data"
  type: "ImageData"
  top: "data"
  top: "label"
  include {
    phase: TEST
    stage: "test-on-testSet1"
  }
  transform_param {
    mirror: false
    scale: 0.0039215684
  }
  image_data_param {
    source: "./set0.lst"
    batch_size: 2
  }
}

必须注意,两个测试用例在理想情况下是相同的,并且测试在 ./set0.lst 文件中存在的完整图像集上运行。

仍然在使用 build/tools/caffe 进行训练时,两种测试状态打印的准确度结果并不相同。 精度层也正确连接。 这种不匹配的原因可能是什么?

我能够通过对所有 test_states 使用相同的 batch_size 来解决问题。看起来 caffe 期望所有测试用例都具有相同的 batch_size.

希望这个回答能对以后的人有所帮助。

顺便说一句,我想这可能会作为错误发布到 caffe 社区。我在最新提交的 caffe (df412ac) 中遇到了这个问题。