python - 如何在caffe中创建数据层?

标签 python c++ neural-network deep-learning caffe

我有一个 Python 版本的 caffe 代码。 那个 python 代码有一个 data layer like

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

我喜欢用 c++ caffe 作为

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

我的问题是如何创建一个大小为 300 x 250 且初始化值为 0 的数据层。

我查看了 caffe 中的数据层,可用的数据层是

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.

我喜欢的Data层哪个适合,每个cell如何初始化为0值?

最佳答案

好像"DummyData"图层将为您完成这项工作:

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

关于python - 如何在caffe中创建数据层?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42500383/

相关文章:

c++ - 从以 blob 数据类型存储在数据库中的原始图像数据中检索 CImage 对象

neural-network - Yolo v3 不能设置少于三个的边界框吗?

machine-learning - 优化神经网络输入以实现收敛

Python ValueError : too many values to unpack

c++ - 拆分临界区并两次锁定互斥量是否有助于提高性能?

python - 生成倾斜正弦波的图像

c++ - 通过 bash 脚本查找和修改函数定义 (C++)

machine-learning - 噪声训练损失

python - 创建一个以维数、均值和方差为参数的 numpy 数组?

python Reportlab 段落中同一行中的两个项目