def logreg(hdf5, batch_size):
# logistic regression: data, matrix multiplication, and 2-class softmax loss
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()
评论列表
文章目录