def _get_nyuv2_pairs(folder, split='train'):

    def get_path_pairs(folder, split_file):
        img_paths = []
        mask_paths = []
        with open(os.path.join(folder, split_file), 'r') as f:
            for filename in f.readlines():
                filename = filename.strip()
                imgpath = os.path.join(folder, 'image', filename)
                maskpath = os.path.join(folder, 'mask', filename)
                if os.path.isfile(maskpath):
                    img_paths.append(imgpath)
                    mask_paths.append(maskpath)
                else:
                    print('cannot find the mask:', maskpath)
        return (img_paths, mask_paths)
    (img_paths, mask_paths) = get_path_pairs(folder, split_file=(split + '.txt'))
    return (img_paths, mask_paths)
def _get_nyuv2_pairs(folder, split='train'):

    def get_path_pairs(folder, split_file):
        img_paths = []
        mask_paths = []
        with open(os.path.join(folder, split_file), 'r') as f:
            for filename in f.readlines():
                filename = filename.strip()
                imgpath = os.path.join(folder, 'image', filename)
                maskpath = os.path.join(folder, 'mask', filename)
                if os.path.isfile(maskpath):
                    img_paths.append(imgpath)
                    mask_paths.append(maskpath)
                else:
                    print('cannot find the mask:', maskpath)
        return (img_paths, mask_paths)
    (img_paths, mask_paths) = get_path_pairs(folder, split_file=(split + '.txt'))
    return (img_paths, mask_paths)