Xinmiao Xiong1*,
Bangya Liu1*,
Hao Wang2,
Dayou Li2,
Nuo Chen2,
Andrew Feng3,
Mingyu Ding4,
Suman Banerjee1,
Yang Zhou2,
Zhiwen Fan2†
1UW–Madison
2Texas A&M
3USC
4UNC Chapel Hill
*Equal contribution.
†Corresponding author: zhiwenfan@tamu.edu.
LeanGate is a framework for accelerating transformer-based monocular SLAM via geometric utility scoring. It bypasses over 90% of input frames in dense streaming while preserving the fidelity of mapping, tracking, and camera pose estimation.
- We identify late rejection as the main bottleneck in GFM-based monocular SLAM, where dense streams spend most compute on temporally redundant frames.
- We introduce a pairwise geometric utility score and a lightweight feed-forward gating network that predicts frame value before expensive geometric decoding.
- We show across multiple SLAM benchmarks that LeanGate improves end-to-end throughput by 5x and reduces tracking FLOPs by over 85% without compromising tracking accuracy.
This repository exposes the inference path of LeanGate.
- download the released LeanGate checkpoint,
- run LeanGate on prepared
TUM,7SCENES, orEUROCscenes, - export a sparse RGB manifest,
- optionally run MASt3R-SLAM on that sparse sequence.
third_party/FLARE and third_party/MASt3R-SLAM are Git submodules. Clone the
repo with submodules, or initialize them before installing:
git clone --recurse-submodules <repo-url>
cd slam_public
# If you already cloned without submodules:
git submodule update --init --recursive- LeanGate code release
pip install -r requirements-public.txt
pip install -e .
pip install -e third_party/MASt3R-SLAM/thirdparty/mast3r
pip install -e third_party/MASt3R-SLAM/thirdparty/in3d
pip install --no-build-isolation -e third_party/MASt3R-SLAM
python3 scripts/download_checkpoints.py --output-root checkpoints
python3 scripts/generate_rgb_lists.py \
--dataset-type TUM \
--dataset-root /data/tum \
--output-root outputs/predictions \
--device cuda:0
./demo.sh --folder /data/my_rgb_frames --device cuda:0- A checkpoint download entrypoint:
scripts/download_checkpoints.py - A sparse RGB export entrypoint:
scripts/generate_rgb_lists.py - A plain-RGB-folder demo wrapper:
demo.sh - A single-scene MASt3R-SLAM wrapper:
scripts/run_slam_scene.py - A dataset-level MASt3R-SLAM wrapper:
scripts/run_slam_dataset.py
The intended public workflow is:
prepared scene directories
-> LeanGate inference
-> sparse rgb manifest
-> staged sparse scene for MASt3R-SLAM
-> trajectory / reconstruction outputs
TUM7SCENESEUROC
The benchmark CLIs support only prepared layouts. The exact expected structures are documented in docs/dataset_layouts.md. For a plain image directory, use demo.sh --folder ....
Use python3 and install PyTorch, torchvision, and pytorch3d matching your
CUDA/runtime first. Then install the remaining public runtime dependencies and
the local packages:
pip install -r requirements-public.txt
pip install -e .
pip install -e third_party/MASt3R-SLAM/thirdparty/mast3r
pip install -e third_party/MASt3R-SLAM/thirdparty/in3d
pip install --no-build-isolation -e third_party/MASt3R-SLAMIf the submodules are missing, run:
git submodule update --init --recursiveThe public LeanGate checkpoint is hosted at:
- Repo:
ShawnX98/LeanGate - URL:
https://huggingface.co/ShawnX98/LeanGate - File:
https://huggingface.co/ShawnX98/LeanGate/resolve/main/leangate.pt
Download it with:
python3 scripts/download_checkpoints.py --output-root checkpointsCheckpoint notes:
- The public LeanGate file is expected locally as
checkpoints/leangate.pt. scripts/generate_rgb_lists.pyusesleangate.ptdirectly as the initialization source; the released setup does not require separateiterordecflags.- LeanGate uses FLARE pretrain weights, which follow FLARE's upstream terms.
- MASt3R-SLAM code and any weights used with it follow MASt3R-SLAM's upstream terms.
python3 scripts/generate_rgb_lists.py \
--dataset-type TUM \
--dataset-root /data/tum \
--output-root outputs/predictions \
--device cuda:0Each scene produces a manifest containing the kept RGB frames in original scene-relative paths and timestamp order.
By default the public CLI runs LeanGate on a temporally subsampled input
sequence with --input-subsample 2. Pass --input-subsample 1 if you want to
score the full prepared sequence.
For a plain RGB folder demo without dataset manifests:
./demo.sh \
--folder /data/my_rgb_frames \
--output-root outputs/demo \
--device cuda:0This processes images in sorted filename order and writes the filtered list to outputs/demo/leangate/<folder_name>.txt.
The demo wrapper also defaults to --input-subsample 2; pass
--input-subsample 1 to disable that preprocessing step.
Single scene:
python3 scripts/run_slam_scene.py \
--dataset-type TUM \
--dataset-root /data/tum \
--scene-id rgbd_dataset_freiburg1_desk \
--predictions-root outputs/predictions \
--output-root outputs/slamFull dataset:
python3 scripts/run_slam_dataset.py \
--dataset-type TUM \
--dataset-root /data/tum \
--predictions-root outputs/predictions \
--output-root outputs/slamThe wrapper materializes a sparse scene under outputs/mast3r_sparse_inputs/, generates an intrinsics.yaml when a supported calibration file is available, and then calls the MASt3R-SLAM submodule entrypoint.
Sparse RGB generation:
outputs/predictions/<dataset_slug>/leangate/<scene>.txtoutputs/predictions/<dataset_slug>/leangate/scores/<scene>_scores.csv
MASt3R-SLAM wrapper:
outputs/slam/<dataset_slug>/leangate/<scene>/trajectory_keyframes.tumoutputs/slam/<dataset_slug>/leangate/<scene>/reconstruction.plywhen MASt3R-SLAM saves oneoutputs/slam/<dataset_slug>/leangate/<scene>/run_metadata.jsonoutputs/slam/<dataset_slug>/leangate/summary.csvoutputs/slam/<dataset_slug>/leangate/summary.json
- If
leangate.ptis missing, runpython3 scripts/download_checkpoints.py --output-root checkpoints. - If scene discovery fails, the dataset layout likely does not match docs/dataset_layouts.md.
- If
third_party/FLAREorthird_party/MASt3R-SLAMis empty, rungit submodule update --init --recursive. - If MASt3R-SLAM import fails, ensure its Python packages were installed from
third_party/MASt3R-SLAM/.
third_party/FLARE/andthird_party/MASt3R-SLAM/are upstream Git submodules, not code relicensed under the top-level Apache-2.0 license.- LeanGate uses FLARE pretrain weights from
third_party/FLARE/. - The optional SLAM stage uses MASt3R-SLAM from
third_party/MASt3R-SLAM/. - Review THIRD_PARTY_NOTICES.md and the upstream license files before using or redistributing these components.
scripts/: public CLI entrypointssrc/evaluate/: public workflow logicsrc/student/: LeanGate model loading and inferencesrc/slam_prefilter/: compatibility utilities for RGB sequence loadingthird_party/FLARE/: FLARE Git submodulethird_party/MASt3R-SLAM/: MASt3R-SLAM Git submodule


