在测试阶段计算数据块的平均值

Compute the mean of a data blob during testing phase

我正在使用具有数据和标签的 hdf5 层。

layer {
  name: "data"
  type: "HDF5Data"
  top: "data"
  top: "label"
  include {
    phase: TEST
  }
  hdf5_data_param {
    source: "./list.txt"
    batch_size: 8
    shuffle: true
  }
}

在测试阶段,它将从测试集中加载 8 张图像并提供给网络。我想在测试阶段打印每张图像的平均值。可以在CAFFE中使用吗?我应该使用哪一层?

我认为您正在寻找 "Reduction" 图层

layer {
  type: "Reduction"
  name: "img_mean"
  bottom: "data"
  top: "img_mean"
  reduction_param {
    operation: MEAN
    axis: 0  # to reduce the entire batch, or axis: 1 for per-image mean
  }
}