MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / load

Method load

examples/FasterRCNN/dataset/coco.py:93–120  ·  view source on GitHub ↗

Args: add_gt: whether to add ground truth bounding box annotations to the dicts add_mask: whether to also add ground truth mask Returns: a list of dict, each has keys including: 'image_id', 'file_name', and (if add

(self, add_gt=True, add_mask=False)

Source from the content-addressed store, hash-verified

91 return ret
92
93 def load(self, add_gt=True, add_mask=False):
94 """
95 Args:
96 add_gt: whether to add ground truth bounding box annotations to the dicts
97 add_mask: whether to also add ground truth mask
98
99 Returns:
100 a list of dict, each has keys including:
101 'image_id', 'file_name',
102 and (if add_gt is True) 'boxes', 'class', 'is_crowd', and optionally
103 'segmentation'.
104 """
105 with timed_operation('Load annotations for {}'.format(
106 os.path.basename(self.annotation_file))):
107 img_ids = self.coco.getImgIds()
108 img_ids.sort()
109 # list of dict, each has keys: height,width,id,file_name
110 imgs = self.coco.loadImgs(img_ids)
111
112 for idx, img in enumerate(tqdm.tqdm(imgs)):
113 img['image_id'] = img.pop('id')
114 img['file_name'] = os.path.join(self._imgdir, img['file_name'])
115 if idx == 0:
116 # make sure the directories are correctly set
117 assert os.path.isfile(img["file_name"]), img["file_name"]
118 if add_gt:
119 self._add_detection_gt(img, add_mask)
120 return imgs
121
122 def _add_detection_gt(self, img, add_mask):
123 """

Callers 13

training_roidbsMethod · 0.95
inference_roidbsMethod · 0.95
run_testFunction · 0.45
run_testFunction · 0.45
load-resnet.pyFile · 0.45
get_dataFunction · 0.45
compute_mean_stdFunction · 0.45
_evalMethod · 0.45
training_roidbsMethod · 0.45
coco.pyFile · 0.45
convert_d2.pyFile · 0.45
get_dataFunction · 0.45

Calls 5

_add_detection_gtMethod · 0.95
timed_operationFunction · 0.90
formatMethod · 0.80
basenameMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected