jaclearn.vision.coco.pycocotools.coco#
Classes
Class COCO
- class COCO[source]#
Bases:
object
- __init__(annotation_file=None)[source]#
Constructor of Microsoft COCO helper class for reading and visualizing annotations. :param annotation_file (str): location of annotation file :param image_folder (str): location to the folder that hosts images. :return:
- __new__(**kwargs)#
- annToMask(ann)[source]#
Convert annotation which can be polygons, uncompressed RLE, or RLE to binary mask. :return: binary mask (numpy 2D array)
- annToRLE(ann)[source]#
Convert annotation which can be polygons, uncompressed RLE to RLE. :return: binary mask (numpy 2D array)
- download(tarDir=None, imgIds=[])[source]#
Download COCO images from mscoco.org server. :param tarDir (str): COCO results directory name
imgIds (list): images to be downloaded
- Returns:
- getAnnIds(imgIds=[], catIds=[], areaRng=[], iscrowd=None)[source]#
Get ann ids that satisfy given filter conditions. default skips that filter :param imgIds (int array) : get anns for given imgs
catIds (int array) : get anns for given cats areaRng (float array) : get anns for given area range (e.g. [0 inf]) iscrowd (boolean) : get anns for given crowd label (False or True)
- Returns:
ids (int array) : integer array of ann ids
- getCatIds(catNms=[], supNms=[], catIds=[])[source]#
filtering parameters. default skips that filter. :param catNms (str array) : get cats for given cat names :param supNms (str array) : get cats for given supercategory names :param catIds (int array) : get cats for given cat ids :return: ids (int array) : integer array of cat ids
- getImgIds(imgIds=[], catIds=[])[source]#
Get img ids that satisfy given filter conditions. :param imgIds (int array) : get imgs for given ids :param catIds (int array) : get imgs with all given cats :return: ids (int array) : integer array of img ids
- loadAnns(ids=[])[source]#
Load anns with the specified ids. :param ids (int array) : integer ids specifying anns :return: anns (object array) : loaded ann objects
- loadCats(ids=[])[source]#
Load cats with the specified ids. :param ids (int array) : integer ids specifying cats :return: cats (object array) : loaded cat objects
- loadImgs(ids=[])[source]#
Load anns with the specified ids. :param ids (int array) : integer ids specifying img :return: imgs (object array) : loaded img objects
- loadNumpyAnnotations(data)[source]#
Convert result data from a numpy array [Nx7] where each row contains {imageID,x1,y1,w,h,score,class} :param data (numpy.ndarray) :return: annotations (python nested list)