From 78e6c09bd17d4174b48dc6f3205871af8f6a297a Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Tue, 10 Aug 2021 19:43:24 +0800 Subject: [PATCH] fix anno not found in infer mode (#3929) --- ppdet/data/source/dataset.py | 7 ++++++- ppdet/utils/download.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ppdet/data/source/dataset.py b/ppdet/data/source/dataset.py index b0d8726ed..1bef548e6 100644 --- a/ppdet/data/source/dataset.py +++ b/ppdet/data/source/dataset.py @@ -149,7 +149,12 @@ class ImageFolder(DetDataset): self.sample_num = sample_num def check_or_download_dataset(self): - return + if self.dataset_dir: + # NOTE: ImageFolder is only used for prediction, in + # infer mode, image_dir is set by set_images + # so we only check anno_path here + self.dataset_dir = get_dataset_path(self.dataset_dir, + self.anno_path, None) def parse_dataset(self, ): if not self.roidbs: diff --git a/ppdet/utils/download.py b/ppdet/utils/download.py index db0bdd647..0900a9357 100644 --- a/ppdet/utils/download.py +++ b/ppdet/utils/download.py @@ -195,6 +195,10 @@ def get_dataset_path(path, annotation, image_dir): "Please apply and download the dataset following docs/tutorials/PrepareMOTDataSet.md". format(name)) + if name == "spine_coco": + if _dataset_exists(data_dir, annotation, image_dir): + return data_dir + # For voc, only check dir VOCdevkit/VOC2012, VOCdevkit/VOC2007 if name in ['voc', 'fruit', 'roadsign_voc']: exists = True -- GitLab