text_plain_output_1.png
import cv2

import glob

import matplotlib.pyplot as plt

import os

INPUT_PATH = '../input/cityscapes-image-pairs/cityscapes_data'

train_files = glob.glob(os.path.join(INPUT_PATH + '/train', '*jpg'))
val_files = glob.glob(os.path.join(INPUT_PATH + '/val', '*jpg'))

fig, axes = plt.subplots(1,2, figsize = (20,5))
for i, ax in enumerate(axes.ravel()):
    img = cv2.imread(train_files[i])
    ax.imshow(img)
    #ax.axis('off')
plt.show()

for i in train_files[:2]:
    org_img = cv2.imread(i)
    img = org_img[:, 0:256, :]
    msk = org_img[:, 256:, :]
    print('-' * 40)
    print('Original image shape:', img.shape)
    print('Mask image shape:', msk.shape)
    print('-' * 40)
    plt.figure(figsize=(12, 8))
    plt.subplot(1, 2, 1)
    plt.imshow(img)
    plt.title('Original image')
    plt.subplot(1, 2, 2)
    plt.imshow(msk)
    plt.title('Mask (RGB)')
    plt.show()