{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":71885,"databundleVersionId":8143495,"sourceType":"competition"},{"sourceId":8707997,"sourceType":"datasetVersion","datasetId":5220672}],"dockerImageVersionId":30733,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# About:\n- This notebook is demonstration of 8th place solution in Image Matching Competition 2024.\n\n# Repository:\n- Please see the Readme.md on the dataset below.\n    - https://www.kaggle.com/datasets/motono0223/imc2024-8th-place-solution-dataset\n    \n# Note:\n- This demo notebook runs same processing with the notebook:\n    - https://www.kaggle.com/code/motono0223/imc2024-8th-place-solution-aliked-lightglue","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19"}},{"cell_type":"markdown","source":"---\n# Notebook settings\n- ACCELERATOR is required as \"GPU T4x2\".\n- internet off\n\n## Offline install dependencies\n- pycolmap == 0.4.0\n- lightglue == 0.0\n- safetensors == 0.4.1\n- transformers == 4.40.1 and dependency packages of transformers\n    - PyYAML == 6.0.1\n    - certifi == 2024.2.2\n    - charset_normalizer == 3.3.2\n    - filelock == 3.13.4\n    - fsspec == 2024.3.1\n    - huggingface_hub == 0.22.2\n    - idna == 3.7\n    - numpy == 1.26.4\n    - regex == 2024.4.16\n    - requests == 2.31.0\n    - safetensors == 0.4.3\n    - tokenizers == 0.19.1\n    - tqdm == 4.66.2\n    - typing_extensions == 4.11.0\n    - urlib3 == 2.2.1","metadata":{}},{"cell_type":"code","source":"!python -m pip install --no-deps /kaggle/input/imc2024-8th-place-solution-dataset/dependencies/pycolmap/pycolmap-0.4.0-cp310-cp310-manylinux2014_x86_64.whl\n!python -m pip install --no-deps /kaggle/input/imc2024-8th-place-solution-dataset/dependencies/safetensors/safetensors-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl\n!python -m pip install --no-index --find-links=/kaggle/input/imc2024-8th-place-solution-dataset/dependencies/transformers/ transformers > /dev/null\n!python -m pip install --no-deps /kaggle/input/imc2024-8th-place-solution-dataset/dependencies/imc2024-packages-lightglue-rerun-kornia/lightglue-0.0-py3-none-any.whl","metadata":{"execution":{"iopub.status.busy":"2024-06-17T00:58:04.879548Z","iopub.execute_input":"2024-06-17T00:58:04.879819Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Put aliked and lightglue weight files on torch hub cache.","metadata":{}},{"cell_type":"code","source":"!mkdir -p /root/.cache/torch/hub/checkpoints\n!cp /kaggle/input/imc2024-8th-place-solution-dataset/models/aliked-n16/* /root/.cache/torch/hub/checkpoints/\n!cp /kaggle/input/imc2024-8th-place-solution-dataset/models/lightglue_aliked/* /root/.cache/torch/hub/checkpoints/\n!cp /kaggle/input/imc2024-8th-place-solution-dataset/models/lightglue_aliked/aliked_lightglue.pth /root/.cache/torch/hub/checkpoints/aliked_lightglue_v0-1_arxiv-pth","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Run prediction","metadata":{}},{"cell_type":"code","source":"import sys\nsys.path.append(\"/kaggle/input/imc2024-8th-place-solution-dataset/src/\")\nimport predict\n\npredict.main()","metadata":{"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# View result","metadata":{}},{"cell_type":"code","source":"!cat submission.csv","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}