如何使用leveldb和pycaffe界面中可以使用哪种数据层?

时间:2016-09-12 15:42:45

标签: python neural-network deep-learning caffe pycaffe

我尝试使用leveldb通过caffe python接口制作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界面中,即使我试图在BLVC / caffe页面中找到示例和教程,我也找不到合适的数据层python包装器(例如,L.MemoryData)。

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

1 个答案:

答案 0 :(得分:1)

使用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>类型的图层。