image_output_1.png
import matplotlib.image as mpimg

import matplotlib.pyplot as plt

import os

import os

import random

import numpy as np
import pandas as pd
import os

train_directory = '../input/100-bird-species/train'
val_directory = '../input/100-bird-species/valid'
test_directory = '../input/100-bird-species/test'

def display_random_grid(ncols=5, ds_path=train_directory):
    fig, ax = plt.subplots(ncols=ncols, nrows=ncols, figsize=(15, 15))
    for i in range(ncols):
        for j in range(ncols):
            bird_species = random.choice(os.listdir(ds_path))
            random_bird_path = random.choice(os.listdir(ds_path + '/' + bird_species))
            random_bird = mpimg.imread(ds_path + '/' + bird_species + '/' + random_bird_path)
            ax[i, j].imshow(random_bird)
            ax[i, j].set_title(bird_species)
            ax[i, j].axis('off')
display_random_grid()