def lenethdf5(hdf5 , batch_size):
# Net: a series of linear and simple nonlinear transformations
n = caffe.NetSpec()
n.data, n.label = L.HDF5Data(batch_size=batch_size, source=hdf5,ntop=2)
# the base net
n.conv1, n.relu1 = conv_relu(n.data, 32)
n.pool1 = max_pool(n.relu1)
n.conv2, n.relu2 = conv_relu(n.pool1, 64)
n.pool2 = max_pool(n.relu2)
n.conv3, n.relu3 = conv_relu(n.pool2, 128)
n.pool3 = max_pool(n.relu3)
# fully convolutional
n.fc1, n.rlfc1 = conv_relu(n.pool3, 512, ks=3, pad=1)
n.decov5 = deconv(n.rlfc1, 128, pad=1)
n.relu5, n.conv5 = relu_conv(n.decov5, 128, pad=0)
n.decov6 = deconv(n.conv5, 64, pad=1)
n.relu6, n.conv6 = relu_conv(n.decov6, 64, pad=0)
n.decov7 = deconv(n.conv6, 32, pad=1)
n.relu7, n.conv7 = relu_conv(n.decov7, 32, pad=0)
n.relu8, n.conv8 = relu_conv(n.conv7, 2, pad=0)
n.accuracy= L.Accuracy(n.conv8, n.label)
n.loss = L.SoftmaxWithLoss(n.conv8, n.label)
return n.to_proto()
# create file prototxt for training and validation
评论列表
文章目录