{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport os\n\nallimagepath = []\ntestimagepath = []\nallindex = []\n\nTRAINCSV = \"/kaggle/input/landmark-retrieval-2020/train.csv\"\n\nfor dirname, _, filenames in os.walk('/kaggle/input/landmark-retrieval-2020/train'):\n    for filename in filenames:\n        allimagepath.append(os.path.join(dirname, filename))\n\nfor dirname, _, filenames in os.walk('/kaggle/input/landmark-retrieval-2020/test'):\n    for filename in filenames:\n        testimagepath.append(os.path.join(dirname, filename))\n\n\nfor dirname, _, filenames in os.walk('/kaggle/input/landmark-retrieval-2020/index'):\n    for filename in filenames:\n        allindex.append(os.path.join(dirname, filename))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"import cv2\nimport matplotlib.pyplot as plt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/landmark-retrieval-2020/train.csv\")\ndf","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"landmark_idlist = df[\"landmark_id\"].drop_duplicates()\nlandmark_idlist = landmark_idlist.reset_index(drop=True)\nlandmark_idlist","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def imageshow(id):\n    tmpdf = df[df[\"landmark_id\"]==id].reset_index(drop=True)\n    idlist = tmpdf[\"id\"]\n    \n    for a in idlist:\n        impath = [s for s in allimagepath if a in s]\n        img = cv2.imread(impath[0])\n        \n        plt.figure()\n        plt.imshow(img)\n        \n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## Example of id 1 in train data","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"landmark_id = \" + str(landmark_idlist[0]))\nimageshow(landmark_idlist[0])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"landmark_id = \" + str(landmark_idlist[200]))\nimageshow(landmark_idlist[200])","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## Example of index","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"allindex[0]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"for a in range(20):\n    img = cv2.imread(allindex[a])\n    plt.figure()\n    plt.imshow(img)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# example of test image","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"testimagepath[0]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"for a in range(20):\n    img = cv2.imread(testimagepath[a])\n    plt.figure()\n    plt.imshow(img)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}