Skip to content

Commit

Permalink
Merge pull request ppwwyyxx#11 from mohomran/bug_getImgIds
Browse files Browse the repository at this point in the history
removed bug in getImgIds()
  • Loading branch information
tylin committed Oct 24, 2015
2 parents 825393b + 36f73b2 commit ee84f4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PythonAPI/pycocotools/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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)
print 'downloaded %d/%d images (t=%.1fs)'%(i, N, time.time()- tic)

0 comments on commit ee84f4c

Please sign in to comment.