{"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_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-10-04T02:30:54.702548Z","iopub.execute_input":"2021-10-04T02:30:54.703154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport pandas as pd\nimport numpy as np\nimport random\nimport cv2\n\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mpimg\n\nimport tensorflow as tf\nfrom tensorflow.keras.utils import to_categorical\nfrom sklearn.model_selection import train_test_split\nfrom tensorflow.python.keras.preprocessing.image import ImageDataGenerator","metadata":{"execution":{"iopub.status.busy":"2021-10-01T15:14:52.851418Z","iopub.execute_input":"2021-10-01T15:14:52.851933Z","iopub.status.idle":"2021-10-01T15:15:00.088936Z","shell.execute_reply.started":"2021-10-01T15:14:52.851839Z","shell.execute_reply":"2021-10-01T15:15:00.088026Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"traindf = pd.read_csv(\"../input/landmark-recognition-2021/train.csv\")\ntraindf.head()","metadata":{"execution":{"iopub.status.busy":"2021-10-01T13:43:22.97364Z","iopub.execute_input":"2021-10-01T13:43:22.973921Z","iopub.status.idle":"2021-10-01T13:43:24.63723Z","shell.execute_reply.started":"2021-10-01T13:43:22.973891Z","shell.execute_reply":"2021-10-01T13:43:24.636389Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"traindf.shape","metadata":{"execution":{"iopub.status.busy":"2021-10-01T13:43:40.803766Z","iopub.execute_input":"2021-10-01T13:43:40.804749Z","iopub.status.idle":"2021-10-01T13:43:40.811573Z","shell.execute_reply.started":"2021-10-01T13:43:40.804692Z","shell.execute_reply":"2021-10-01T13:43:40.810644Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Total unique label ids:\", len(traindf['landmark_id'].unique()))","metadata":{"execution":{"iopub.status.busy":"2021-10-01T13:43:59.820314Z","iopub.execute_input":"2021-10-01T13:43:59.821106Z","iopub.status.idle":"2021-10-01T13:43:59.845477Z","shell.execute_reply.started":"2021-10-01T13:43:59.821067Z","shell.execute_reply":"2021-10-01T13:43:59.844467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(landmark_unique)","metadata":{"execution":{"iopub.status.busy":"2021-10-01T17:12:24.380332Z","iopub.execute_input":"2021-10-01T17:12:24.380676Z","iopub.status.idle":"2021-10-01T17:12:24.46597Z","shell.execute_reply.started":"2021-10-01T17:12:24.380578Z","shell.execute_reply":"2021-10-01T17:12:24.464767Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_ids = []\nlabels = []\ntemp_labels = []\ni=0\nfor id_ in landmark_unique[0:50]:\n    for iid in traindf['id'][traindf['landmark_id'] == id_]:\n        image_ids.append(iid)\n        labels.append(id_)\n        temp_labels.append(i)\n    i = i+1\nlen(image_ids)","metadata":{"execution":{"iopub.status.busy":"2021-10-01T13:44:28.203918Z","iopub.execute_input":"2021-10-01T13:44:28.204222Z","iopub.status.idle":"2021-10-01T13:44:28.232801Z","shell.execute_reply.started":"2021-10-01T13:44:28.204189Z","shell.execute_reply":"2021-10-01T13:44:28.231939Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"landmark_unique[0:50]","metadata":{"execution":{"iopub.status.busy":"2021-10-01T13:15:05.36361Z","iopub.execute_input":"2021-10-01T13:15:05.364264Z","iopub.status.idle":"2021-10-01T13:15:05.390281Z","shell.execute_reply.started":"2021-10-01T13:15:05.364228Z","shell.execute_reply":"2021-10-01T13:15:05.38917Z"},"trusted":true},"execution_count":null,"outputs":[]}]}