youngwan lee
youngwan lee

Reputation: 113

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

I tried to make train/val.prototxt using leveldb by caffe python interface:

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 }
}

But in caffe python interface, I can't find a proper datalayer python wrapper(e.g., L.MemoryData) even though I tried to find examples and tutorials in BLVC/caffe page.

Could you notice which 'L.xxx' layer I can use it?

Upvotes: 1

Views: 155

Answers (1)

Shai
Shai

Reputation: 114866

Using caffe.NetSpec() interface, you can have all the layers you want:

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})

Basically, L.<layer type> defines a layer of type <layer type>.

Upvotes: 1

Related Questions