{"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-output":false,"_kg_hide-input":true,"execution":{"iopub.status.busy":"2023-05-08T10:35:07.588714Z","iopub.execute_input":"2023-05-08T10:35:07.589123Z","iopub.status.idle":"2023-05-08T10:35:07.828897Z","shell.execute_reply.started":"2023-05-08T10:35:07.589092Z","shell.execute_reply":"2023-05-08T10:35:07.827964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/image-matching-challenge-2023/train/train_labels.csv\")\n","metadata":{"execution":{"iopub.status.busy":"2023-05-08T10:36:11.276648Z","iopub.execute_input":"2023-05-08T10:36:11.277028Z","iopub.status.idle":"2023-05-08T10:36:11.302905Z","shell.execute_reply.started":"2023-05-08T10:36:11.276998Z","shell.execute_reply":"2023-05-08T10:36:11.302117Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head(5)","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:13:13.162437Z","iopub.execute_input":"2023-05-08T11:13:13.162842Z","iopub.status.idle":"2023-05-08T11:13:13.193595Z","shell.execute_reply.started":"2023-05-08T11:13:13.162812Z","shell.execute_reply":"2023-05-08T11:13:13.192857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.shape","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:13:26.505452Z","iopub.execute_input":"2023-05-08T11:13:26.505817Z","iopub.status.idle":"2023-05-08T11:13:26.514034Z","shell.execute_reply.started":"2023-05-08T11:13:26.505787Z","shell.execute_reply":"2023-05-08T11:13:26.512812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:14:37.969674Z","iopub.execute_input":"2023-05-08T11:14:37.970050Z","iopub.status.idle":"2023-05-08T11:14:37.997572Z","shell.execute_reply.started":"2023-05-08T11:14:37.970020Z","shell.execute_reply":"2023-05-08T11:14:37.996703Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe().T","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:15:09.714157Z","iopub.execute_input":"2023-05-08T11:15:09.715265Z","iopub.status.idle":"2023-05-08T11:15:09.740530Z","shell.execute_reply.started":"2023-05-08T11:15:09.715213Z","shell.execute_reply":"2023-05-08T11:15:09.739445Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.columns","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:16:11.278707Z","iopub.execute_input":"2023-05-08T11:16:11.279086Z","iopub.status.idle":"2023-05-08T11:16:11.288900Z","shell.execute_reply.started":"2023-05-08T11:16:11.279058Z","shell.execute_reply":"2023-05-08T11:16:11.287553Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['scene'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:16:37.638551Z","iopub.execute_input":"2023-05-08T11:16:37.638924Z","iopub.status.idle":"2023-05-08T11:16:37.647037Z","shell.execute_reply.started":"2023-05-08T11:16:37.638896Z","shell.execute_reply":"2023-05-08T11:16:37.645730Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['dataset'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:16:55.544487Z","iopub.execute_input":"2023-05-08T11:16:55.544886Z","iopub.status.idle":"2023-05-08T11:16:55.553197Z","shell.execute_reply.started":"2023-05-08T11:16:55.544856Z","shell.execute_reply":"2023-05-08T11:16:55.552049Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nfrom tensorflow import keras\nimport cv2\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:20:25.288418Z","iopub.execute_input":"2023-05-08T11:20:25.288809Z","iopub.status.idle":"2023-05-08T11:20:34.984524Z","shell.execute_reply.started":"2023-05-08T11:20:25.288782Z","shell.execute_reply":"2023-05-08T11:20:34.983357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.pie(df['dataset'].value_counts(),startangle=100,autopct='%.3f',labels=['urban', 'heritage', 'haiper'],shadow=True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:26:24.194160Z","iopub.execute_input":"2023-05-08T11:26:24.195061Z","iopub.status.idle":"2023-05-08T11:26:24.353225Z","shell.execute_reply.started":"2023-05-08T11:26:24.195021Z","shell.execute_reply":"2023-05-08T11:26:24.352128Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.pie(df['scene'].value_counts(),startangle=100,autopct='%.3f',labels=['kyiv-puppet-theater', 'dioscuri', 'cyprus', 'bike', 'chairs',\n       'fountain', 'wall'],shadow=False)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:28:17.487353Z","iopub.execute_input":"2023-05-08T11:28:17.487723Z","iopub.status.idle":"2023-05-08T11:28:17.677203Z","shell.execute_reply.started":"2023-05-08T11:28:17.487696Z","shell.execute_reply":"2023-05-08T11:28:17.675756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install mediapy -q\n\n\n\n%cd /kaggle/working/\n!rm -rf /kaggle/working/Hierarchical-Localization\n!git clone --quiet --recursive https://github.com/cvg/Hierarchical-Localization/\n%cd /kaggle/working/Hierarchical-Localization\n!pip install -e .\n\nfrom hloc import extract_features, match_features, reconstruction, visualization, pairs_from_exhaustive\nfrom hloc.visualization import plot_images, read_image\nfrom hloc.utils import viz_3d\n\n%cd /kaggle/working/","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:28:51.687108Z","iopub.execute_input":"2023-05-08T11:28:51.687476Z","iopub.status.idle":"2023-05-08T11:29:37.680568Z","shell.execute_reply.started":"2023-05-08T11:28:51.687449Z","shell.execute_reply":"2023-05-08T11:29:37.678853Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n\n\nimport numpy as np\nimport mediapy as media\nimport pandas as pd\nimport os\nimport cv2\nimport pycolmap\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom pathlib import Path\nfrom time import time\nfrom glob import glob\n\n","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:31:34.710199Z","iopub.execute_input":"2023-05-08T11:31:34.711176Z","iopub.status.idle":"2023-05-08T11:31:35.458531Z","shell.execute_reply.started":"2023-05-08T11:31:34.711137Z","shell.execute_reply":"2023-05-08T11:31:35.457192Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset = 'heritage'\nscene = 'wall'\nsrc = f'/kaggle/input/image-matching-challenge-2023/train/heritage/{dataset}/{scene}'\n\nlimit = 12\nimages = [cv2.cvtColor(cv2.imread(im), cv2.COLOR_BGR2RGB) for im in glob(f'{src}/images/*')[:limit]]\nmedia.show_images(images, height=300, columns=3)","metadata":{"execution":{"iopub.status.busy":"2023-05-08T11:32:47.704623Z","iopub.execute_input":"2023-05-08T11:32:47.705038Z","iopub.status.idle":"2023-05-08T11:32:47.722158Z","shell.execute_reply.started":"2023-05-08T11:32:47.705008Z","shell.execute_reply":"2023-05-08T11:32:47.720964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}