def get_datasets(imgs_dir, groundTruth_dir, borderMasks_dir, train_test='null'):
    imgs = np.empty((Nimgs, height, width, channels))
    groundTruth = np.empty((Nimgs, height, width))
    border_masks = np.empty((Nimgs, height, width))
    for (path, subdirs, files) in os.walk(imgs_dir):
        for i in range(len(files)):
            print(('original image: ' + files[i]))
            img = Image.open((imgs_dir + files[i]))
            imgs[i] = np.asarray(img)
            groundTruth_name = (files[i][0:2] + '_manual1.gif')
            print(('ground truth name: ' + groundTruth_name))
            g_truth = Image.open((groundTruth_dir + groundTruth_name))
            groundTruth[i] = np.asarray(g_truth)
            border_masks_name = ''
            if (train_test == 'train'):
                border_masks_name = (files[i][0:2] + '_training_mask.gif')
            elif (train_test == 'test'):
                border_masks_name = (files[i][0:2] + '_test_mask.gif')
            else:
                print('specify if train or test!!')
                exit()
            print(('border masks name: ' + border_masks_name))
            b_mask = Image.open((borderMasks_dir + border_masks_name))
            border_masks[i] = np.asarray(b_mask)
    print(('imgs max: ' + str(np.max(imgs))))
    print(('imgs min: ' + str(np.min(imgs))))
    assert ((np.max(groundTruth) == 255) and (np.max(border_masks) == 255))
    assert ((np.min(groundTruth) == 0) and (np.min(border_masks) == 0))
    print('ground truth and border masks are correctly withih pixel value range 0-255 (black-white)')
    imgs = np.transpose(imgs, (0, 3, 1, 2))
    assert (imgs.shape == (Nimgs, channels, height, width))
    groundTruth = np.reshape(groundTruth, (Nimgs, 1, height, width))
    border_masks = np.reshape(border_masks, (Nimgs, 1, height, width))
    assert (groundTruth.shape == (Nimgs, 1, height, width))
    assert (border_masks.shape == (Nimgs, 1, height, width))
    return (imgs, groundTruth, border_masks)
def get_datasets(imgs_dir, groundTruth_dir, borderMasks_dir, train_test='null'):
    imgs = np.empty((Nimgs, height, width, channels))
    groundTruth = np.empty((Nimgs, height, width))
    border_masks = np.empty((Nimgs, height, width))
    for (path, subdirs, files) in os.walk(imgs_dir):
        for i in range(len(files)):
            print(('original image: ' + files[i]))
            img = Image.open((imgs_dir + files[i]))
            imgs[i] = np.asarray(img)
            groundTruth_name = (files[i][0:2] + '_manual1.gif')
            print(('ground truth name: ' + groundTruth_name))
            g_truth = Image.open((groundTruth_dir + groundTruth_name))
            groundTruth[i] = np.asarray(g_truth)
            border_masks_name = 
            if (train_test == 'train'):
                border_masks_name = (files[i][0:2] + '_training_mask.gif')
            elif (train_test == 'test'):
                border_masks_name = (files[i][0:2] + '_test_mask.gif')
            else:
                print('specify if train or test!!')
                exit()
            print(('border masks name: ' + border_masks_name))
            b_mask = Image.open((borderMasks_dir + border_masks_name))
            border_masks[i] = np.asarray(b_mask)
    print(('imgs max: ' + str(np.max(imgs))))
    print(('imgs min: ' + str(np.min(imgs))))
    assert ((np.max(groundTruth) == 255) and (np.max(border_masks) == 255))
    assert ((np.min(groundTruth) == 0) and (np.min(border_masks) == 0))
    print('ground truth and border masks are correctly withih pixel value range 0-255 (black-white)')
    imgs = np.transpose(imgs, (0, 3, 1, 2))
    assert (imgs.shape == (Nimgs, channels, height, width))
    groundTruth = np.reshape(groundTruth, (Nimgs, 1, height, width))
    border_masks = np.reshape(border_masks, (Nimgs, 1, height, width))
    assert (groundTruth.shape == (Nimgs, 1, height, width))
    assert (border_masks.shape == (Nimgs, 1, height, width))
    return (imgs, groundTruth, border_masks)