From 36f73b27d201ec4c7ea16b7cb533077483a05f73 Mon Sep 17 00:00:00 2001 From: Mohamed Omran Date: Sat, 24 Oct 2015 19:12:48 +0200 Subject: [PATCH] removed bug in getImgIds() --- PythonAPI/pycocotools/coco.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PythonAPI/pycocotools/coco.py b/PythonAPI/pycocotools/coco.py index fcd096f..12cb559 100644 --- a/PythonAPI/pycocotools/coco.py +++ b/PythonAPI/pycocotools/coco.py @@ -191,8 +191,8 @@ def getImgIds(self, imgIds=[], catIds=[]): ids = self.imgs.keys() else: ids = set(imgIds) - for catId in catIds: - if len(ids) == 0: + for i, catId in enumerate(catIds): + if i == 0 and len(ids) == 0: ids = set(self.catToImgs[catId]) else: ids &= set(self.catToImgs[catId]) @@ -347,4 +347,4 @@ def download( self, tarDir = None, imgIds = [] ): fname = os.path.join(tarDir, img['file_name']) if not os.path.exists(fname): urllib.urlretrieve(img['coco_url'], fname) - print 'downloaded %d/%d images (t=%.1fs)'%(i, N, time.time()- tic) \ No newline at end of file + print 'downloaded %d/%d images (t=%.1fs)'%(i, N, time.time()- tic)