Skip to content
Snippets Groups Projects
Commit d74dc892 authored by xiexinchen.vendor's avatar xiexinchen.vendor Committed by zhengmiao
Browse files

[Refactor] Fix load annotations by file

parent ad35ec63
No related branches found
No related tags found
No related merge requests found
......@@ -233,13 +233,15 @@ class CustomDataset(BaseDataset):
list[dict]: All data info of dataset.
"""
data_list = []
img_dir = self.data_prefix.get('img_path', None)
ann_dir = self.data_prefix.get('seg_map_path', None)
if osp.isfile(self.ann_file):
lines = mmcv.list_from_file(
self.ann_file, file_client_args=self.file_client_args)
for line in lines:
img_name = line.strip()
data_info = dict(img_path=img_name + self.img_suffix)
data_info = dict(
img_path=osp.join(img_dir, img_name + self.img_suffix))
if ann_dir is not None:
seg_map = img_name + self.seg_map_suffix
data_info['seg_map_path'] = osp.join(ann_dir, seg_map)
......@@ -248,7 +250,6 @@ class CustomDataset(BaseDataset):
data_info['seg_fields'] = []
data_list.append(data_info)
else:
img_dir = self.data_prefix['img_path']
for img in self.file_client.list_dir_or_file(
dir_path=img_dir,
list_dir=False,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment