在没有数据重新生成的情况下使用 prototxt 在 caffe 中进行标签平滑

Label smoothing in caffe with prototxt without data regeneration

我在 LMDB (40Gb) 中有一个巨大的数据集,我用它来训练带有 caffe 的二元分类器。

Caffe 中的数据层包含整数标签。

是否有任何现成的层可以通过添加一些随机抖动将它们转换为浮点数,因此我可以应用标签平滑技术,如 7.5.1 中所述here

我看过 HDF5 的示例,但它们需要重新生成数据集,我想避免它。

可以用DummyData layer to generate the random noise you wish to add to the labels. Once you have the noise, use Eltwise层来总结:

layer {
  name: "noise"
  type: "DummyData"
  top: "noise"
  dummy_data_param {
    shape { dim: 10 dim: 1 dim: 1 dim: 1 } # assuming batch size = 10
    data_filler { type: "uniform" min: -0.1 max: 0.1 } # noise ~U(-0.1, 0.1) 
  }
}
layer {
  name: "label_noise"
  type: "Eltwise"
  bottom: "label"  # the input integer labels
  bottom: "noise"
  top: "label_noise"
  eltwise_param { operation: SUM }
}