Ejemplo n.º 1
0
def parse_args():
    parser = ArgumentParser(description='runs the obb_anns.py file')
    parser.add_argument('ROOT',
                        type=str,
                        help='path to the root of the dataset directory')
    parser.add_argument('ANNS',
                        type=str,
                        help='name of the annotation file to use')
    parser.add_argument('PROPOSAL',
                        type=str,
                        nargs='?',
                        help='name of the proposals json')
    return parser.parse_args()


if __name__ == '__main__':
    args = parse_args()

    a = OBBAnns(join(args.ROOT, args.ANNS))
    a.load_annotations()
    a.set_annotation_set_filter(['deepscores'])
    if args.PROPOSAL:
        a.load_proposals(join(args.ROOT, args.PROPOSAL))
    for i in range(len(a)):
        a.visualize(img_idx=i, show=False)
        # a.visualize(img_idx=i, img_dir='images_png')
        response = input('Press q to quit or enter to continue.')
        if response == 'q':
            break
Ejemplo n.º 2
0
from obb_anns import OBBAnns
from argparse import ArgumentParser


def parse_args():
    parser = ArgumentParser(description='runs the obb_anns.py file')
    parser.add_argument('ROOT', type=str,
                        help='path to the root of the dataset directory')
    parser.add_argument('ANNS', type=str,
                        help='name of the annotation file to use')
    parser.add_argument('PROPOSAL', type=str, nargs='?',
                        help='name of the proposals json')
    return parser.parse_args()


if __name__ == '__main__':
    args = parse_args()

    a = OBBAnns(join(args.ROOT, args.ANNS))
    a.load_annotations()
    a.set_annotation_set_filter(['deepscores'])
    if args.PROPOSAL:
        a.load_proposals(join(args.ROOT, args.PROPOSAL))
    for i in range(len(a)):
        a.visualize(img_idx=i)
        # a.visualize(img_idx=i, img_dir='images_png')
        response = input('Press q to quit or enter to continue.')
        if response == 'q':
            break

Ejemplo n.º 3
0
            print_text_label(pos, parsed_comments['rel_position'], '#ffffff',
                             '#0a7313')

    return draw


ann = OBBAnns('../scanned_ds/ili_scores.json')
ann.load_annotations()
data_root = '../scanned_ds'
out_dir = 'out_ili'
annotation_set = 'deepscores'
annotation_set = ann.annotation_sets.index(annotation_set)
ann.chosen_ann_set = ann.chosen_ann_set[annotation_set]
for img_info in ann.img_info:
    img_id = img_info['id']
    ann.visualize(img_id=img_id, data_root=data_root, out_dir=out_dir)
    # img_info, ann_info = ann.get_img_ann_pair(ids=[img_id])
    # img_info, ann_info = img_info[0], ann_info[0]
    #
    # # Get the data_root from the ann_file path if it doesn't exist
    # if data_root is None:
    #     data_root = osp.split(ann.ann_file)[0]
    #
    # img_dir = osp.join(data_root, 'images')
    #
    # # Get the actual image filepath and the segmentation filepath
    # img_fp = osp.join(img_dir, img_info['filename'])
    # print(f'Visualizing {img_fp}...')
    #
    # # Remember: PIL Images are in form (h, w, 3)
    # img = Image.open(img_fp)