我有一个原型文件如下:
layer {
name: "data"
type: "HDF5Data"
top: "data1"
top: "data2"
top: "label"
include {
phase: TRAIN
}
hdf5_data_param {
source: "./source_list.txt"
batch_size: 2
shuffle: true
}
}
layer {
name: "concat"
type: "Concat"
bottom: "data1"
bottom: "data2"
top: "data"
concat_param {
concat_dim:1
}
}
我想在python中使用caffe NetSpec生成上面的prototxt。但是,这是错误的。这是我的代码。请帮我修理一下。感谢
from caffe import layers as L
...
n = caffe.NetSpec()
n.data, n.label = L.HDF5Data(top=["data1", "data2"], batch_size=2,
source="./source_list.txt", ntop=2,shuffle= True,
include={'phase': caffe.TRAIN})
n.concat = L.Concat(n.data["data1"], n.data["data2"])
答案 0 :(得分:3)
您需要有两个data
输出
n.data1, n.data2, n.label = L.HDF5Data(ntop=3, name="data",
hdf5_data_param={'source': "./source_list.txt",
'shuffle': True,
'batch_size': 2}
include={'phase': caffe.TRAIN})
n.data = L.Concat(n.data1, n.data2, name="concat", concat_param={'concat_dim':1})