Need help with ASLFeat?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

205 Stars 23 Forks MIT License 38 Commits 9 Opened issues


Implementation of CVPR'20 paper - ASLFeat: Learning Local Features of Accurate Shape and Localization

Services available


Need anything else?

Contributors list

# 222,842
Deep le...
30 commits

ASLFeat implementation


TensorFlow implementation of ASLFeat for CVPR'20 paper "ASLFeat: Learning Local Features of Accurate Shape and Localization", by Zixin Luo, Lei Zhou, Xuyang Bai, Hongkai Chen, Jiahui Zhang, Yao Yao, Shiwei Li, Tian Fang and Long Quan.

This paper presents a joint learning framework of local feature detectors and descriptors. Two aspects are addressed to learn a powerful feature: 1) shape-awareness of feature points, and 2) the localization accuracy of keypoints. If you find this project useful, please cite:

  title={ASLFeat: Learning Local Features of Accurate Shape and Localization},
  author={Luo, Zixin and Zhou, Lei and Bai, Xuyang and Chen, Hongkai and Zhang, Jiahui and Yao, Yao and Li, Shiwei and Fang, Tian and Quan, Long},
  journal={Computer Vision and Pattern Recognition (CVPR)},


Please use Python 3.7, install NumPy, OpenCV (3.4.2) and TensorFlow (1.15.2). Refer to requirements.txt for some other dependencies.

If you are using conda, you may configure ASLFeat as:

conda create --name aslfeat python=3.7 -y && \
pip install -r requirements.txt && \
conda activate aslfeat

4/14/2020 Update

We here release ASLFeat with post-CVPR update, which we find to perform consistently better among the evaluations. The model can be accessed by:


On HPatches dataset, the [email protected] is improved from 72.29 to 74.31 in single scale prediction, while the multi-scale prediction now achieves 75.26. The major difference comes from 1) using blended images and rendered depths, which is proposed in BlendedMVS and integrated in GL3D, 2) using circle loss and 3) conducting early stopping. Details can be found in the updated arxiv paper. The above implementation is also available in TFMatch.

Get started

Clone the repo and download the pretrained model:

git clone && \
cd ASLFeat/pretrained && \
wget && \
tar -xvf aslfeat.tar

A quick example for image matching can be called by:

cd /local/aslfeat && python --config configs/matching_eval.yaml

You will be able to see the matching results by displaying disp.jpg.

You may configure

to test images of your own.

Training scripts

We release the training scripts in a separate project, TFMatch, which also contains our previous research works (GeoDesc, ECCV'18 and ContextDesc, CVPR'19).

Evaluation scripts

1. Benchmark on HPatches dataset

Download the original sequences (i.e.,

), configure
, and call:
cd /local/aslfeat && python --config configs/hseq_eval.yaml

At the end of running, we report the average number of features, repeatability, precision, matching score, recall and mean matching accuracy (a.k.a. MMA). The evaluation results will be displayed as:

0 /data/hpatches-sequences-release/v_abstract
5000 [0.65887743 0.7993664  0.49892387 0.73872983 0.7671514  0.6]
1 /data/hpatches-sequences-release/v_adam
1620 [0.6605903  0.88857824 0.45584163 0.6810486  0.88263476 0.6]
avg_n_feat 3924
avg_rep 0.62246275
avg_precision 0.73995966
avg_matching_score 0.41950417
avg_recall 0.63767093
avg_MMA 0.7228764
avg_homography_accuracy 0.72037053

As a reference, ASLFeat with post-CVPR update achieves:

avg_n_feat 3617
avg_rep 0.6026927 
avg_precision 0.75740457 
avg_matching_score 0.42784035 
avg_recall 0.6682571 
avg_MMA 0.74305236 
avg_homography_accuracy 0.7314815

When multi-scale (MS) inference is enabled, the results become:

avg_n_feat 4241
avg_rep 0.6737002
avg_precision 0.7681067
avg_matching_score 0.41503817
avg_recall 0.58123404
avg_MMA 0.7526477
avg_homography_accuracy 0.7537038

The results for repeatability and matching score is different from what we have reported in the paper, as we now apply a symmetric check when counting the number of covisible features (referring to SuperPoint). This change may not influence the conclusion in the section of ablation study, but would be useful for making comparision with other relavant papers. We thank for Sida Peng for pointing this out when reproducing this work.

To plot the results (i.e., reproduce Fig.3 in the paper, shown below), please include the cached files, use the tool provided by D2-Net.


2. Benchmark on FM-Bench

Download the (customized for data loading and randomness eschewing) evaluation pipeline, and follow the instruction to download the testing data:

git clone


and call:
cd /local/aslfeat && python --config configs/fmbench_eval.yaml

The extracted features will be stored in

. Use Matlab to run
to obtain the results.

The cached results of ASLFeat can be reached here.

3. Benchmark on visual localization

Download the Aachen Day-Night dataset and follow the instructions to configure the evaluation.


, and call:
cd /local/aslfeat && python --config configs/aachen_eval.yaml

The extracted features will be saved alongside their corresponding images, e.g., the features for image

will be in the file
(the method name here is

Finally, refer to the evaluation script to generate and submit the results to the challenge website.

4. Benchmark on Oxford Buildings dataset for image retrieval

Take Oxford Buildings dataset as an example. First, download the evaluation data and (parsed) groundtruth files:

mkdir Oxford5k && \
cd Oxford5k && \
mkdir images && \
wget && \
tar -xvf oxbuild_images.tgz -C images && \
wget && \
tar -xvf ... 

This script also allows for evaluating Paris dataset. The (parsed) groundtruth files can be found here. Be noted to delete the corrupted images of the dataset, and put the remaining images under the same folder.

Next, configure

, and extract the features by:
cd /local/aslfeat && python --config configs/oxford_eval.yaml

We use Bag-of-Words (BoW) method for image retrieval. To do so, clone and compile libvot:

cd Oxford5k && \
git clone && \
mkdir build && \
cd build && \

and the mAP can be obtained by:

cd Oxford5k && \
python --method_name aslfeat_ms

Please cite libvot if you find it useful.

5. Benchmark on ETH dataset

Follow the instruction to download the data, configure

and call:
cda /local/aslfeat && python --config configs/eth_eval.yaml

To extract the features.

6. Benchmark on IMW2020

Download the data (validation/test) Link, then configure

, finally call:
cd /local/aslfeat && python --config configs/imw2020_eval.yaml


  1. Training data is provided in GL3D.

  2. You might be also interested in a 3D local feature (D3Feat).


  1. The backbone networks and the learning scheme are heavily borrowed from D2-Net.

  2. We thank for the authors of R2D2 for sharing their evaluation results on HPatches that helped us plot Fig.1. The updated results of R2D2 are even more excited.

  3. We refer to the public implementation of SuperPoint for organizing the code and implementing the evaluation metrics.

  4. We implement the modulated DCN referring to this. The current implementation is not efficient, and we expect a native implementation in TensorFlow to be available in the future. (update: this contribution would be extremely useful once it is integrated!)

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.