diff --git a/PythonAPI/pycocotools/coco.py b/PythonAPI/pycocotools/coco.py index e4182c74..59b00bea 100644 --- a/PythonAPI/pycocotools/coco.py +++ b/PythonAPI/pycocotools/coco.py @@ -194,7 +194,9 @@ def getImgIds(self, imgIds=[], catIds=[]): if i == 0 and len(ids) == 0: ids = set(self.catToImgs[catId]) else: - ids &= set(self.catToImgs[catId]) + ### https://thispointer.com/python-how-to-add-or-append-values-to-a-set/ + ids.update((set(self.catToImgs[catId]))) # update set for multiple categories + # ids &= set(self.catToImgs[catId]) ### this didn't work for me when filtering multiple category ids return list(ids) def loadAnns(self, ids=[]): @@ -438,4 +440,4 @@ def annToMask(self, ann): """ rle = self.annToRLE(ann) m = maskUtils.decode(rle) - return m \ No newline at end of file + return m