利用python可以创建caffe的网络定义的prototxt文件,利用这种方法的一个好处就是:可以保证training,testing和deploy网络的一致性!
下面是利用python编写train和test的prototxt文件的一个小事例:
import caffe
from caffe import layers as L
from caffe import params as P
# Function: Set lenet net
def init_net_lenet(netName,netType,batch_size,prototxt_root,data_root):
# --------
# set the type and name of the net, e.g., train_lenet, or test_lenet
NetTypeName = netType +