image_output_5.png image_output_4.png image_output_3.png image_output_2.png image_output_1.png
import os

root = '/kaggle/input/retinal-vessel-segmentation/DRIVE/'
exts = ('jpg', 'JPG', 'png', 'PNG', 'tif', 'gif', 'ppm')

def Data_sorting(input_data, target_data, exts):
    images = sorted([os.path.join(input_data, fname) for fname in os.listdir(input_data) if fname.endswith(exts) and (not fname.startswith('.'))])
    masks = sorted([os.path.join(target_data, fname) for fname in os.listdir(target_data) if fname.endswith(exts) and (not fname.startswith('.'))])
    return (images, masks)

input_data_drive_train = os.path.join(root, 'training/images')
target_data_drive_train = os.path.join(root, 'training/1st_manual')
images_drive_train, masks_drive_train = Data_sorting(input_data_drive_train, target_data_drive_train, exts)
input_data_drive_test = os.path.join(root, 'test/images')
target_data_drive_test = os.path.join(root, 'test/mask')
images_drive_test, masks_drive_test = Data_sorting(input_data_drive_test, target_data_drive_test, exts)