提交 75ac2441 编写于 作者: C chenguowei01

add dataset_root judgment

上级 6ae9d4ac
......@@ -58,6 +58,9 @@ class ADE20K(Dataset):
savepath=DATA_HOME,
extrapath=DATA_HOME,
extraname='ADEChallengeData2016')
elif not os.path.exists(self.dataset_root):
raise Exception('there is not dataset_root: {}.'.format(
self.dataset_root))
if mode == 'train':
img_dir = os.path.join(self.dataset_root, 'images/training')
......
......@@ -66,6 +66,10 @@ class Dataset(fluid.io.Dataset):
raise Exception("transforms is necessary, but it is None.")
self.dataset_root = dataset_root
if not os.path.exists(self.dataset_root):
raise Exception('there is not dataset_root: {}.'.format(
self.dataset_root))
if mode == 'train':
if train_list is None:
raise Exception(
......
......@@ -46,6 +46,9 @@ class OpticDiscSeg(Dataset):
raise Exception("data_file not set and auto download disabled.")
self.dataset_root = download_file_and_uncompress(
url=URL, savepath=DATA_HOME, extrapath=DATA_HOME)
elif not os.path.exists(self.dataset_root):
raise Exception('there is not dataset_root: {}.'.format(
self.dataset_root))
if mode == 'train':
file_list = os.path.join(self.dataset_root, 'train_list.txt')
......
......@@ -58,6 +58,9 @@ class PascalVOC(Dataset):
savepath=DATA_HOME,
extrapath=DATA_HOME,
extraname='VOCdevkit')
elif not os.path.exists(self.dataset_root):
raise Exception('there is not dataset_root: {}.'.format(
self.dataset_root))
image_set_dir = os.path.join(self.dataset_root, 'VOC2012', 'ImageSets',
'Segmentation')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册