import sys import os sys.path.append("/projects/caffe-ssd/python") import caffe net = caffe.NetSpec() net.data, net.label = caffe.layers.Data( name="InputData", source="train_lmdb", backend = caffe.params.Data.LMDB, batch_size=32, ntop=2, include=dict(phase=caffe.TRAIN), transform_param=dict( crop_size=227, mean_value=[104, 117, 123], mirror=True ) ) net.myconv = caffe.layers.Convolution( net.data, kernel_size=3, stride=1, pad=1, num_output=20, group=2, weight_filler=dict(type='xavier'), bias_filler=dict(type='constant',value=0)) net.myrelu = caffe.layers.ReLU(net.myconv, in_place=True) print(str(net.to_proto())) 输出: layer { name: "InputData" type: "Data" top: "data" top: "label" include { phase: TRAIN } transform_param { mirror: true crop_size: 227 mean_value: 104.0 mean_value: 117.0 mean_value: 123.0 } data_param { source: "train_lmdb" batch_size: 32 backend: LMDB } } layer { name: "myconv" type: "Convolution" bottom: "data" top: "myconv" convolution_param { num_output: 20 pad: 1 kernel_size: 3 group: 2 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.0 } } } layer { name: "myrelu" type: "ReLU" bottom: "myconv" top: "myconv" }