Exemple #1
0
def make_context(options):
    deploy_net = caffe.NetSpec()
    deploy_net.data = network.make_input_data(
        options.input_size, options.classes)
    last, final_name = network.build_context(
        deploy_net, deploy_net.data, options.classes, options.layers)
    if options.up:
        deploy_net.upsample = network.make_upsample(last, options.classes)
        last = deploy_net.upsample
    deploy_net.prob = network.make_prob(last)
    deploy_net = deploy_net.to_proto()
    return deploy_net, final_name
Exemple #2
0
def make_joint(options, is_training):
    batch_size = options.train_batch if is_training else options.test_batch
    image_path = options.train_image if is_training else options.test_image
    label_path = options.train_label if is_training else options.test_label
    net = caffe.NetSpec()
    net.data, net.label = network.make_image_label_data(
        image_path, label_path, batch_size, is_training, options.crop_size,
        options.mean)
    last = network.build_frontend_vgg(net, net.data, options.classes)[0]
    last = network.build_context(net, last, options.classes, options.layers)[0]
    if options.up:
        net.upsample = network.make_upsample(last, options.classes)
        last = net.upsample
    net.loss = network.make_softmax_loss(last, net.label)
    if not is_training:
        net.accuracy = network.make_accuracy(last, net.label)
    return net.to_proto()
Exemple #3
0
def make_context(options, is_training):
    batch_size = options.train_batch if is_training else options.test_batch
    image_path = options.train_image if is_training else options.test_image
    label_path = options.train_label if is_training else options.test_label
    net = caffe.NetSpec()
    net.data, net.label = network.make_bin_label_data(
        image_path, label_path, batch_size,
        options.label_shape, options.label_stride)
    last = network.build_context(
        net, net.data, options.classes, options.layers)[0]
    if options.up:
        net.upsample = network.make_upsample(last, options.classes)
        last = net.upsample
    net.loss = network.make_softmax_loss(last, net.label)
    if not is_training:
        net.accuracy = network.make_accuracy(last, net.label)
    return net.to_proto()