def __init__(self, data_dir='auto', split='train'): super(ADE20KSemanticSegmentationDataset, self).__init__() if data_dir is 'auto': data_dir = get_ade20k(root, url) if split == 'train' or split == 'val': img_dir = os.path.join( data_dir, 'ADEChallengeData2016', 'images', 'training' if split == 'train' else 'validation') label_dir = os.path.join( data_dir, 'ADEChallengeData2016', 'annotations', 'training' if split == 'train' else 'validation') else: raise ValueError( 'Please give \'split\' argument with either \'train\' or ' '\'val\'.') self.img_paths = sorted(glob.glob(os.path.join(img_dir, '*.jpg'))) self.label_paths = sorted(glob.glob(os.path.join(label_dir, '*.png'))) self.add_getter('img', lambda i: read_image(self.img_paths[i])) self.add_getter( 'iabel', lambda i: read_image( self.label_paths[i], dtype=np.int32, color=False)[0])
def __init__(self, data_dir='auto'): super(ADE20KTestImageDataset, self).__init__() if data_dir is 'auto': data_dir = get_ade20k(root, url) img_dir = os.path.join(data_dir, 'release_test', 'testing') self.img_paths = sorted(glob.glob(os.path.join(img_dir, '*.jpg'))) self.add_getter('img', self._get_image) self.keys = 'img' # do not return tuple
def __init__(self, data_dir='auto', split='train'): if data_dir is 'auto': data_dir = get_ade20k(root, url) if split == 'train' or split == 'val': img_dir = os.path.join( data_dir, 'ADEChallengeData2016', 'images', 'training' if split == 'train' else 'validation') label_dir = os.path.join( data_dir, 'ADEChallengeData2016', 'annotations', 'training' if split == 'train' else 'validation') else: raise ValueError( 'Please give \'split\' argument with either \'train\' or ' '\'val\'.') self.img_paths = sorted(glob.glob(os.path.join(img_dir, '*.jpg'))) self.label_paths = sorted(glob.glob(os.path.join(label_dir, '*.png')))
def __init__(self, data_dir='auto', split='train'): if data_dir is 'auto': data_dir = get_ade20k(root, url) if split == 'train' or split == 'val': img_dir = os.path.join( data_dir, 'ADEChallengeData2016', 'images', 'training' if split == 'train' else 'validation') label_dir = os.path.join( data_dir, 'ADEChallengeData2016', 'annotations', 'training' if split == 'train' else 'validation') else: raise ValueError( 'Please give \'split\' argument with either \'train\' or ' '\'val\'.') self.img_paths = sorted(glob.glob(os.path.join(img_dir, '*.jpg'))) self.label_paths = sorted(glob.glob(os.path.join(label_dir, '*.png')))
def __init__(self, data_dir='auto'): if data_dir is 'auto': data_dir = get_ade20k(root, url) img_dir = os.path.join(data_dir, 'release_test', 'testing') self.img_paths = sorted(glob.glob(os.path.join(img_dir, '*.jpg')))
def __init__(self, data_dir='auto'): if data_dir is 'auto': data_dir = get_ade20k(root, url) img_dir = os.path.join(data_dir, 'release_test', 'testing') self.img_paths = sorted(glob.glob(os.path.join(img_dir, '*.jpg')))