【发布时间】:2016-11-22 22:38:35
【问题描述】:
可以在pycaffe中使用hdf5数据层从以下几行编写caffe prototxt:
import caffe
from caffe import layers as L
def logreg(hdf5, batch_size):
n = caffe.NetSpec()
n.data, n.label = L.HDF5Data(batch_size = batch_size, source = hdf5, ntop = 2)
n.ip1 = L.InnerProduct(n.data, num_output = 2, weight_filler = dict(type='xavier'))
n.accuracy = L.Accuracy(n.ip1, n.label)
n.loss = L.SoftmaxWithLoss(n.ip1, n.label)
return n.to_proto()
with open('models/logreg_auto_train.prototxt', 'w') as f:
f.write(str(logreg('data/train.txt', chunck_size)))
有没有可能用类似的方法写一个有内存数据层的prototxt?
【问题讨论】: