Skip to content

Instantly share code, notes, and snippets.

@ashnair1
ashnair1 / coco_cat_count.py
Last active May 9, 2019 08:02
Count occurrences of categories from COCO annotation format
import numpy as np
import json
import matplotlib.pyplot as plt
from collections import Counter
# For jupyter notebook
#%matplotlib inline
# TODO: Clean up this code
@ashnair1
ashnair1 / image_slicer.py
Last active May 8, 2019 08:49
Script to slice image into a set number of tiles
import image_slicer
from PIL import Image
def parser():
arg_parser = argparse.ArgumentParser('Image Slicer')
arg_parser.add_argument('--image', help='Image to be sliced')
arg_parser.add_argument('--num_tiles', help='Number of tiles')
arg_parser.add_argument('--save_tiles', help="Save tiles",action='store_true')
arg_parser.add_argument('--tiles_dir',help="Directory to store tiles",type=str)
return arg_parser.parse_args()
@ashnair1
ashnair1 / size_comparison.py
Created May 8, 2019 07:47
Comparing size of objects with respect to image
"""
Script for visualising the size comparison between the object and the image to determine accurate anchor sizes
"""
from PIL import Image
import numpy as np
img_size = (1024,1024)
obj_size = (16,16)