def __list_dirs(self, root_dir, dataset): img_list = list() json_list = list() image_dir = os.path.join(root_dir, dataset, 'image') json_dir = os.path.join(root_dir, dataset, 'json') for file_name in os.listdir(json_dir): image_name = '.'.join(file_name.split('.')[:-1]) img_path = ImageHelper.imgpath(image_dir, image_name) json_path = os.path.join(json_dir, file_name) if not os.path.exists(json_path) or img_path is None: Log.warn('Json Path: {} not exists.'.format(json_path)) continue json_list.append(json_path) img_list.append(img_path) if dataset == 'train' and self.configer.get('data', 'include_val'): image_dir = os.path.join(root_dir, 'val/image') json_dir = os.path.join(root_dir, 'val/json') for file_name in os.listdir(json_dir): image_name = '.'.join(file_name.split('.')[:-1]) img_path = ImageHelper.imgpath(image_dir, image_name) json_path = os.path.join(json_dir, file_name) if not os.path.exists(json_path) or img_path is None: Log.warn('Json Path: {} not exists.'.format(json_path)) continue json_list.append(json_path) img_list.append(img_path) return img_list, json_list
def __list_dirs(self, root_dir, dataset): imgA_list = list() imgB_list = list() imageA_dir = os.path.join(root_dir, dataset, 'imageA') imageB_dir = os.path.join(root_dir, dataset, 'imageB') for file_name in os.listdir(imageA_dir): image_name = '.'.join(file_name.split('.')[:-1]) imgA_path = ImageHelper.imgpath(imageA_dir, image_name) imgB_path = ImageHelper.imgpath(imageB_dir, image_name) if not os.path.exists(imgA_path) or not os.path.exists(imgB_path): Log.warn('Img Path: {} not exists.'.format(imgA_path)) continue imgA_list.append(imgA_path) imgB_list.append(imgB_path) if dataset == 'train' and self.configer.get('data', 'include_val'): imageA_dir = os.path.join(root_dir, 'val/imageA') imageB_dir = os.path.join(root_dir, 'val/imageB') for file_name in os.listdir(imageA_dir): image_name = '.'.join(file_name.split('.')[:-1]) imgA_path = ImageHelper.imgpath(imageA_dir, image_name) imgB_path = ImageHelper.imgpath(imageB_dir, image_name) if not os.path.exists(imgA_path) or not os.path.exists( imgB_path): Log.warn('Img Path: {} not exists.'.format(imgA_path)) continue imgA_list.append(imgA_path) imgB_list.append(imgB_path) return imgA_list, imgB_list