MCPcopy Index your code
hub / github.com/apple/ml-aspanformer

github.com/apple/ml-aspanformer @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
228 symbols 718 edges 52 files 74 documented · 32%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ASpanFormer Implementation

Framework

This is a PyTorch implementation of ASpanFormer for ECCV'22 paper, “ASpanFormer: Detector-Free Image Matching with Adaptive Span Transformer”, and can be used to reproduce the results in the paper.

This work focuses on detector-free image matching. We propose a hierarchical attention framework for cross-view feature update, which adaptively adjusts attention span based on region-wise matchability.

This repo contains training, evaluation and basic demo scripts used in our paper.

A large part of the code base is borrowed from the LoFTR Repository under its own separate license, terms and conditions. The authors of this software are not responsible for the contents of third-party websites.

Installation

conda env create -f environment.yaml
conda activate ASpanFormer

Get started

Download model weights from here

Extract weights by

tar -xvf weights_aspanformer.tar

A demo to match one image pair is provided. To get a quick start,

cd demo
python demo.py

Data Preparation

Please follow the training doc for data organization

Evaluation

1. ScanNet Evaluation

cd scripts/reproduce_test
bash indoor.sh

Similar results as below should be obtained,

'auc@10': 0.46640095171012563,
'auc@20': 0.6407042320049785,
'auc@5': 0.26241231577189295,
'prec@5e-04': 0.8827665604024288,
'prec_flow@2e-03': 0.810938751342228

2. MegaDepth Evaluation

```bash cd scripts/reproduce_test bash outdoor.sh

Similar results as below should be obtained,
```bash
'auc@10': 0.7184113573584142,
'auc@20': 0.8333835724453831,
'auc@5': 0.5567622479156181,
'prec@5e-04': 0.9901741341790503,
'prec_flow@2e-03': 0.7188964321862907

Training

1. ScanNet Training

cd scripts/reproduce_train
bash indoor.sh

2. MegaDepth Training

cd scripts/reproduce_train
bash outdoor.sh

If you find this project useful, please cite:

@article{chen2022aspanformer,
  title={ASpanFormer: Detector-Free Image Matching with Adaptive Span Transformer},
  author={Chen, Hongkai and Luo, Zixin and Zhou, Lei and Tian, Yurun and Zhen, Mingmin and Fang, Tian and McKinnon, David and Tsin, Yanghai and Quan, Long},
  journal={European Conference on Computer Vision (ECCV)},
  year={2022}
}

Core symbols most depended-on inside this repo

update
called by 36
src/ASpanFormer/aspan_module/transformer.py
conv3x3
called by 10
src/ASpanFormer/backbone/resnet_fpn.py
flattenList
called by 9
src/utils/misc.py
profile
called by 7
src/utils/profiler.py
conv1x1
called by 7
src/ASpanFormer/backbone/resnet_fpn.py
load
called by 6
tools/SensorData.py
save_mat_to_file
called by 5
tools/SensorData.py
make_matching_figures_offset
called by 4
src/utils/plotting.py

Shape

Method 112
Function 86
Class 30

Languages

Python100%

Modules by API surface

src/ASpanFormer/aspan_module/transformer.py16 symbols
src/ASpanFormer/aspan_module/attention.py15 symbols
tools/SensorData.py14 symbols
src/utils/dataset.py13 symbols
src/utils/comm.py13 symbols
src/ASpanFormer/backbone/resnet_fpn.py13 symbols
src/utils/misc.py12 symbols
src/lightning/lightning_aspanformer.py12 symbols
src/utils/metrics.py11 symbols
src/losses/aspan_loss.py10 symbols
src/lightning/data.py10 symbols
src/utils/plotting.py9 symbols

For agents

$ claude mcp add ml-aspanformer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact