From ef5a3adb4d42acbf5c2284f6b3044d363692ea07 Mon Sep 17 00:00:00 2001 From: tsungyi Date: Fri, 21 Aug 2015 10:32:14 -0700 Subject: [PATCH 1/3] fix type in .info() --- PythonAPI/pycocotools/coco.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PythonAPI/pycocotools/coco.py b/PythonAPI/pycocotools/coco.py index cfef94b1..fcd096fc 100644 --- a/PythonAPI/pycocotools/coco.py +++ b/PythonAPI/pycocotools/coco.py @@ -123,7 +123,7 @@ def info(self): Print information about the annotation file. :return: """ - for key, value in self.datset['info'].items(): + for key, value in self.dataset['info'].items(): print '%s: %s'%(key, value) def getAnnIds(self, imgIds=[], catIds=[], areaRng=[], iscrowd=None): From 54cc41fe4e6a69f235c721698b576d8df288de7a Mon Sep 17 00:00:00 2001 From: TY Lin Date: Tue, 1 Sep 2015 13:15:01 -0700 Subject: [PATCH 2/3] add params (e.g, image_id, category_id, etc.) to evalImgs --- PythonAPI/pycocotools/cocoeval.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PythonAPI/pycocotools/cocoeval.py b/PythonAPI/pycocotools/cocoeval.py index 02865b97..87ef37c5 100644 --- a/PythonAPI/pycocotools/cocoeval.py +++ b/PythonAPI/pycocotools/cocoeval.py @@ -258,10 +258,14 @@ def evaluateImg(self, imgId, catId, aRng, maxDet): dtIg = np.logical_or(dtIg, np.logical_and(dtm==0, np.repeat(a,T,0))) # store results for given image and category return { + 'image_id': imgId, + 'category_id': catId, + 'aRng': aRng, + 'maxDet': maxDet, 'dtIds': [d['id'] for d in dt], 'gtIds': [g['id'] for g in gt], 'dtMatches': dtm, - # 'gtMatches': gtm, + 'gtMatches': gtm, 'dtScores': [d['score'] for d in dt], 'gtIgnore': gtIg, 'dtIgnore': dtIg, From 1f07dc318fd9d7d05db61f109893c2c9fab376d4 Mon Sep 17 00:00:00 2001 From: TY Lin Date: Wed, 9 Sep 2015 10:45:05 -0700 Subject: [PATCH 3/3] fix evaluation with param.useCats = 0 --- PythonAPI/pycocotools/cocoeval.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PythonAPI/pycocotools/cocoeval.py b/PythonAPI/pycocotools/cocoeval.py index 87ef37c5..f389eb0f 100644 --- a/PythonAPI/pycocotools/cocoeval.py +++ b/PythonAPI/pycocotools/cocoeval.py @@ -284,6 +284,7 @@ def accumulate(self, p = None): # allows input customized parameters if p is None: p = self.params + p.catIds = p.catIds if p.useCats == 1 else [-1] T = len(p.iouThrs) R = len(p.recThrs) K = len(p.catIds) if p.useCats else 1 @@ -294,8 +295,8 @@ def accumulate(self, p = None): # create dictionary for future indexing _pe = self._paramsEval - - setK = set(self.params.catIds) if _pe.useCats else set([-1]) + catIds = _pe.catIds if _pe.useCats else [-1] + setK = set(catIds) setA = set(map(tuple, _pe.areaRng)) setM = set(_pe.maxDets) setI = set(_pe.imgIds)