简体   繁体   中英

How to create Data layer in caffe?

I have a caffe code in Python version. That python code has a data layer like

name: "hidden_seed"
type: "NumpyData"
top: "hidden_seed"

I like to crate in c++ caffe as

layer{
    name: "hidden_seed"
    type: "Data"
    top: "hidden_seed"      
}

My query is how to create a data layer with size 300 x 250 with 0 value initialized.

I looked at data layers in caffe and available data layers are

Layers:

    Image Data - read raw images.
    Database - read data from LEVELDB or LMDB.
    HDF5 Input - read HDF5 data, allows data of arbitrary dimensions.
    HDF5 Output - write data as HDF5.
    Input - typically used for networks that are being deployed.
    Window Data - read window data file.
    Memory Data - read data directly from memory.
    Dummy Data - for static data and debugging.

Which one is suitable for the Data layer what I like to have and how to initialize 0 value for each cell?

It seems like "DummyData" layer will do the job for you:

layer {
  type: "DummyData"
  name: "hidden_seed"
  top: "hidden_seed"
  dummy_data_param {
    shape { dim: 300 dim: 250 }  # your desired data shape
    data_filler { type: "constant" value: 0 } # fill with all zeros
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM