image_output_5.png image_output_4.png image_output_6.png image_output_3.png image_output_2.png image_output_1.png
from pathlib import Path

import cv2

import matplotlib.pyplot as plt

import os

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

input_path = Path('../input')
train_path = input_path / 'train'
test_path = input_path / 'test'

cameras = os.listdir(train_path)
train_images = []
for camera in cameras:
    for fname in sorted(os.listdir(train_path / camera)):
        train_images.append((camera, fname))
train = pd.DataFrame(train_images, columns=['camera', 'fname'])

random_images = train.sample(100)
import matplotlib.pyplot as plt
for i, r in random_images[:6].iterrows():
    x = cv2.imread('../input/train/' + r['camera'] + '/' + r['fname'])
    plt.figure(figsize=(16, 16))
    plt.imshow(x)
    plt.title(r['fname'])
    plt.show()