### Navigate to AutoDecomp directory
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/docs/INSTALL.md
Changes to the AutoDecomp directory inside third_party. AutoDecomp must be installed separately following its own installation guide.
```bash
cd third_party/AutoDecomp
```
--------------------------------
### Install faiss-gpu
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/docs/INSTALL.md
Example command to install faiss-gpu via conda from conda-forge. Follow the official faiss installation guide for other options.
```bash
conda install -c conda-forge faiss-gpu
```
--------------------------------
### Set up and Start Viewer (Colab)
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/colab/demo.ipynb
Sets up a localtunnel to expose the viewer port 7007 and displays the viewer in an iframe. Requires npm and localtunnel installation. The output shows the viewer URL and a note to refresh the page after training starts.
```python
#@markdown
Set up and Start Viewer
%cd /content
# Install localtunnel
# We are using localtunnel https://github.com/localtunnel/localtunnel but ngrok could also be used
!npm install -g localtunnel
# Tunnel port 7007, the default for
!rm url.txt 2> /dev/null
get_ipython().system_raw('lt --port 7007 >> url.txt 2>&1 &')
import time
time.sleep(3) # the previous command needs time to write to url.txt
with open('url.txt') as f:
lines = f.readlines()
websocket_url = lines[0].split(": ")[1].strip().replace("https", "wss")
# from nerfstudio.utils.io import load_from_json
# from pathlib import Path
# json_filename = "nerfstudio/nerfstudio/viewer/app/package.json"
# version = load_from_json(Path(json_filename))["version"]
url = f"https://viewer.nerf.studio/?websocket_url={websocket_url}"
print(url)
print("You may need to click Refresh Page after you start training!")
from IPython import display
display.IFrame(src=url, height=800, width="100%")
```
--------------------------------
### Install Kapture and download IndoorVL datasets
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/datasets/crops/README.MD
Installs Kapture and downloads the IndoorVL datasets using kapture_download_dataset.py.
```bash
pip install kapture
mkdir -p ./data/original_datasets/IndoorVL
cd ./data/original_datasets/IndoorVL
kapture_download_dataset.py update
kapture_download_dataset.py install "HyundaiDepartmentStore_*"
kapture_download_dataset.py install "GangnamStation_*"
cd -
```
--------------------------------
### Start training with train.py
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/disk/README.md
Starts training with default settings. Use the --reward switch to choose between 'depth' and 'epipolar' reward schemes. Run 'python train.py --help' for more options.
```bash
python train.py DATASETS_LOCATION
```
--------------------------------
### Install AutoRecon and tab completion
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/docs/INSTALL.md
Installs AutoRecon in editable mode and installs tab completion for the CLI.
```bash
cd path/to/AutoRecon
pip install -e .
# install tab completion
ns-install-cli
```
--------------------------------
### Install kapture with pip
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/deep-image-retrieval/README.md
Install the kapture package, a pivot file format for SFM data, using pip.
```bash
pip install kapture
```
--------------------------------
### Install hloc from source
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/README.md
Clone the repository with submodules and install the package locally. Requires Python >=3.7 and PyTorch >=1.1. Starting with hloc-v1.3, COLMAP is not required for installation.
```bash
git clone --recursive https://github.com/cvg/Hierarchical-Localization/
cd Hierarchical-Localization/
python -m pip install -e .
```
--------------------------------
### Reproduce Resnet101-AP-GeM on RParis6K
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/deep-image-retrieval/README.md
Example command to reproduce results for Resnet101-AP-GeM on RParis6K, with whitening and GPU selection.
```bash
cd $DIR_ROOT
export DB_ROOT=/PATH/TO/YOUR/DATASETS
python -m dirtorch.test_dir --dataset RParis6K \
--checkpoint dirtorch/data/Resnet101-AP-GeM.pt \
--whiten Landmarks_clean --whitenp 0.25 --gpu 0
```
--------------------------------
### Install AutoDecomp package
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/docs/INSTALL.md
Installs the AutoDecomp package in editable mode from the repository root.
```shell
cd path/to/AutoDecomp
pip install -e .
```
--------------------------------
### Install Dens3R dependencies and download checkpoints
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/README.md
Sets up a Python 3.10.13 environment, installs requirements, and notes checkpoint downloads. Replace torch/torchvision lines in requirements.txt if CUDA is not 11.8.
```bash
# Replace the lines below in 'requirements.txt' with your own versions of torch and torchvision
# torch==2.7.1+cu118
# torchvision==0.22.1+cu118
# install dependencies
git clone https://github.com/alibaba/Taobao3D.git -b Dens3R
conda create -n dens3r python=3.10.13
conda activate dens3r
pip install -r requirements.txt
# download checkpoints
Please visit https://modelscope.cn/models/Taobao3D/Dens3R/files for model downloading.
# unify.pth: The complete checkpoint v1.0 version trained on public datasets without using any of our internal proprietary datasets.
# normal.pth: The checkpoint is only for normal prediction, trained on all datasets. This checkpoint achieves normal estimation metrics consistent with those reported in our paper, so we specifically release this normal model separately.
```
--------------------------------
### Install LoFTR from third_party
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/docs/INSTALL.md
Installs the LoFTR package in editable mode from the third_party directory. Also requires downloading LoFTR checkpoints and placing them under third_party/LoFTR/weights/.
```shell
cd third_party/LoFTR
pip install -e .
```
--------------------------------
### Install Nerfstudio and Dependencies (~10 min)
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/colab/demo.ipynb
Installs PyTorch, TinyCUDA, COLMAP, and nerfstudio from source. This is the second step in the Colab setup.
```python
#@markdown Install Nerfstudio and Dependencies (~10 min)
%cd /content/
!pip install --upgrade pip
!pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html
# Installing TinyCuda
%cd /content/
!gdown "https://drive.google.com/u/1/uc?id=1q8fuc-Mqiev5GTBTRA5UPgCaQDzuqKqj"
!pip install tinycudann-1.6-cp37-cp37m-linux_x86_64.whl
# Installing COLMAP
%cd /content/
!conda install -c conda-forge colmap
# Install nerfstudio
%cd /content/
# !pip install nerfstudio
!pip install git+https://github.com/nerfstudio-project/nerfstudio.git
```
--------------------------------
### Install AutoReconForDens3R
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/README.md
Installs the modified AutoRecon package from the local directory.
```bash
cd AutoReconForDens3R
pip install -e .
```
--------------------------------
### Run reconstruction demo
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/README.MD
Run the reconstruction example after downloading the CroCo_V2_ViTLarge_BaseDecoder pretrained model. Update the corresponding line in demo.py if needed.
```bash
python demo.py
```
--------------------------------
### Viewer Setup Output
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/colab/demo.ipynb
Output from the viewer setup command, showing the localtunnel installation and the generated viewer URL.
```text
Output:
/content
[K[?25h/tools/node/bin/lt -> /tools/node/lib/node_modules/localtunnel/bin/lt.js
[K[?25h+ localtunnel@2.0.2
added 22 packages from 22 contributors in 2.07s
https://viewer.nerf.studio/?websocket_url=wss://cyan-facts-matter-34-91-1-218.loca.lt
You may need to click Refresh Page after you start training!
```
--------------------------------
### Run live demo on default webcam
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Starts the SuperPoint + SuperGlue live matching demo on the default USB webcam (ID #0), using a CUDA GPU if available. Keyboard controls: n (anchor), e/r (keypoint threshold), d/f (match threshold), k (toggle keypoints), q (quit).
```sh
./demo_superglue.py
```
--------------------------------
### Create conda environment and install dependencies
Source: https://github.com/alibaba/taobao3d/blob/main/TaoFlowForge/README.md
Sets up a Python 3.10 conda environment named 'taoflowforge' and installs pinned dependencies from requirements.txt. Tested with Python 3.10, PyTorch 2.5.1, and CUDA 12.1.
```bash
conda create -n taoflowforge python=3.10 -y
conda activate taoflowforge
pip install -r requirements.txt
```
--------------------------------
### Download kapture datasets
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/deep-image-retrieval/README.md
Update the dataset list, list available datasets, and install a specific dataset (e.g., Extended-CMU-Seasons_slice22).
```bash
kapture_download_dataset.py update
kapture_download_dataset.py list
# e.g.: install mapping and query of Extended-CMU-Seasons_slice22
kapture_download_dataset.py install "Extended-CMU-Seasons_slice22_*"
```
--------------------------------
### Install hloc from third_party
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/docs/INSTALL.md
Installs the Hierarchical-Localization package in editable mode from the third_party directory.
```shell
cd third_party/Hierarchical-Localization
pip install -e .
```
--------------------------------
### Install PyTorch3d dependencies and package
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/docs/INSTALL.md
Installs fvcore and iopath via conda, then installs PyTorch3d from the stable branch on GitHub.
```shell
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
```
--------------------------------
### Install faiss-gpu via conda
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/README.md
Installs faiss-gpu from conda-forge, following the official guide for AutoRecon dependencies.
```bash
# for example
conda install -c conda-forge faiss-gpu
```
--------------------------------
### Install tiny-cuda-nn
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/docs/INSTALL.md
Installs the PyTorch binding for tiny-cuda-nn via pip. Requires PyTorch with CUDA (tested with CUDA 11.7).
```bash
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
```
--------------------------------
### Setup: Define dataset, pairs, and output paths
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/pipeline_InLoc.ipynb
Sets up file paths for the InLoc dataset, image pairs, and output directories. Requires downloading the InLoc dataset and placing it in 'datasets/inloc/' or adjusting the path.
```python
dataset = Path('datasets/inloc/') # change this if your dataset is somewhere else
pairs = Path('pairs/inloc/')
loc_pairs = pairs / 'pairs-query-netvlad40.txt' # top 40 retrieved by NetVLAD
outputs = Path('outputs/inloc/') # where everything will be saved
results = outputs / 'InLoc_hloc_superpoint+superglue_netvlad40.txt' # the result file
```
--------------------------------
### Install LoFTR matcher only with pip
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/README.md
Use this to install only the LoFTR matcher dependencies without the full trainer. Requires pip.
```shell
pip install torch einops yacs kornia
```
--------------------------------
### Run online demo with webcam or video
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/README.md
Starts the LoFTR online demo using a webcam or video input. The script downloads utils.py from the SuperGlue repo if missing, activates the loftr conda environment, and runs demo_loftr.py with the specified model checkpoint and input.
```bash
cd demo
./run_demo.sh
```
```bash
#!/bin/bash
set -e
# set -x
if [ ! -f utils.py ]; then
echo "Downloading utils.py from the SuperGlue repo."
echo "We cannot provide this file directly due to its strict licence."
wget https://raw.githubusercontent.com/magicleap/SuperGluePretrainedNetwork/master/models/utils.py
fi
# Use webcam 0 as input source.
input=0
# or use a pre-recorded video given the path.
# input=/home/sunjiaming/Downloads/scannet_test/$scene_name.mp4
# Toggle indoor/outdoor model here.
model_ckpt=../weights/indoor_ds.ckpt
# model_ckpt=../weights/outdoor_ds.ckpt
# Optionally assign the GPU ID.
# export CUDA_VISIBLE_DEVICES=0
echo "Running LoFTR demo.."
eval "$(conda shell.bash hook)"
conda activate loftr
python demo_loftr.py --weight $model_ckpt --input $input
# To save the input video and output match visualizations.
# python demo_loftr.py --weight $model_ckpt --input $input --save_video --save_input
# Running on remote GPU servers with no GUI.
# Save images first.
# python demo_loftr.py --weight $model_ckpt --input $input --no_display --output_dir="./demo_images/"
# Then convert them to a video.
# ffmpeg -framerate 15 -pattern_type glob -i '*.png' -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
```
--------------------------------
### Run hloc in Docker
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/README.md
Build and run the Docker image, then start a Jupyter notebook. For GPU support, add `--runtime=nvidia` to the docker run command.
```bash
docker build -t hloc:latest .
docker run -it --rm -p 8888:8888 hloc:latest # for GPU support, add `--runtime=nvidia`
jupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root
```
--------------------------------
### Setup: Load hloc modules and notebook-friendly progress bars
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/demo.ipynb
Initializes the notebook environment with autoreload and imports hloc modules for feature extraction, matching, reconstruction, visualization, and exhaustive pair generation. Replaces tqdm with the notebook version for progress bars.
```python
%load_ext autoreload
%autoreload 2
import tqdm, tqdm.notebook
tqdm.tqdm = tqdm.notebook.tqdm # notebook-friendly progress bars
from pathlib import Path
from hloc import extract_features, match_features, reconstruction, visualization, pairs_from_exhaustive
from hloc.visualization import plot_images, read_image
from hloc.utils import viz_3d
```
--------------------------------
### Clone the AutoDecomp repository
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/docs/INSTALL.md
Clones the AutoDecomp repository with all submodules using SSH.
```shell
git clone --recurse-submodules git@github.com:zju3dv/AutoDecomp.git
```
--------------------------------
### Training on ScanNet
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/docs/TRAINING.md
Run the training script for ScanNet using 4 GPUs. Reproduction of paper results is not guaranteed with this setup.
```shell
scripts/reproduce_train/indoor_ds.sh
```
--------------------------------
### Clone AutoRecon repository
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/docs/INSTALL.md
Clones the AutoRecon repository with submodules using SSH.
```shell
git clone --recurse-submodules git@github.com:zju3dv/AutoRecon.git
```
--------------------------------
### Create conda environment and install dependencies
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/README.MD
Creates a conda environment named 'croco' with Python 3.7 and CMake 3.14.0, then installs habitat-sim, PyTorch, and other packages. habitat-sim is only required for the interactive demo and synthetic pre-training data generation; if not needed, you can skip that line and use a newer Python version.
```bash
conda create -n croco python=3.7 cmake=3.14.0
conda activate croco
conda install habitat-sim headless -c conda-forge -c aihabitat
conda install pytorch torchvision -c pytorch
conda install notebook ipykernel matplotlib
conda install ipywidgets widgetsnbextension
conda install scikit-learn tqdm quaternion opencv # only for pretraining / habitat data generation
```
--------------------------------
### Setup HPatches evaluation environment
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/r2d2/README.md
Clones the D2-Net repository, downloads HPatches sequences and cache, and creates a soft-link for evaluation. Required before extracting features for HPatches benchmark.
```bash
git clone https://github.com/mihaidusmanu/d2-net.git
cd d2-net/hpatches_sequences/
bash download.sh
bash download_cache.sh
cd ../..
ln -s d2-net/hpatches_sequences # finally create a soft-link
```
--------------------------------
### Create conda environment
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/docs/INSTALL.md
Creates a conda environment named 'auto_recon' with Python 3.9, activates it, and upgrades pip and setuptools.
```bash
conda create --name auto_recon -y python=3.9
conda activate auto_recon
python -m pip install --upgrade pip setuptools
```
--------------------------------
### Setup: Load autoreload and import hloc modules
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/pipeline_InLoc.ipynb
Initializes the notebook by enabling autoreload and importing the required hloc functions for feature extraction, matching, localization, and visualization.
```python
%load_ext autoreload
%autoreload 2
from pathlib import Path
from pprint import pformat
from hloc import extract_features, match_features, localize_inloc, visualization
```
--------------------------------
### Training on MegaDepth
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/docs/TRAINING.md
Run the training script for MegaDepth using 4 GPUs with smaller image sizes of 640x640. Reproduction of paper results is not guaranteed under this setup.
```shell
scripts/reproduce_train/outdoor_ds.sh
```
--------------------------------
### Output: raw matches count
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/d2net/qualitative/Qualitative-Matches.ipynb
Example output showing the number of raw matches for pair index 2.
```text
Output:
Number of raw matches: 296.
```
--------------------------------
### Low GPU memory training
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/disk/README.md
Runs training with reduced memory usage, functionally equivalent to the default setup but fits within 11/12GB GPUs. Note that training may take about 2 weeks.
```bash
python train.py --substep 2 --batch-size 1 --chunk-size 10000 --warmup 500
```
--------------------------------
### Start Training with ns-train nerfacto
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/colab/demo.ipynb
Starts NeRF training using the nerfacto model on the processed data. If the transforms.json file exists, it runs ns-train with a websocket port and downscale factor; otherwise, it displays an error message prompting to re-run data processing.
```python
#@markdown Start Training
%cd /content
if os.path.exists(f"data/nerfstudio/{scene}/transforms.json"):
!ns-train nerfacto --viewer.websocket-port 7007 nerfstudio-data --data data/nerfstudio/$scene --downscale-factor 4
else:
display(HTML('Error: Data processing did not complete
'))
display(HTML('Please re-run `Downloading and Processing Data`, or view the FAQ for more info.
'))
```
--------------------------------
### Full COLMAP pipeline example
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/disk/README.md
End-to-end pipeline: detect features, match them, convert to COLMAP database, run exhaustive matching and mapping. Features are inserted without descriptors, so match.py must be used beforehand; exhaustive feature matching still needs to be run.
```bash
# assume we have the images in scene/images
python detect.py --height 1024 --width 1024 --n 2048 scene/h5 scene/images
python match.py --rt 0.95 --save-threshold 100 scene/h5
python colmap/h5_to_db.py --database-path scene/database.db scene/h5 scene/images
# don't use GPU since we aren't computing the descriptor distance matrices anyway,
# only RANSAC
colmap exhaustive_matcher --database_path scene/database.db --SiftMatching.use_gpu 0
mkdir scene/sparse
colmap mapper --database_path scene/database.db --image_path scene/images --output_path scene/sparse
```
--------------------------------
### Launch Gradio Demo with Stage Checkpoints
Source: https://github.com/alibaba/taobao3d/blob/main/TaoFlowForge/README.md
Run the interactive web interface for the three-stage pipeline. Requires stage0, stage1, and stage2 checkpoint files. Use --device to specify the GPU, --host and --port for network binding. Results are stored in /tmp/taoflowforge-*; add --share for a public link.
```bash
python gradio_demo.py \
--stage0-checkpoint weights/stage0.pt \
--stage1-checkpoint weights/stage1.pt \
--stage2-checkpoint weights/stage2.pt \
--device cuda:0 \
--host 0.0.0.0 \
--port 7860
```
--------------------------------
### Run live demo on CPU with resize
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Runs the demo on 320x240 images using the CPU. The --resize flag accepts width and height, a max dimension, or -1 for no resize; default is 640x480.
```sh
./demo_superglue.py --resize 320 240 --force_cpu
```
--------------------------------
### Extract dataset indices and testing data
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/docs/TRAINING.md
Unzip the downloaded dataset indices archive, then extract the training indices for MegaDepth and ScanNet, and optionally extract testing data for both datasets.
```shell
unzip downloaded-file.zip
# extract dataset indices
tar xf train-data/megadepth_indices.tar
tar xf train-data/scannet_indices.tar
# extract testing data (optional)
tar xf testdata/megadepth_test_1500.tar
tar xf testdata/scannet_test_1500.tar
```
--------------------------------
### Accessing the Metal Drawable via CA::MetalLayer
Source: https://github.com/alibaba/taobao3d/blob/main/HRM2Avatar/third/metal-cpp/README.md
Shows how to get the next drawable from a Metal layer. Requires importing QuartzCore.hpp and having a layer associated with the view.
```cpp
#import
// ...
CA::MetalLayer* pMetalLayer = /* layer associated with the view */;
CA::MetalDrawable* pMetalDrawable = pMetalLayer->nextDrawable();
// ...
```
--------------------------------
### Clone and set up deep-image-retrieval
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/deep-image-retrieval/README.md
Clone the repository and set environment variables DIR_ROOT and DB_ROOT for datasets.
```bash
# Download the code
git clone https://github.com/naver/deep-image-retrieval.git
# Create env variables
cd deep-image-retrieval
export DIR_ROOT=$PWD
export DB_ROOT=/PATH/TO/YOUR/DATASETS
# for example: export DB_ROOT=$PWD/dirtorch/data/datasets
```
--------------------------------
### Install PyTorch 1.13.1 with conda
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/docs/INSTALL.md
Installs PyTorch 1.13.1 with CUDA 11.7 via conda. The code is tested with torch==1.13.1.
```shell
conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
```
--------------------------------
### Create dataset symlinks for ScanNet and MegaDepth
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/docs/TRAINING.md
Symlink the downloaded datasets and indices into the LoFTR data directory. For ScanNet, link train/test data and indices separately. For MegaDepth, link both the original and D2-Net preprocessed data to the same train/test directories, then link indices.
```shell
# scannet
# -- # train and test dataset
ln -s /path/to/scannet_train/* /path/to/LoFTR/data/scannet/train
ln -s /path/to/scannet_test/* /path/to/LoFTR/data/scannet/test
# -- # dataset indices
ln -s /path/to/scannet_indices/* /path/to/LoFTR/data/scannet/index
# megadepth
# -- # train and test dataset (train and test share the same dataset)
ln -sv /path/to/megadepth/phoenix /path/to/megadepth_d2net/Undistorted_SfM /path/to/LoFTR/data/megadepth/train
ln -sv /path/to/megadepth/phoenix /path/to/megadepth_d2net/Undistorted_SfM /path/to/LoFTR/data/megadepth/test
# -- # dataset indices
ln -s /path/to/megadepth_indices/* /path/to/LoFTR/data/megadepth/index
```
--------------------------------
### Install PyTorch 1.13.1 with pip
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/docs/INSTALL.md
Installs PyTorch 1.13.1 with CUDA 11.7 via pip using the extra index URL.
```shell
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
```
--------------------------------
### Create conda environment with full pytorch-lightning trainer features
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/README.md
Use this to set up the full LoFTR environment with all trainer features. Run these commands in order: create the environment from environment.yaml, then activate it.
```shell
conda env create -f environment.yaml
conda activate loftr
```
--------------------------------
### Objective-C with ARC: Hello World using NSAutoreleasePool and NSString
Source: https://github.com/alibaba/taobao3d/blob/main/HRM2Avatar/third/metal-cpp/README.md
Shows how to use Foundation classes with automatic reference counting. No explicit release of the pool is needed.
```objc
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSString* string = [NSString stringWithCString: "Hello World" encoding: NSASCIIStringEncoding];
printf( "string = \"%s\"\n", [string cStringUsingEncoding: NSASCIIStringEncoding] );
```
--------------------------------
### Install Conda (requires runtime restart)
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/colab/demo.ipynb
Installs condacolab and triggers a runtime restart. This is the first step in the Colab setup.
```python
#@markdown Install Conda (requires runtime restart)
!pip install -q condacolab
import condacolab
condacolab.install()
```
--------------------------------
### C++: Hello World using NS::AutoreleasePool and NS::String
Source: https://github.com/alibaba/taobao3d/blob/main/HRM2Avatar/third/metal-cpp/README.md
Shows the C++ binding for Foundation classes. The pool is released manually with pPool->release().
```cpp
NS::AutoreleasePool* pPool = NS::AutoreleasePool::alloc()->init();
NS::String* pString = NS::String::string( "Hello World", NS::ASCIIStringEncoding );
printf( "pString = \"%s\"\n", pString->cString( NS::ASCIIStringEncoding ) );
pPool->release();
```
--------------------------------
### C++ with NS::SharedPtr: Hello World using smart pointer
Source: https://github.com/alibaba/taobao3d/blob/main/HRM2Avatar/third/metal-cpp/README.md
Uses NS::SharedPtr with NS::TransferPtr to manage the autorelease pool automatically; no manual release needed.
```cpp
NS::SharedPtr< NS::AutoreleasePool > pPool = NS::TransferPtr( NS::AutoreleasePool::alloc()->init() );
NS::String* pString = NS::String::string( "Hello World", NS::ASCIIStringEncoding );
printf( "pString = \"%s\"\n", pString->cString( NS::ASCIIStringEncoding ) );
```
--------------------------------
### Generate PDF visualizations with match_pairs.py
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Use the --viz flag with --viz_extension pdf to generate camera-ready PDF visualizations instead of the default png extension.
```bash
./match_pairs.py --viz --viz_extension pdf
```
--------------------------------
### Reconstruct pose and pointcloud of an image sequence using dens3r_recon.py
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/README.md
Reconstructs camera poses and a pointcloud from an image sequence. Supports optional pre-computed COLMAP poses via --triangulate_from_pose, and configurable matching mode, resolution, and COLMAP settings.
```bash
# example
python infer/dens3r_recon.py \
--img_dir path/to/images/folder \
--output_dir path/to/save/results \
--model_path path/to/model/checkpoint
```
--------------------------------
### Infer normal/depth of an image sequence using infer_normal_pts3d.py
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/README.md
Runs Dens3R inference to estimate normals and depth for an image sequence. Requires a model checkpoint path, image folder, and save folder. Use --pair_mode to control image pairing: self, near, or sequence.
```bash
# example
python infer/infer_normal_pts3d.py \
--model_path path/to/model/checkpoint \
--img_dir path/to/images/folder \
--save_dir path/to/save/folder \
--pair_mode self \
--size 512
```
--------------------------------
### Install conda packages
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/deep-image-retrieval/README.md
Install required Python packages using conda: numpy, matplotlib, tqdm, scikit-learn, and PyTorch with torchvision.
```bash
conda install numpy matplotlib tqdm scikit-learn
conda install pytorch torchvision -c pytorch
```
--------------------------------
### Download Habitat test scene
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/README.MD
Download the test scene from Habitat for the interactive cross-view completion demo. Use the specified command with the habitat_test_scenes uid.
```bash
python -m habitat_sim.utils.datasets_download --uids habitat_test_scenes --data-path habitat-sim-data/
```
--------------------------------
### Download cache with results for all methods
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/d2net/hpatches_sequences/README.md
Run this script to download the cache with results for all methods from the D2-Net paper.
```bash
bash download_cache.sh
```
--------------------------------
### Outdoor matching settings
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Recommended settings for outdoor images. Runs match_pairs.py with resize 1600, outdoor SuperGlue, max_keypoints 2048, nms_radius 3, and resize_float.
```sh
./match_pairs.py --resize 1600 --superglue outdoor --max_keypoints 2048 --nms_radius 3 --resize_float
```
--------------------------------
### Install R2D2 dependencies with conda
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/r2d2/README.md
Install required Python packages and PyTorch with CUDA 10.1 using conda. Requires Python 3.6+ and PyTorch 1.1+.
```bash
conda install python tqdm pillow numpy matplotlib scipy
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
```
--------------------------------
### Create the device - C++
Source: https://github.com/alibaba/taobao3d/blob/main/HRM2Avatar/third/metal-cpp/README.md
Creates a Metal device using the C++ API. The device is returned as a raw pointer and must be released manually.
```cpp
MTL::Device* pDevice = MTL::CreateSystemDefaultDevice();
// ...
pDevice->release();
```
--------------------------------
### Install dependencies with pip3
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Install required Python packages: NumPy, OpenCV, PyTorch, and Matplotlib. Requires Python 3.5+, PyTorch 1.1+, OpenCV 3.4+ (4.1.2.30 recommended), Matplotlib 3.1+, and NumPy 1.18+.
```sh
pip3 install numpy opencv-python torch matplotlib
```
--------------------------------
### Install required packages with Conda
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/d2net/README.md
Use Conda to install PyTorch, torchvision, CUDA 10.0, and other dependencies for running D2-Net. Python 3.6+ is recommended.
```bash
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
conda install h5py imageio imagesize matplotlib numpy scipy tqdm
```
--------------------------------
### Setup and imports for hloc pipeline
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/pipeline_Aachen.ipynb
Loads the autoreload extension and imports the hloc modules needed for feature extraction, matching, and localization. This is the initial setup cell for the Aachen Day-Night pipeline.
```python
%load_ext autoreload
%autoreload 2
from pathlib import Path
from pprint import pformat
from hloc import extract_features, match_features, pairs_from_covisibility, pairs_from_retrieval
from hloc import colmap_from_nvm, triangulation, localize_sfm, visualization
```
--------------------------------
### Run full image-to-mesh pipeline
Source: https://github.com/alibaba/taobao3d/blob/main/TaoFlowForge/README.md
Executes the complete image-to-mesh pipeline via the CLI. Requires stage checkpoints; optionally supply a DINOv3 pretrained directory with --dino-checkpoint if not embedded.
```bash
python -m taoflowforge.cli run \
--image path/to/input.png \
--stage0-checkpoint weights/stage0.pt \
--stage1-checkpoint weights/stage1.pt \
--stage2-checkpoint weights/stage2.pt \
--output-dir output/example \
--seed 42
```
--------------------------------
### Indoor matching settings
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Recommended settings for indoor images, which are the defaults. Runs match_pairs.py with resize 640, indoor SuperGlue, max_keypoints 1024, and nms_radius 4.
```sh
./match_pairs.py --resize 640 --superglue indoor --max_keypoints 1024 --nms_radius 4
```
--------------------------------
### Download and test Kitti finetuned model
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/stereoflow/README.MD
Commands to download the Kitti finetuned model and run a submission.
```bash
bash stereoflow/download_model.sh crocostereo_finetune_kitti.pth
```
```bash
python stereoflow/test.py --model stereoflow_models/crocostereo_finetune_kitti.pth --dataset "Kitti15('test')" --save submission --tile_overlap 0.9
```
--------------------------------
### Output: inliers count
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/d2net/qualitative/Qualitative-Matches.ipynb
Example output showing the number of inliers after RANSAC for pair index 2.
```text
Output:
Number of inliers: 69.
```
--------------------------------
### Run matching on sample outdoor pairs
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Runs matching and visualization on provided Phototourism pairs with no ground truth. Uses --resize 1600, --superglue outdoor, --max_keypoints 2048, --nms_radius 3, --resize_float, and specifies input and output directories.
```sh
./match_pairs.py --resize 1600 --superglue outdoor --max_keypoints 2048 --nms_radius 3 --resize_float --input_dir assets/phototourism_sample_images/ --input_pairs assets/phototourism_sample_pairs.txt --output_dir dump_match_pairs_outdoor --viz
```
--------------------------------
### Match image pairs with LoFTR
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/README.md
Initialize the LoFTR matcher with the indoor checkpoint and perform inference on a batch containing image0 and image1. The matched keypoints are extracted from the batch after the forward pass.
```python
from src.loftr import LoFTR, default_cfg
# Initialize LoFTR
matcher = LoFTR(config=default_cfg)
matcher.load_state_dict(torch.load("weights/indoor_ds.ckpt")['state_dict'])
matcher = matcher.eval().cuda()
# Inference
with torch.no_grad():
matcher(batch) # batch = {'image0': img0, 'image1': img1}
mkpts0 = batch['mkpts0_f'].cpu().numpy()
mkpts1 = batch['mkpts1_f'].cpu().numpy()
```
--------------------------------
### Download trained models for CroCo-Stereo and CroCo-Flow
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/stereoflow/README.MD
Run these commands from the root directory to download the pretrained models required for the inference demo notebook.
```bash
bash stereoflow/download_model.sh crocostereo.pth
```
```bash
bash stereoflow/download_model.sh crocoflow.pth
```
--------------------------------
### Extract features for RParis6K with Resnet101-AP-GeM
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/deep-image-retrieval/README.md
Example command to extract features for the RParis6K dataset using the Resnet-101-AP-GeM.pt model, saving to rparis6k_features.npy. Requires setting DB_ROOT to your datasets path.
```bash
cd $DIR_ROOT
export DB_ROOT=/PATH/TO/YOUR/DATASETS
python -m dirtorch.extract_features --dataset RParis6K \
--checkpoint dirtorch/data/Resnet101-AP-GeM.pt \
--output rparis6k_features.npy \
--whiten Landmarks_clean --whitenp 0.25 --gpu 0
```
--------------------------------
### Run matching with visualization (--viz)
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Adds the --viz flag to dump image outputs that visualize the matches. The matches are colored by predicted confidence in a jet colormap (red: more confident, blue: less confident).
```sh
./match_pairs.py --viz
```
--------------------------------
### Evaluation results output
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Collated results printed to the terminal when running with --eval. The numbers shown are for the example images provided and may vary slightly due to non-determinism.
```txt
Evaluation Results (mean over 15 pairs):
AUC@5 AUC@10 AUC@20 Prec MScore
26.99 48.40 64.47 73.52 19.60
```
--------------------------------
### Set up symlinks for ScanNet and MegaDepth test data
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/LoFTR/README.md
Creates symlinks from the previously downloaded ScanNet and MegaDepth test subsets to the LoFTR data directories. Requires the datasets to be set up first.
```shell
# set up symlinks
ln -s /path/to/scannet-1500-testset/* /path/to/LoFTR/data/scannet/test
ln -s /path/to/megadepth-1500-testset/* /path/to/LoFTR/data/megadepth/test
```
--------------------------------
### Undistort MegaDepth reconstructions
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/d2net/README.md
Generates undistorted reconstructions from the MegaDepth dataset using COLMAP. Requires COLMAP to be installed.
```bash
python undistort_reconstructions.py --colmap_path /path/to/colmap/executable --base_path /path/to/megadepth
```
--------------------------------
### Faster visualization with --fast_viz
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Use the --fast_viz flag to save visualization images faster with an OpenCV-based renderer.
```bash
./match_pairs.py --viz --fast_viz
```
--------------------------------
### Create the device - Objective-C (manual memory management)
Source: https://github.com/alibaba/taobao3d/blob/main/HRM2Avatar/third/metal-cpp/README.md
Creates a Metal device without ARC. You must manually release the device when done.
```objc
id< MTLDevice > device = MTLCreateSystemDefaultDevice();
// ...
[device release];
```
--------------------------------
### Render Video Output Log
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/colab/demo.ipynb
Example output from the render video command, showing skipped files, loading checkpoints, and successful video creation at renders/output.mp4.
```text
Output:
[2;36m[19:48:48][0m[2;36m [0mSkipping [1;36m0[0m files in dataset split train. ]8;id=527413;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py\[2mnerfstudio_dataparser.py[0m]8;;\[2m:[0m]8;id=243595;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py#91\[2m91[0m]8;;\
[2;36m [0m[2;36m [0mSkipping [1;36m0[0m files in dataset split test. ]8;id=109270;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py\[2mnerfstudio_dataparser.py[0m]8;;\[2m:[0m]8;id=464675;file:///content/nerfstudio/nerfstudio/data/dataparsers/nerfstudio_dataparser.py#91\[2m91[0m]8;;\
[2KLoading data batch [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m100%[0m [36m0:00:00[0m
[?25h/usr/local/lib/python3.7/site-packages/torch/utils/data/dataloader.py:566: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
cpuset_checked))
[2KLoading data batch [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m100%[0m [36m0:00:00[0m
[?25h/usr/local/lib/python3.7/site-packages/torchvision/models/_utils.py:209: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead.
f"The parameter '{pretrained_param}' is deprecated since 0.13 and will be removed in 0.15, "
/usr/local/lib/python3.7/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=AlexNet_Weights.IMAGENET1K_V1`. You can also use `weights=AlexNet_Weights.DEFAULT` to get the most up-to-date weights.
warnings.warn(msg)
Loading latest checkpoint from load_dir
✅ Done loading checkpoint from
outputs/data-nerfstudio-poster/nerfacto/[1;36m2022[0m-[1;36m10[0m-29_192844/nerfstudio_models/step-[1;36m000014000.[0mckpt
[1;32mCreating trajectory video[0m
[2K🎥 Rendering 🎥 [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m100%[0m [31m0.14 fps[0m [33m11:47[0m
[2K[32m( ● )[0m [33mSaving video[0m
[1A[2K[92m────────────────────────────────────────────── [0m[32m 🎉 🎉 🎉 Success 🎉 🎉 🎉[0m[92m ──────────────────────────────────────────────[0m
[32mSaved video to renders/output.mp4[0m
[0m
```
--------------------------------
### Dataset directory structure after conversion
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/disk/README.md
Shows the layout of the generated dataset directory, including calibration H5 files, depth H5 files, and dataset.json.
```bash
tree colmap_output/dataset/
├── calibration
│ ├── calibration_2020_07_25__12_09_03.jpg.h5
│ ├── calibration_2020_07_25__12_09_05.jpg.h5
│ ├── ..
├── dataset.json
└── depth
├── 2020_07_25__12_09_03.h5
├── 2020_07_25__12_09_05.h5
├── ..
```
--------------------------------
### Set pair index for qualitative matching
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/d2net/qualitative/Qualitative-Matches.ipynb
Selects the image pair index (1, 2, or 3) for the qualitative matching example. Asserts the value is valid.
```python
pair_idx = 2
assert(pair_idx in [1, 2, 3])
```
--------------------------------
### OpenCV display window with --opencv_display
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/SuperGluePretrainedNetwork/README.md
Use --opencv_display to preview results in an OpenCV display window. Requires non-pdf output and --fast_viz.
```bash
./match_pairs.py --viz --fast_viz --opencv_display
```
--------------------------------
### Train D2-Net on MegaDepth
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/AutoReconForDens3R/third_party/AutoDecomp/third_party/Hierarchical-Localization/third_party/d2net/README.md
Starts training after downloading and preprocessing MegaDepth. Uses --use_validation and requires paths to the dataset and preprocessing output.
```bash
python train.py --use_validation --dataset_path /path/to/megadepth --scene_info_path /path/to/preprocessing/output
```
--------------------------------
### Download and test Spring finetuned model
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/stereoflow/README.MD
Commands to download the Spring finetuned model and run a submission.
```bash
bash stereoflow/download_model.sh crocostereo_finetune_spring.pth
```
```bash
python stereoflow/test.py --model stereoflow_models/crocostereo_finetune_spring.pth --dataset "Spring('test')" --save submission --tile_overlap 0.9
```
--------------------------------
### Download, Submit, and Train CroCo-Flow Finetuned on Spring
Source: https://github.com/alibaba/taobao3d/blob/main/Dens3R/croco/stereoflow/README.MD
Commands for the CroCo-Flow model finetuned on Spring. Includes model download, Spring test submission, and the training command used with checkpoint-last.pth, starting from the main crocoflow.pth.
```bash
# Download the model
bash stereoflow/download_model.sh crocoflow_finetune_spring.pth
```
```bash
# Spring submission
python stereoflow/test.py --model stereoflow_models/crocoflow_finetune_spring.pth --dataset "Spring('test')" --save submission --tile_overlap 0.9
```
```bash
# Training command that was used, with checkpoint-last.pth
python -u stereoflow/train.py flow --criterion "LaplacianLossBounded()" --dataset "Spring('train')" --lr 2e-5 --batch_size 8 --epochs 12 --pretrained pretrained_models/CroCo_V2_ViTLarge_BaseDecoder.pth --start_from stereoflow_models/crocoflow.pth --output_dir xps/crocoflow/finetune_spring/
```