如何使用 leveldb 以及我可以在 pycaffe 界面中使用什么样的数据层?

How to use leveldb and What kind of dataLayer I can use in pycaffe interface?

我尝试通过 caffe python 接口使用 leveldb 制作 train/val.prototxt:

layer {
  name: "cifar"
  type: "Data"
  top: "data"
  top: "label"
  data_param {
    source: "/home/youngwan/data/cifar10/cifar10-gcn-leveldb-splits/cifar10_full_train_leveldb_padded"
    batch_size: 100
    backend: LEVELDB
  }
  transform_param {
    mean_file: "/home/youngwan/data/cifar10/cifar10-gcn-leveldb-splits/paddedmean.binaryproto"
    mirror: 1
    crop_size: 32
  }
  include: { phase: TRAIN }
}

但是在 caffe python 接口中,我找不到合适的数据层 python 包装器(例如,L.MemoryData),尽管我试图在 [=] 中找到示例和教程20=]页。

你能注意到我可以使用哪个 'L.xxx' 层吗?

使用caffe.NetSpec()界面,你可以拥有你想要的所有图层:

from caffe import layers as L, params as P
cifar = L.Data(data_param={'source': '/home/youngwan/data/cifar10/cifar10-gcn-leveldb-splits/cifar10_full_train_leveldb_padded', 
                           'batch_size': 100,
                           'backend': P.Data.LEVELDB},
               transform_param={'mean_file': '/home/youngwan/data/cifar10/cifar10-gcn-leveldb-splits/paddedmean.binaryproto',
                                'mirror': 1,
                                'crop_size': 32},
               include={'phase':caffe.TRAIN})

基本上,L.<layer type> 定义了一个类型为 <layer type> 的图层。