Implementation of "Learning to Match Features with Seeded Graph Matching Network" ICCV2021

Related tags

Deep LearningSGMNet
Overview

SGMNet Implementation

Framework

PyTorch implementation of SGMNet for ICCV'21 paper "Learning to Match Features with Seeded Graph Matching Network", by Hongkai Chen, Zixin Luo, Jiahui Zhang, Lei Zhou, Xuyang Bai, Zeyu Hu, Chiew-Lan Tai, Long Quan.

This work focuses on keypoint-based image matching problem. We mitigate the qudratic complexity issue for typical GNN-based matching by leveraging a restrited set of pre-matched seeds.

This repo contains training, evaluation and basic demo sripts used in our paper. As baseline, it also includes our implementation for SuperGlue. If you find this project useful, please cite:

@article{chen2021sgmnet,
  title={Learning to Match Features with Seeded Graph Matching Network},
  author={Chen, Hongkai and Luo, Zixin and Zhang, Jiahui and Zhou, Lei and Bai, Xuyang and Hu, Zeyu and Tai, Chiew-Lan and Quan, Long},
  journal={International Conference on Computer Vision (ICCV)},
  year={2021}
}

Part of the code is borrowed or ported from

SuperPoint, for SuperPoint implementation,

SuperGlue, for SuperGlue implementation and exact auc computation,

OANet, for training scheme,

PointCN, for implementaion of PointCN block and geometric transformations,

FM-Bench, for evaluation of fundamental matrix estimation.

Please also cite these works if you find the corresponding code useful.

Requirements

We use PyTorch 1.6, later version should also be compatible. Please refer to requirements.txt for other dependencies.

If you are using conda, you may configure the environment as:

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

Get started

Clone the repo:

git clone https://github.com/vdvchen/SGMNet.git && \

download model weights from here

extract weights by

tar -xvf weights.tar.gz

A quick demo for image matching can be called by:

cd demo && python demo.py --config_path configs/sgm_config.yaml

The resutls will be saved as match.png in demo folder. You may configure the matcher in corresponding yaml file.

Evaluation

We demonstrate evaluation process with RootSIFT and SGMNet. Evaluation with other features/matchers can be conducted by configuring the corresponding yaml files.

1. YFCC Evaluation

Refer to OANet repo to download raw YFCC100M dataset

Data Generation

  1. Configure datadump/configs/yfcc_root.yaml for the following entries

    rawdata_dir: path for yfcc rawdata
    feature_dump_dir: dump path for extracted features
    dataset_dump_dir: dump path for generated dataset
    extractor: configuration for keypoint extractor (2k RootSIFT by default)

  2. Generate data by

    cd datadump
    python dump.py --config_path configs/yfcc_root.yaml

    An h5py data file will be generated under dataset_dump_dir, e.g. yfcc_root_2000.hdf5

Evaluation:

  1. Configure evaluation/configs/eval/yfcc_eval_sgm.yaml for the following entries

    reader.rawdata_dir: path for yfcc_rawdata
    reader.dataset_dir: path for generated h5py dataset file
    matcher: configuration for sgmnet (we use the default setting)

  2. To run evaluation,

    cd evaluation
    python evaluate.py --config_path configs/eval/yfcc_eval_sgm.yaml

For 2k RootSIFT matching, similar results as below should be obtained,

auc th: [5 10 15 20 25 30]
approx auc: [0.634 0.729 0.783 0.818 0.843 0.861]
exact auc: [0.355 0.552 0.655 0.719 0.762 0.793]
mean match score: 17.06
mean precision: 86.08

2. ScanNet Evaluation

Download processed ScanNet evaluation data.

Data Generation

  1. Configure datadump/configs/scannet_root.yaml for the following entries

    rawdata_dir: path for ScanNet raw data
    feature_dump_dir: dump path for extracted features
    dataset_dump_dir: dump path for generated dataset
    extractor: configuration for keypoint extractor (2k RootSIFT by default)

  2. Generate data by

    cd datadump
    python dump.py --config_path configs/scannet_root.yaml

    An h5py data file will be generated under dataset_dump_dir, e.g. scannet_root_2000.hdf5

Evaluation:

  1. Configure evaluation/configs/eval/scannet_eval_sgm.yaml for the following entries

    reader.rawdata_dir: path for ScanNet evaluation data
    reader.dataset_dir: path for generated h5py dataset file
    matcher: configuration for sgmnet (we use the default setting)

  2. To run evaluation,

    cd evaluation
    python evaluate.py --config_path configs/eval/scannet_eval_sgm.yaml

For 2k RootSIFT matching, similar results as below should be obtained,

auc th: [5 10 15 20 25 30]
approx auc: [0.322 0.427 0.493 0.541 0.577 0.606]
exact auc: [0.125 0.283 0.383 0.452 0.503 0.541]
mean match score: 8.79
mean precision: 45.54

3. FM-Bench Evaluation

Refer to FM-Bench repo to download raw FM-Bench dataset

Data Generation

  1. Configure datadump/configs/fmbench_root.yaml for the following entries

    rawdata_dir: path for fmbench raw data
    feature_dump_dir: dump path for extracted features
    dataset_dump_dir: dump path for generated dataset
    extractor: configuration for keypoint extractor (4k RootSIFT by default)

  2. Generate data by

    cd datadump
    python dump.py --config_path configs/fmbench_root.yaml

    An h5py data file will be generated under dataset_dump_dir, e.g. fmbench_root_4000.hdf5

Evaluation:

  1. Configure evaluation/configs/eval/fm_eval_sgm.yaml for the following entries

    reader.rawdata_dir: path for fmbench raw data
    reader.dataset_dir: path for generated h5py dataset file
    matcher: configuration for sgmnet (we use the default setting)

  2. To run evaluation,

    cd evaluation
    python evaluate.py --config_path configs/eval/fm_eval_sgm.yaml

For 4k RootSIFT matching, similar results as below should be obtained,

CPC results:
F_recall:  0.617
precision:  0.7489
precision_post:  0.8399
num_corr:  663.838
num_corr_post:  284.455  

KITTI results:
F_recall:  0.911
precision:  0.9035133886251774
precision_post:  0.9837278538989989
num_corr:  1670.548
num_corr_post:  1121.902

TUM results:
F_recall:  0.666
precision:  0.6520260208250837
precision_post:  0.731507123852191
num_corr:  1650.579
num_corr_post:  941.846

Tanks_and_Temples results:
F_recall:  0.855
precision:  0.7452896681043316
precision_post:  0.8020184635328004
num_corr:  946.571
num_corr_post:  466.865

4. Run time and memory Evaluation

We provide a script to test run time and memory consumption, for a quick start, run

cd evaluation
python eval_cost.py --matcher_name SGM  --config_path configs/cost/sgm_cost.yaml --num_kpt=4000

You may configure the matcher in corresponding yaml files.

Visualization

For visualization of matching results on different dataset, add --vis_folder argument on evaluation command, e.g.

cd evaluation
python evaluate.py --config_path configs/eval/***.yaml --vis_folder visualization

Training

We train both SGMNet and SuperGlue on GL3D dataset. The training data is pre-generated in an offline manner, which yields about 400k pairs in total.

To generate training/validation dataset

  1. Download GL3D rawdata

  2. Configure datadump/configs/gl3d.yaml. Some important entries are

    rawdata_dir: path for GL3D raw data
    feature_dump_dir: path for extracted features
    dataset_dump_dir: path for generated dataset
    pairs_per_seq: number of pairs sampled for each sequence
    angle_th: angle threshold for sampled pairs
    overlap_th: common track threshold for sampled pairs
    extractor: configuration for keypoint extractor

  3. dump dataset by

cd datadump
python dump.py --config_path configs/gl3d.yaml

Two parts of data will be generated. (1) Extracted features and keypoints will be placed under feature_dump_dir (2) Pairwise dataset will be placed under dataset_dump_dir.

  1. After data generation, configure train/train_sgm.sh for necessary entries, including
    rawdata_path: path for GL3D raw data
    desc_path: path for extracted features
    dataset_path: path for generated dataset
    desc_suffix: suffix for keypoint files, _root_1000.hdf5 for 1k RootSIFT by default.
    log_base: log directory for training

  2. run SGMNet training scripts by

bash train_sgm.sh

our training scripts support multi-gpu training, which can be enabled by configure train/train_sgm.sh for these entries

CUDA_VISIBLE_DEVICES: id of gpus to be used
nproc_per_node: number of gpus to be used

run SuperGlue training scripts by

bash train_sg.sh
Bilinear attention networks for visual question answering

Bilinear Attention Networks This repository is the implementation of Bilinear Attention Networks for the visual question answering and Flickr30k Entit

Jin-Hwa Kim 506 Nov 29, 2022
This implements one of result networks from Large-scale evolution of image classifiers

Exotic structured image classifier This implements one of result networks from Large-scale evolution of image classifiers by Esteban Real, et. al. Req

54 Nov 25, 2022
TorchX: A PyTorch Extension Library for More Efficient Deep Learning

TorchX TorchX: A PyTorch Extension Library for More Efficient Deep Learning. @misc{torchx, author = {Ansheng You and Changxu Wang}, title = {T

Donny You 8 May 28, 2022
[3DV 2021] Channel-Wise Attention-Based Network for Self-Supervised Monocular Depth Estimation

Channel-Wise Attention-Based Network for Self-Supervised Monocular Depth Estimation This is the official implementation for the method described in Ch

Jiaxing Yan 27 Dec 30, 2022
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk

Annoy Annoy (Approximate Nearest Neighbors Oh Yeah) is a C++ library with Python bindings to search for points in space that are close to a given quer

Spotify 10.6k Jan 04, 2023
Pytorch implementation of our paper under review — Lottery Jackpots Exist in Pre-trained Models

Lottery Jackpots Exist in Pre-trained Models (Paper Link) Requirements Python = 3.7.4 Pytorch = 1.6.1 Torchvision = 0.4.1 Reproduce the Experiment

Yuxin Zhang 27 Jun 28, 2022
Code for "Human Pose Regression with Residual Log-likelihood Estimation", ICCV 2021 Oral

Human Pose Regression with Residual Log-likelihood Estimation [Paper] [arXiv] [Project Page] Human Pose Regression with Residual Log-likelihood Estima

JeffLi 347 Dec 24, 2022
Fuzzing the Kernel Using Unicornafl and AFL++

Unicorefuzz Fuzzing the Kernel using UnicornAFL and AFL++. For details, skim through the WOOT paper or watch this talk at CCCamp19. Is it any good? ye

Security in Telecommunications 283 Dec 26, 2022
Convnet transfer - Code for paper How transferable are features in deep neural networks?

How transferable are features in deep neural networks? This repository contains source code necessary to reproduce the results presented in the follow

Jason Yosinski 143 Sep 13, 2022
Semi-Autoregressive Transformer for Image Captioning

Semi-Autoregressive Transformer for Image Captioning Requirements Python 3.6 Pytorch 1.6 Prepare data Please use git clone --recurse-submodules to clo

YE Zhou 23 Dec 09, 2022
Efficient Conformer: Progressive Downsampling and Grouped Attention for Automatic Speech Recognition

Efficient Conformer: Progressive Downsampling and Grouped Attention for Automatic Speech Recognition Official implementation of the Efficient Conforme

Maxime Burchi 145 Dec 30, 2022
public repo for ESTER dataset and modeling (EMNLP'21)

Project / Paper Introduction This is the project repo for our EMNLP'21 paper: https://arxiv.org/abs/2104.08350 Here, we provide brief descriptions of

PlusLab 19 Oct 27, 2022
a delightful machine learning tool that allows you to train, test and use models without writing code

igel A delightful machine learning tool that allows you to train/fit, test and use models without writing code Note I'm also working on a GUI desktop

Nidhal Baccouri 3k Jan 05, 2023
Collection of tasks for fast prototyping, baselining, finetuning and solving problems with deep learning.

Collection of tasks for fast prototyping, baselining, finetuning and solving problems with deep learning Installation

Pytorch Lightning 1.6k Jan 08, 2023
This repository is a basic Machine Learning train & validation Template (Using PyTorch)

pytorch_ml_template This repository is a basic Machine Learning train & validation Template (Using PyTorch) TODO Markdown 사용법 Build Docker 사용법 Anacond

1 Sep 15, 2022
basic tutorial on pytorch

Quick Tutorial on PyTorch PyTorch Basics Linear Regression Logistic Regression Artificial Neural Networks Convolutional Neural Networks Recurrent Neur

7 Sep 15, 2022
Spatio-Temporal Entropy Model (STEM) for end-to-end leaned video compression.

Spatio-Temporal Entropy Model A Pytorch Reproduction of Spatio-Temporal Entropy Model (STEM) for end-to-end leaned video compression. More details can

16 Nov 28, 2022
PyTorch image models, scripts, pretrained weights -- ResNet, ResNeXT, EfficientNet, EfficientNetV2, NFNet, Vision Transformer, MixNet, MobileNet-V3/V2, RegNet, DPN, CSPNet, and more

PyTorch Image Models Sponsors What's New Introduction Models Features Results Getting Started (Documentation) Train, Validation, Inference Scripts Awe

Ross Wightman 22.9k Jan 09, 2023
Bot developed in Python that automates races in pegaxy.

español | português About it: This is a fork from pega-racing-bot. This bot, developed in Python, is to automate races in pegaxy. The game developers

4 Apr 08, 2022
Addon and nodes for working with structural biology and molecular data in Blender.

Molecular Nodes 🧬 🔬 💻 Buy Me a Coffee to Keep Development Going! Join a Community of Blender SciVis People! What is Molecular Nodes? Molecular Node

Brady Johnston 456 Jan 08, 2023