예제 #1
0
def generate_name_of_result_folder(args):
    global_opts = get_global_opts()

    results_path = os.path.join(global_opts['result_path'], 'cluster-training')
    if 'vis' == args['startnet']:
        startnetstr = 'map1'
    elif 'cs' == args['startnet']:
        startnetstr = 'map0'
    elif 'pola' == args['startnet']:
        startnetstr = 'map2'
    else:
        startnetstr = 'other'

    cluster_str = 'features%d' % (args['max_features_per_image'])

    if args['feature_hinge_loss_weight'] == 0:
        result_folder = 'cluster-%s-%s-cn%d-ci%d-vi%d' % (
            args['corr_set'], startnetstr, args['n_clusters'],
            args['cluster_interval'], args['val_interval'])
    else:
        result_folder = 'cluster-%s-%s-cn%d-ci%d-vi%d-ws%.5f-wf%.5f-%s-valm' % (
            args['corr_set'], startnetstr, args['n_clusters'],
            args['cluster_interval'], args['val_interval'],
            args['seg_loss_weight'], args['feature_hinge_loss_weight'],
            cluster_str)

    return os.path.join(results_path, result_folder), os.path.join(
        global_opts['result_path'], result_folder)
def get_path_of_startnet(args):
    global_opts = get_global_opts()

    if args['startnet'] == 'vis':
        return os.path.join(global_opts['result_path'], 'base-networks',
                            'pspnet101_cs_vis.pth')
    elif args['startnet'] == 'cs':
        return os.path.join(global_opts['result_path'], 'base-networks',
                            'pspnet101_cityscapes.pth')
예제 #3
0
def get_path_of_startnet(args):
    global_opts = get_global_opts()

    if args['include_vistas']:
        if args['corr_set'] == 'rc':
            return os.path.join(global_opts['result_path'], 'base-networks',
                                'pspnet101_cs_vis_rc.pth')
        elif args['corr_set'] == 'cmu':
            return os.path.join(global_opts['result_path'], 'base-networks',
                                'pspnet101_cs_vis_cmu.pth')
    else:
        if args['corr_set'] == 'rc':
            return os.path.join(global_opts['result_path'], 'base-networks',
                                'pspnet101_cs_rc.pth')
        elif args['corr_set'] == 'cmu':
            return os.path.join(global_opts['result_path'], 'base-networks',
                                'pspnet101_cs_cmu.pth')
예제 #4
0
def generate_name_of_result_folder(args):
    global_opts = get_global_opts()

    results_path = os.path.join(global_opts['result_path'], 'corr-training')

    if args['classes_to_ignore'] is None:
        ignore_classes = 0
    else:
        ignore_classes = 1

    if (args['corr_loss_type'] == 'class') or (args['corr_loss_type'] == 'KL'):
        args['feat_dist_threshold_match'] = 0
        args['feat_dist_threshold_nomatch'] = 0

    result_folder = 'corr-%s-map%d-%s-w%.5f-%.2f-%.2f-%d-%d-%d-seg-w%.5f-%.10flr' % (
        args['corr_set'], args['include_vistas'], args['corr_loss_type'],
        args['corr_loss_weight'], args['feat_dist_threshold_match'],
        args['feat_dist_threshold_nomatch'],
        args['n_iterations_before_corr_loss'], ignore_classes,
        args['remove_same_class'], args['seg_loss_weight'], args['lr'])

    return os.path.join(results_path, result_folder)
        ]
        network_folder = args['network_file'][:slash_inds[-1]]
        network_file = args['network_file']

    # folder should have same name as for trained network
    if args['validation_metric'] == 'miou':
        save_folder = os.path.join(network_folder, args['save_folder_name'])
    elif args['validation_metric'] == 'acc':
        save_folder = os.path.join(network_folder,
                                   args['save_folder_name'] + '_acc')

    segment_images_in_folder(network_file, args['img_path'], save_folder, args)


if __name__ == '__main__':
    global_opts = get_global_opts()

    args = {
        'use_gpu':
        True,
        # 'miou' (miou over classes present in validation set), 'acc'
        'validation_metric':
        'miou',
        'img_set':
        '',  # ox-vis, cmu-vis, wilddash , ox, cmu, cityscapes overwriter img_path, img_ext and save_folder_name. Set to empty string to ignore
        'img_path':
        '/semseg/testimg/val',
        # 'img_ext': '.png',
        'img_ext':
        '.jpg',
        'save_folder_name':