使用多个 tmdbs 在 caffe 中随机播放

Shuffle in caffe with multiple tmdbs

我正在使用 caffe 和 lmdb 数据库将我的数据提供给网络。但是,我有两个不同的 lmdbs 用于输入和 ground_truth,因为我的 ground_truth 也是图像。无论如何都可以使用随机播放吗?如果是,我可以为两个 lmdbs 设置 shuffle: true 作为参数吗?

layer {
  name: "data"
  type: "Data"
  top: "data"
  include {
    phase: TRAIN
  }
  transform_param {
    mean_value: X
  }
  data_param {
    source: "..."
    batch_size: X
    backend: LMDB
  }
  1. 如果你使用图层类型 "Data" 你不能使用 shuffle 因为 data_param.

    [= 中没有 shuffle 参数34=]
  2. 至于层类型 "ImageData" 你不能使用 lmdb 作为数据源因为 source 文件应该是一个文本文件 image address and label .但它有 shuffle 参数。如果你往里看 image_data_layer.cpp you'll find if shuffle is true then image sources are shuffled in each epoch using Fisher–Yates algorithm。如果您使用两个不同的 ImageData 层,那么每个层都会调用 ShuffleImages() 并且两次随机播放不太可能生成相同的序列。所以你不能在这两个 ImageData 层中的任何一个中使用 shuffle