From 2e8b4e149f00fa912980510c1964b1c2970e8222 Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Wed, 6 Jan 2021 18:01:15 +0800 Subject: [PATCH] modify coco.py to avoid problem due to string img_id (#2008) --- dygraph/ppdet/data/source/coco.py | 4 ++-- ppdet/data/source/coco.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dygraph/ppdet/data/source/coco.py b/dygraph/ppdet/data/source/coco.py index 4dad8265f..e631cfa9f 100644 --- a/dygraph/ppdet/data/source/coco.py +++ b/dygraph/ppdet/data/source/coco.py @@ -65,7 +65,7 @@ class COCODataSet(DetDataset): 'and load image information only.'.format(anno_path)) for img_id in img_ids: - img_anno = coco.loadImgs(img_id)[0] + img_anno = coco.loadImgs([img_id])[0] im_fname = img_anno['file_name'] im_w = float(img_anno['width']) im_h = float(img_anno['height']) @@ -84,7 +84,7 @@ class COCODataSet(DetDataset): continue if not self.load_image_only: - ins_anno_ids = coco.getAnnIds(imgIds=img_id, iscrowd=False) + ins_anno_ids = coco.getAnnIds(imgIds=[img_id], iscrowd=False) instances = coco.loadAnns(ins_anno_ids) bboxes = [] diff --git a/ppdet/data/source/coco.py b/ppdet/data/source/coco.py index e393a4609..388f207d7 100644 --- a/ppdet/data/source/coco.py +++ b/ppdet/data/source/coco.py @@ -101,7 +101,7 @@ class COCODataSet(DataSet): 'and load image information only.'.format(anno_path)) for img_id in img_ids: - img_anno = coco.loadImgs(img_id)[0] + img_anno = coco.loadImgs([img_id])[0] im_fname = img_anno['file_name'] im_w = float(img_anno['width']) im_h = float(img_anno['height']) @@ -127,7 +127,7 @@ class COCODataSet(DataSet): } if not self.load_image_only: - ins_anno_ids = coco.getAnnIds(imgIds=img_id, iscrowd=False) + ins_anno_ids = coco.getAnnIds(imgIds=[img_id], iscrowd=False) instances = coco.loadAnns(ins_anno_ids) bboxes = [] -- GitLab