MCPcopy
hub / github.com/msracver/Deformable-ConvNets / __init__

Method __init__

lib/dataset/pycocotools/coco.py:62–82  ·  view source on GitHub ↗

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:

(self, annotation_file=None)

Source from the content-addressed store, hash-verified

60
61class COCO:
62 def __init__(self, annotation_file=None):
63 """
64 Constructor of Microsoft COCO helper class for reading and visualizing annotations.
65 :param annotation_file (str): location of annotation file
66 :param image_folder (str): location to the folder that hosts images.
67 :return:
68 """
69 # load dataset
70 self.dataset = {}
71 self.anns = []
72 self.imgToAnns = {}
73 self.catToImgs = {}
74 self.imgs = {}
75 self.cats = {}
76 if not annotation_file == None:
77 print 'loading annotations into memory...'
78 tic = time.time()
79 dataset = json.load(open(annotation_file, 'r'))
80 print 'Done (t=%0.2fs)'%(time.time()- tic)
81 self.dataset = dataset
82 self.createIndex()
83
84 def createIndex(self):
85 # create index

Callers

nothing calls this directly

Calls 2

createIndexMethod · 0.95
loadMethod · 0.45

Tested by

no test coverage detected