def modeltest(hdf5s, hdf5t, batch_size): #logistic regression: data, matrix multiplication, and 2-class softmax loss n = caffe.NetSpec() #n.data, n.lp_label, n.bag_label = L.HDF5Data(batch_size=batch_size, source=hdf5t, ntop=3) #n.data, n.lp_label, n.instance_label = L.HDF5Data(batch_size=batch_size, source=hdf5t, ntop=3) #n.data, n.lp_label = L.HDF5Data(batch_size=batch_size, source=hdf5t, ntop=2) n.data, n.lp_label, n.bag_label, n.instance_label = L.HDF5Data(batch_size=batch_size, source=hdf5t, ntop=4) n.dc_label=L.DummyData(data_filler=dict(type='constant', value=1), num=batch_size, channels=1, height=1, width=1) n.ip1 = L.InnerProduct(n.data, num_output=neuronL1, weight_filler=dict(type='xavier')) n.relu1 = L.Sigmoid(n.ip1, in_place=True) #n.dropout1 = L.Dropout(n.relu1, dropout_ratio=0.5) n.ip2 = L.InnerProduct(n.relu1, num_output=neuronL1-400, weight_filler=dict(type='xavier')) n.target_feature=L.Split(n.ip2) n.ip4 = L.InnerProduct(n.target_feature, num_output=1, weight_filler=dict(type='xavier')) #n.ip5=L.Sigmoid(n.ip4, in_place=True) #n.real, n.ip3 = L.Python(n.source_feature, n.lp_label, n.bag_label, module= 'missSVM', layer='missSVMLayer', ntop=2) #n.ip3 = L.InnerProduct(n.source_feature, num_output=1, weight_filler=dict(type='xavier')) #n.accuracy = L.Accuracy(n.ip4, n.lp_label) #L.Silence(n.bag_label); #n.losslp = L.Python(n.ip4, n.lp_label, n.bag_label, module = 'GMloss', layer='MultipleInstanceLossLayer') #n.P , n.Y = L.Python(n.ip4, n.lp_label, n.bag_label, module = 'MIloss', layer='MultipleInstanceLossLayer', ntop=2) #n.losslp = L.SigmoidCrossEntropyLoss(n.P, n.Y) n.losslp = L.SigmoidCrossEntropyLoss(n.ip4, n.lp_label) #n.losstlp = L.SigmoidCrossEntropyLoss(n.ip4, n.lp_label) n.grl= L.GradientScaler(n.ip2, lower_bound=0.0) n.ip11 = L.InnerProduct(n.grl, num_output=300, weight_filler=dict(type='xavier')) n.relu11 = L.Sigmoid(n.ip11, in_place=True) n.dropout11 = L.Dropout(n.relu11, dropout_ratio=0.5) n.ip12 = L.InnerProduct(n.dropout11, num_output=1, weight_filler=dict(type='xavier')) n.lossdc = L.SigmoidCrossEntropyLoss(n.ip12, n.dc_label, loss_weight=0.1) return n.to_proto()
def make_tiles(n, data): n_splits = 16 result = netset(n, "split", L.Split(data, ntop=n_splits)) tiles = netset(n, "merge", L.Concat(*result, axis=1)) conv = make_conv(data, n_splits, 5, 2, 1) eltwise = L.Eltwise(tiles, conv, operation=P.Eltwise.SUM) prelu = L.PReLU(eltwise, in_place=True) return n_splits, prelu
def lrcn_reinforce_wtd_deploy(self, save_name): self.n.tops['input_sentence'] = self.dummy_data_layer([1, self.N]) self.n.tops['cont_sentence'] = self.dummy_data_layer([1, self.N]) self.n.tops['image_features'] = self.dummy_data_layer( [self.N, self.feature_dim]) self.n.tops['lstm1_h0'] = self.dummy_data_layer( [1, self.N, self.lstm_dim]) self.n.tops['lstm1_c0'] = self.dummy_data_layer( [1, self.N, self.lstm_dim]) self.n.tops['lstm2_h0'] = self.dummy_data_layer( [1, self.N, self.lstm_dim]) self.n.tops['lstm2_c0'] = self.dummy_data_layer( [1, self.N, self.lstm_dim]) self.n.tops['input_sent_0'] = L.Split(self.n.tops['input_sentence']) self.n.tops['bottom_cont_0'] = L.Split(self.n.tops['cont_sentence']) self.make_caption_model(static_input='image_features') self.n.tops['probs'] = L.Split(self.n.tops['probs_0']) self.n.tops['probs'] = L.Split(self.n.tops['probs_0']) self.write_net(save_name)
def _make_module(model_path, n, i_channels, i_size): ns = caffe.NetSpec() ns.data = L.Input( name="data", input_param={"shape": { "dim": [n, i_channels, i_size[0], i_size[1]] }}) ns.sp1, ns.sp2 = L.Split(ns.data, name='split', ntop=2) ns.reverse1 = L.Reverse(ns.sp1, name="reverse1") ns.reverse2 = L.Reverse(ns.sp2, name="reverse2") with open(os.path.join(model_path, 'test.prototxt'), 'w') as f: f.write(str(ns.to_proto())) net = caffe.Net(f.name, caffe.TEST) net.save(os.path.join(model_path, 'test.caffemodel'))
def au_net_proto(self, batch_size, train=True): n = caffe.NetSpec() if train: source_data = '../prepare_data/train_data_lmdb' source_label = '../prepare_data/train_label_lmdb' else: source_data = '../prepare_data/test_data_lmdb' source_label = '../prepare_data/test_label_lmdb' n.data = L.Data( source=source_data, backend=P.Data.LMDB, batch_size=batch_size, ntop=1, transform_param=dict(scale=1. / 255), input_param=dict(shape=dict(dim=[batch_size, 3, 227, 227]))) n.label = L.Data(source=source_label, backend=P.Data.LMDB, batch_size=batch_size, ntop=1) n.conv1, n.conv1_bn, n.conv1_scale, n.conv1_relu = block_def.conv_bn_scale_relu( n.data, ks=11, nout=256, stride=4, pad=0) n.res0, n.conv2_bn, n.conv2_scale, n.conv2_relu = block_def.conv_bn_scale_relu( n.conv1, ks=11, nout=128, stride=4, pad=0) # 8 层 rpoly-2 for core layer for num in range(8): exec( 'n.conv{0}_1, n.relu{0}_1, n.conv{0}_2, n.relu{0}_2, n.conv{0}_3, n.relu{0}_3, n.res{0} = block_def.rPoly2(n.res{1})' .format(str(num + 1), str(num))) # Core Layer to 4 Attribute Layer n.res8_face, n.res8_eye, n.res8_eyebrow, n.res8_mouth = L.Split(n.res8, ntop=4) # 2 层 rpoly-2 for attribute layer -- Face Layer for num in range(2): exec( 'n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_3_{2}, ' 'n.res{0}_{2} = block_def.rPoly2(n.res{1}_{2})'.format( str(num + 8 + 1), str(num + 8), 'face')) # 2 层 rpoly-2 for attribute layer -- Eye Layer for num in range(2): exec( 'n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_3_{2}, ' 'n.res{0}_{2} = block_def.rPoly2(n.res{1}_{2})'.format( str(num + 8 + 1), str(num + 8), 'eye')) # 2 层 rpoly-2 for attribute layer -- Eyebrow Layer for num in range(2): exec( 'n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_3_{2}, ' 'n.res{0}_{2} = block_def.rPoly2(n.res{1}_{2})'.format( str(num + 8 + 1), str(num + 8), 'eyebrow')) # 2 层 rpoly-2 for attribute layer -- Mouth Layer for num in range(2): exec( 'n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_3_{2}, ' 'n.res{0}_{2} = block_def.rPoly2(n.res{1}_{2})'.format( str(num + 8 + 1), str(num + 8), 'mouth')) # Eye Layer to 2 AU Layer n.res10_AU6_7, n.res10_AU45 = L.Split(n.res10_eye, ntop=2) # 2 层 rpoly-3 for AU layer -- AU6_7 for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'AU6_7')) # 2 层 rpoly-3 for AU layer -- AU45 for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'AU45')) # Eyebrow Layer to 3 AU Layer n.res10_AU1, n.res10_AU2, n.res10_AU4 = L.Split(n.res10_eyebrow, ntop=3) # 2 层 rpoly-3 for AU layer -- AU1 for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'AU1')) # 2 层 rpoly-3 for AU layer -- AU2 for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'AU2')) # 2 层 rpoly-3 for AU layer -- AU4 for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'AU4')) # Mouth Layer to 3 AU Layer n.res10_Chin, n.res10_Lip, n.res10_Mouth_AU = L.Split(n.res10_mouth, ntop=3) # 2 层 rpoly-3 for AU layer -- Chin for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'Chin')) # 2 层 rpoly-3 for AU layer -- Lip_c & Lip_u for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'Lip')) # 2 层 rpoly-3 for AU layer -- Mouth_AU for num in range(2): exec('n.conv{0}_1_{2}, n.relu{0}_1_{2}, n.conv{0}_2_{2}, n.relu{0}_2_{2}, n.conv{0}_3_{2}, n.relu{0}_{2},' \ 'n.conv{0}_4_{2}, n.relu{0}_4_{2}, n.res{0}_{2}= block_def.rPoly3(n.res{1}_{2})' .format(str(num+10+1),str(num+10),'Mouth_AU')) return n.to_proto()
def vnet(phase, dataLayer, dataLayerParams): net = caffe.NetSpec() net.data, net.label = L.Python(module="VnetDataLayer", layer=dataLayer, ntop=2, param_str=str(dataLayerParams)) # net.conv_input = L.Convolution(net.data, convolution_param={"engine": 2, "kernel_size": 1, "stride": 1, "num_output": 16, "pad": 0}) net.split_input1, net.split_input2, net.split_input3, net.split_input4, net.split_input5, net.split_input6, net.split_input7, net.split_input8, net.split_input9, net.split_input10, net.split_input11, net.split_input12, net.split_input13, net.split_input14, net.split_input15, net.split_input16 = L.Split(net.data, ntop=16) net.concat_input = L.Concat(net.split_input1, net.split_input2, net.split_input3, net.split_input4, net.split_input5, net.split_input6, net.split_input7, net.split_input8, net.split_input9, net.split_input10, net.split_input11, net.split_input12, net.split_input13, net.split_input14, net.split_input15, net.split_input16) # left block 1 - 16 channel, size 64 net.left1_bn1, net.left1_relu1, net.left1_conv1, net.left1_bn2, net.left1_relu2, net.left1_conv2, net.left1_add = resUnit2( net.concat_input) net.pooling1 = L.Convolution(net.left1_add, convolution_param={"engine": 2, "kernel_size": 2, "stride": 2, "num_output": 32, "pad": 0}) # left block 2 - 32 channel, size 32 net.left2_bn1, net.left2_relu1, net.left2_conv1, net.left2_bn2, net.left2_relu2, net.left2_conv2, net.left2_bn3, net.left2_relu3, net.left2_conv3, net.left2_add = resUnit3( net.pooling1, numberOfOutput=32) net.pooling2 = L.Convolution(net.left2_add, convolution_param={"engine": 2, "kernel_size": 2, "stride": 2, "num_output": 64, "pad": 0}) # left block 3 - 64 channel, size 16 net.left3_bn1, net.left3_relu1, net.left3_conv1, net.left3_bn2, net.left3_relu2, net.left3_conv2, net.left3_bn3, net.left3_relu3, net.left3_conv3, net.left3_add = resUnit3( net.pooling2, numberOfOutput=64) net.pooling3 = L.Convolution(net.left3_add, convolution_param={"engine": 2, "kernel_size": 2, "stride": 2, "num_output": 128, "pad": 0}) # vally block - 128 channel, size 8 net.vally_bn1, net.vally_relu1, net.vally_conv1, net.vally_bn2, net.vally_relu2, net.vally_conv2, net.vally_bn3, net.vally_relu3, net.vally_conv3, net.vally_add = resUnit3( net.pooling3, numberOfOutput=128) net.depooling1 = L.Deconvolution(net.vally_add, convolution_param={"engine": 2, "kernel_size": 2, "stride": 2, "num_output": 64, "pad": 0}) # right block 1 - 128 channel, size 16 net.concat1 = L.Concat(net.left3_add, net.depooling1) net.right1_bn1, net.right1_relu1, net.right1_conv1, net.right1_bn2, net.right1_relu2, net.right1_conv2, net.right1_bn3, net.right1_relu3, net.right1_conv3, net.right1_add = resUnit3( net.concat1, numberOfOutput=128) net.depooling2 = L.Deconvolution(net.right1_add, convolution_param={"engine": 2, "kernel_size": 2, "stride": 2, "num_output": 32, "pad": 0}) # right block 2 - 32 channel, size 32 net.concat2 = L.Concat(net.left2_add, net.depooling2) net.right2_bn1, net.right2_relu1, net.right2_conv1, net.right2_bn2, net.right2_relu2, net.right2_conv2, net.right2_bn3, net.right2_relu3, net.right2_conv3, net.right2_add = resUnit3( net.concat2, numberOfOutput=64) net.depooling3 = L.Deconvolution(net.right2_add, convolution_param={"engine": 2, "kernel_size": 2, "stride": 2, "num_output": 16, "pad": 0}) # right block 3 - 16 channel, size 64 net.concat3 = L.Concat(net.left1_add, net.depooling3) net.right3_bn1, net.right3_relu1, net.right3_conv1, net.right3_bn2, net.right3_relu2, net.right3_conv2, net.right3_add = resUnit2( net.concat3, numberOfOutput=32) # output - 2 channel, size 64 net.conv_output = L.Convolution(net.right3_add, convolution_param={"engine": 2, "kernel_size": 1, "stride": 1, "num_output": 2, "pad": 0}) # reshape result and label net.flat_output = L.Reshape(net.conv_output, reshape_param={"shape": {"dim": [0, 2, -1]}}) net.flat_label = L.Reshape(net.label, reshape_param={"shape": {"dim": [0, 1, -1]}}) # softmax result net.softmax_output = L.Softmax(net.flat_output) if phase == "train": net.loss = L.DiceLoss(net.softmax_output, net.flat_label) elif phase == "test": net.accu = L.Accuracy(net.softmax_output, net.flat_label) elif phase == "deploy": net.result = L.Argmax(net.softmax_output, argmax_param={"axis": 1}) return str(net.to_proto())
def test_split(self): n = caffe.NetSpec() n.input1 = L.Input(shape=make_shape([6, 4, 64, 64])) n.output1, n.output2 = L.Split(n.input1, ntop=2) self._test_model(*self._netspec_to_model(n, 'split'))
def approximation(args): print('creating approximation...') # Start a network net = Unet3D.start(args) #UNET config net_depth = 3 net_width = 2 base_filters = 24 channels_in = 1 channels_out = base_filters # ReLU negative slope relu_slope = 0.005 strategy = [2, 2, 2] xs = [net.data] if args.nstreams > 1: xs = L.Split(net.data, ntop=args.nstreams) print('xs:', len(xs)) skip = [] # contracting part for d in range(net_depth): print('upsampling...', d) channels_out = base_filters * (3**d) x = Unet3D.vgg_block_approximation(args, xs, channels_in, channels_out) skip.append(x) # maxpool x = L.Pooling(x, pool=P.Pooling.MAX, kernel_size=strategy, stride=strategy, pad=[0], dilation=[1]) channels_in = channels_out xs = [x for _ in range(args.nstreams)] # bridge channels_out = base_filters * (3**net_depth) x = Unet3D.vgg_block_approximation(args, xs, channels_in, channels_out) # expanding channels_in = channels_out for d in reversed(range(net_depth)): print('downsampling...', d) x = L.Deconvolution(x, convolution_param=dict( num_output=channels_out, kernel_size=strategy, stride=strategy, pad=[0], group=1, dilation=[1], bias_term=False, weight_filler=dict(type='msra'), bias_filler=dict(type='constant'))) channels_out = base_filters * (3**(d)) x = L.Convolution(x, kernel_size=[1], stride=[1], dilation=[1], num_output=channels_out, pad=[0], param=[dict(lr_mult=1.0), dict(lr_mult=2.0)], weight_filler=dict(type='msra'), bias_filler=dict(type='constant')) x = L.MergeCrop(x, skip[d], forward=[1, 1], backward=[1, 1], operation=0) xs = [x for _ in range(args.nstreams)] x = Unet3D.vgg_block_approximation(args, xs, channels_in, channels_out) net = Unet3D.end(net, x) protonet = net.to_proto() protonet.name = 'net' # Store the network as prototxt with open(protonet.name + '.prototxt', 'w') as f: print(protonet, file=f)
def build_unet(p_pathDataIdx, p_numCls = 2, p_imageSize = 256, p_batchSize = 16, p_numFlt = 16, p_isInMemory = True, p_isCRFasRNN = False, p_isDeploy = False, p_numChannels = 3): net = caffe.NetSpec() pydata_params = { 'img_size': p_imageSize, 'batch_size': p_batchSize, 'path_idx': p_pathDataIdx, 'num_cls': p_numCls, 'is_in_memory': p_isInMemory } if p_isDeploy: net.data = L.Input(input_param={ 'shape': { 'dim':[ p_batchSize, p_numChannels, p_imageSize, p_imageSize] } }) else: net.data, net.labels = L.Python(module='data_layer_segm', layer='DataLayerSegmV1', ntop=2, param_str=str(pydata_params)) # Encoder nflt1 = p_numFlt * (2 ** 0) net.conv1_1, net.relu1_1 = conv_relu(net.data, nflt1 , pad=1, ks=3) net.conv1_2, net.relu1_2 = conv_relu(net.relu1_1, nflt1, pad=1, ks=3) net.pool1 = max_pool(net.relu1_2) # nflt2 = p_numFlt * (2 ** 1) net.conv2_1, net.relu2_1 = conv_relu(net.pool1, nflt2, pad=1, ks=3) net.conv2_2, net.relu2_2 = conv_relu(net.relu2_1, nflt2, pad=1, ks=3) net.pool2 = max_pool(net.relu2_2) # nflt3 = p_numFlt * (2 ** 2) net.conv3_1, net.relu3_1 = conv_relu(net.pool2, nflt3, pad=1, ks=3) net.conv3_2, net.relu3_2 = conv_relu(net.relu3_1, nflt3, pad=1, ks=3) net.pool3 = max_pool(net.relu3_2) # nflt4 = p_numFlt * (2 ** 4) net.conv4_1, net.relu4_1 = conv_relu(net.pool3, nflt4, pad=1, ks=3) net.conv4_2, net.relu4_2 = conv_relu(net.relu4_1, nflt4, pad=1, ks=3) net.pool4 = max_pool(net.relu4_2) # nflt5 = p_numFlt * (2 ** 5) net.conv5_1, net.relu5_1 = conv_relu(net.pool4, nflt5, pad=1, ks=3) net.conv5_2, net.relu5_2 = conv_relu(net.relu5_1, nflt5, pad=1, ks=3) net.pool5 = max_pool(net.relu5_2) # # Decoder nfltup_0 = p_numFlt * (2 ** 2) net.upconv0, net.uprelu0 = conv_relu(net.pool5, nfltup_0, pad=0, ks=1) # nfltup_1 = p_numFlt * (2 ** 1) net.upsamle1_x4 = upsample2d(net.uprelu0, nfltup_0, psize=4) net.concat1 = L.Concat(net.upsamle1_x4, net.relu4_2) net.upconv1, net.uprelu1 = conv_relu(net.concat1, nfltup_1, pad=1, ks=3) # nfltup_2 = p_numFlt * (2 ** 0) net.upsamle2_x4 = upsample2d(net.uprelu1, nfltup_1, psize=4) net.concat2 = L.Concat(net.upsamle2_x4, net.relu2_2) net.upconv2, net.uprelu2 = conv_relu(net.concat2, nfltup_2, pad=1, ks=3) # net.upsamle3_x2 = upsample2d(net.uprelu2, nfltup_2, psize=2) # net.upconv3, net.score = conv_relu(net.upsamle3_x2, nfltup_3, pad=0, ks=1) # # Output if not p_isCRFasRNN: net.score = L.Convolution(net.upsamle3_x2, kernel_size=1, stride=1, num_output=p_numCls, pad=0, weight_filler=dict(type='xavier')) else: net.coarse_map = L.Convolution(net.upsamle3_x2, kernel_size=1, stride=1, num_output=p_numCls, pad=0, weight_filler=dict(type='xavier')) net.split_unary, net.split_q0 = L.Split(net.coarse_map, ntop = 2) net.crfmap = L.MultiStageMeanfield(net.split_unary, net.split_q0, net.data, param = [{'lr_mult': 200}, {'lr_mult': 200}, {'lr_mult': 200}], multi_stage_meanfield_param = { 'num_iterations': 5, 'compatibility_mode': 0, #POTTS # # Initialize the compatilibity transform matrix with a matrix whose diagonal is -1. 'threshold': 2, 'theta_alpha': 160, 'theta_beta': 3, 'theta_gamma': 3, 'spatial_filter_weight': 3, 'bilateral_filter_weight': 5 }) if p_isDeploy: if p_isCRFasRNN: net.prob = L.Softmax(net.crfmap) else: net.prob = L.Softmax(net.score) else: if p_isCRFasRNN: net.loss = L.SoftmaxWithLoss(net.crfmap, net.labels) # net.prob = L.Softmax(net.crfmap, include={'phase': caffe.TEST}) net.acc = L.Accuracy(net.prob, net.labels, include={'phase': caffe.TEST}) else: net.loss = L.SoftmaxWithLoss(net.score, net.labels) # net.prob = L.Softmax(net.score, include={'phase': caffe.TEST}) net.acc = L.Accuracy(net.prob, net.labels, include={'phase': caffe.TEST}) return net.to_proto()
def split(bottom): return L.Split(bottom)