【发布时间】:2018-04-08 14:27:43
【问题描述】:
我正在尝试通过喂一个包含所有 Blob 的 Blob 来测试我的 caffe 模型。所以我通过以下方式形成了一个 hdf5 文件:
import h5py, os
import numpy as np
SIZE = 227 # fixed size to all images
X = np.ones((1, 3, SIZE, SIZE), dtype='f8')
with h5py.File('test_idty.h5','w') as H:
H.create_dataset('img', data=X )
with open('test_h5_idty_list.txt','w') as L:
L.write( '/home/wei/deep_metric/test_idty.h5' )
然后,我将我的 caffe prototxt 更改为:
layer{
name:"data"
type:"HDF5Data"
top:"img"
include:{
phase:TEST
}
hdf5_data_param{
source:"/home/wei/deep_metric/test_h5_idty_list.txt"
batch_size:1
}
}
然后,我尝试确保我的数据通过以下方式正确输入:
net = caffe.Net(Model,Pretrained,caffe.TEST)
data = net.blobs['img'].data.copy()
但是,这给了我矩阵中的所有零。 有什么办法解决吗?
赞赏!
【问题讨论】:
-
@Shai 非常感谢!我想我错过了转发功能。现在可以了。
标签: neural-network deep-learning caffe hdf5 pycaffe