SGAM
Introduces the A2PM framework. Matches semantic areas using a semantic prior, then enforces geometric consistency (GAM) to filter and fuse inside-area point matches.
A training-free, plug-and-play framework that makes any point matcher more accurate on high-resolution images and large viewpoint changes — by first finding matched semantic areas, then matching points inside them.
Why A2PM? Feeding a resized full image to a point matcher (top) causes aspect-ratio distortion and loses local detail. A2PM first establishes area matches (bottom), runs the point matcher on each cropped pair, and fuses the results — fewer outliers, more precise matches.
One repository, a family of three methods, and a Hydra-configurable pipeline that wraps the matcher you already use.
Pose AUC@5 gained on MegaDepth-1500 when DMESA is wrapped around MASt3R (46.34 → 57.58), with no retraining.
Any matcher plugs in through a thin adapter. The repo ships seven, sparse to dense: SP+SG, LoFTR, ASpanFormer, ELoFTR, DKM, DUSt3R, MASt3R.
DMESA replaces MESA’s graph-cut area matching with dense distributions (GMM + EM), running nearly 5× faster with competitive accuracy.
All three methods share the same idea: reduce matching redundancy by searching from area to point. They differ in how areas are matched.
Introduces the A2PM framework. Matches semantic areas using a semantic prior, then enforces geometric consistency (GAM) to filter and fuse inside-area point matches.
Uses SAM to build a multi-relational Area Graph and formulates area matching as graph energy minimization solved by graph cut. This repo ships a training-free variant, MESA-free.
The dense counterpart of MESA. Generates dense area-matching distributions from off-the-shelf patch matching, modeled with a GMM and refined by EM. It is about 5× faster and more flexible.
Each method finds area matches in its own way, then hands every matched pair to a point matcher. Switch between the pipelines below.
SAM (or SAM2) proposes candidate areas, which are organized into an Area Graph that records inclusion and adjacency relations.
SGAM uses a semantic prior. MESA uses graph energy minimization and graph cut. DMESA uses dense distributions with GMM + EM.
Any point matcher runs on each area pair at full detail. GAM / EGAM then fuses the results with geometric consistency.
Drag the slider to compare the DKM baseline with DKM inside our framework. Green = correct, red = wrong matches.
ΔR / Δt are rotation and translation errors of the relative pose estimated from the matches (lower is better).
Relative pose estimation AUC (%) produced by the scripts in this repo. Pick a point matcher and a dataset.
Results come from the provided scripts with a fixed random seed and default parameters, so they can differ slightly from the paper. MESA-free is the training-free variant of MESA. SN1500 = ScanNet-1500, MD1500 = MegaDepth-1500.
Every component is a Python class paired with a YAML config via Hydra. Mix and match with one line: +experiment=a2pm_dmesa_egam_dkm_megadepth.
The point-matcher row is not a closed list. Every integration is a thin adapter (AbstractPointMatcher) plus a YAML in point_matchers/, so any matcher that outputs 2D correspondences can be dropped into the pipeline unchanged — the seven above are simply the ones that ship in this repo.
Run area-to-point matching on the bundled ETH3D pair in a few minutes. See the README for full setup, SAM preprocessing and benchmarks.
git clone --recursive https://github.com/Easonyesheng/A2PM-MESA
cd A2PM-MESA
conda create -n A2PM python=3.8 -y && conda activate A2PM
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 \
--index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
cd scripts
# DMESA + SuperPoint/SuperGlue on the bundled ETH3D pair
python demo.py +experiment=demo out_path=/tmp/a2pm_demo
# other ready-made pipelines: conf/experiment/demo_*.yaml
python demo.py +experiment=demo_eloftr
# DMESA with MASt3R (needs the MASt3R env)
python demo.py +experiment=demo_dmesa_mast3r
A talk on MESA (Bilibili, in Chinese), and SGAM running on a continuous sequence.
SGAM accepted to Pattern Recognition, and DMESA published in TPAMI (vol. 48, no. 4).
MASt3R can now serve as the coarse matcher for DMESA and MESA-free area matching.
Added support for MASt3R, DUSt3R and ELoFTR, with expected results provided.
Added a Windows 11 manual (Chinese). Thanks @MY-QY.
Added a single image pair demo wrapper.
Added SAM2 support for segmentation preprocessing.
MESA presented at CVPR 2024.
If you find this work useful, please consider citing: