MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / createIndexforResults

Method createIndexforResults

eval/CIPO_evaluation/adapter.py:147–176  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

145 self.cats = cats
146
147 def createIndexforResults(self):
148 # create index
149 print('creating index...')
150 anns, cats, imgs = {}, {}, {}
151 imgToAnns,catToImgs = defaultdict(list),defaultdict(list)
152 if 'annotations' in self.dataset:
153 for ann in self.dataset['annotations']:
154 imgToAnns[ann['image_id']].append(ann)
155 anns[ann['id']] = ann
156
157 if 'images' in self.dataset:
158 for img in self.dataset['images']:
159 imgs[img['id']] = img
160
161 if 'categories' in self.dataset:
162 for cat in self.dataset['categories']:
163 cats[cat['id']] = cat
164
165 if 'annotations' in self.dataset and 'categories' in self.dataset:
166 for ann in self.dataset['annotations']:
167 catToImgs[ann['category_id']].append(ann['image_id'])
168
169 print('index created!')
170
171 # create class members
172 self.anns = anns
173 self.imgToAnns = imgToAnns
174 self.catToImgs = catToImgs
175 self.imgs = imgs
176 self.cats = cats
177
178 def loadRes(self, resFile):
179 """

Callers 1

loadResMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected