image_output_1.png
import matplotlib.image as mpimg

import pandas as pd

import pandas as pd
import numpy as np
import cv2 as cv
import matplotlib.image as mpimg
from matplotlib import pyplot as plt
pd.options.display.float_format = '{:.2f}'.format

training_labels = pd.read_csv('../input/landmark-recognition-2021/train.csv')
training_labels['path1'] = training_labels['id'].str.slice(start=0, stop=1)
training_labels['path2'] = training_labels['id'].str.slice(start=1, stop=2)
training_labels['path3'] = training_labels['id'].str.slice(start=2, stop=3)
training_labels['path'] = '../input/landmark-recognition-2021/train/' + training_labels['path1'] + '/' + training_labels['path2'] + '/' + training_labels['path3'] + '/' + training_labels['id'] + '.jpg'
training_labels = training_labels.drop(['path1', 'path2', 'path3'], axis=1)

piv = training_labels.pivot_table(index='landmark_id', aggfunc=lambda x: len(x.unique()))['id']
piv.sort_values()

top_landmark = 138982
top_landmark_df = training_labels.loc[training_labels['landmark_id'] == top_landmark]
top_landmark_sample = top_landmark_df.sample(n=16, random_state=2021)
top_landmark_path = top_landmark_sample['path']
fig = plt.figure(figsize=(100, 100))
for i in range(0, 16):
    fig.add_subplot(4, 4, i + 1)
    plt.imshow(mpimg.imread(top_landmark_path.iloc[i]))
    plt.axis('off')