Implementation of ICCV19 Paper "Learning Two-View Correspondences and Geometry Using Order-Aware Network"

Overview

OANet implementation

Pytorch implementation of OANet for ICCV'19 paper "Learning Two-View Correspondences and Geometry Using Order-Aware Network", by Jiahui Zhang, Dawei Sun, Zixin Luo, Anbang Yao, Lei Zhou, Tianwei Shen, Yurong Chen, Long Quan and Hongen Liao.

This paper focuses on establishing correspondences between two images. We introduce the DiffPool and DiffUnpool layers to capture the local context of unordered sparse correspondences in a learnable manner. By the collaborative use of DiffPool operator, we propose Order-Aware Filtering block which exploits the complex global context.

This repo contains the code and data for essential matrix estimation described in our ICCV paper. Besides, we also provide code for fundamental matrix estimation and the usage of side information (ratio test and mutual nearest neighbor check). Documents about this part will also be released soon.

Welcome bugs and issues!

If you find this project useful, please cite:

@article{zhang2019oanet,
  title={Learning Two-View Correspondences and Geometry Using Order-Aware Network},
  author={Zhang, Jiahui and Sun, Dawei and Luo, Zixin and Yao, Anbang and Zhou, Lei and Shen, Tianwei and Chen, Yurong and Quan, Long and Liao, Hongen},
  journal={International Conference on Computer Vision (ICCV)},
  year={2019}
}

Requirements

Please use Python 3.6, opencv-contrib-python (3.4.0.12) and Pytorch (>= 1.1.0). Other dependencies should be easily installed through pip or conda.

Example scripts

Run the demo

For a quick start, clone the repo and download the pretrained model.

git clone https://github.com/zjhthu/OANet.git 
cd OANet 
wget https://research.altizure.com/data/oanet_data/model_v2.tar.gz 
tar -xvf model_v2.tar.gz
cd model
wget https://research.altizure.com/data/oanet_data/sift-gl3d.tar.gz
tar -xvf sift-gl3d.tar.gz

Then run the fundamental matrix estimation demo.

cd ./demo && python demo.py

Generate training and testing data

First download YFCC100M dataset.

bash download_data.sh raw_data raw_data_yfcc.tar.gz 0 8
tar -xvf raw_data_yfcc.tar.gz

Download SUN3D testing (1.1G) and training (31G) dataset if you need.

bash download_data.sh raw_sun3d_test raw_sun3d_test.tar.gz 0 2
tar -xvf raw_sun3d_test.tar.gz
bash download_data.sh raw_sun3d_train raw_sun3d_train.tar.gz 0 63
tar -xvf raw_sun3d_train.tar.gz

Then generate matches for YFCC100M and SUN3D (only testing). Here we provide scripts for SIFT, this will take a while.

cd dump_match
python extract_feature.py
python yfcc.py
python extract_feature.py --input_path=../raw_data/sun3d_test
python sun3d.py

Generate SUN3D training data if you need by following the same procedure and uncommenting corresponding lines in sun3d.py.

Test pretrained model

We provide the model trained on YFCC100M and SUN3D described in our ICCV paper. Run the test script to get results in our paper.

cd ./core 
python main.py --run_mode=test --model_path=../model/yfcc/essential/sift-2000 --res_path=../model/yfcc/essential/sift-2000/ --use_ransac=False
python main.py --run_mode=test --data_te=../data_dump/sun3d-sift-2000-test.hdf5 --model_path=../model/sun3d/essential/sift-2000 --res_path=../model/sun3d/essential/sift-2000/ --use_ransac=False

Set --use_ransac=True to get results after RANSAC post-processing.

Train model on YFCC100M

After generating dataset for YFCC100M, run the tranining script.

cd ./core 
python main.py

You can train the fundamental estimation model by setting --use_fundamental=True --geo_loss_margin=0.03 and use side information by setting --use_ratio=2 --use_mutual=2

Train with your own local feature or data

The provided models are trained using SIFT. You had better retrain the model if you want to use OANet with your own local feature, such as ContextDesc, SuperPoint and etc.

You can follow the provided example scirpts in ./dump_match to generate dataset for your own local feature or data.

Tips for training OANet: if your dataset is small and overfitting is observed, you can consider replacing the OAFilter with OAFilterBottleneck.

Here we also provide a pretrained essential matrix estimation model using ContextDesc on YFCC100M.

cd model/
wget https://research.altizure.com/data/oanet_data/contextdesc-yfcc.tar.gz
tar -xvf contextdesc-yfcc.tar.gz

To test this model, you need to generate your own data using ContextDesc and then run python main.py --run_mode=test --data_te=YOUR/OWN/CONTEXTDESC/DATA --model_path=../model/yfcc/essential/contextdesc-2000 --res_path=XX --use_ratio=2.

Application on 3D reconstructions

sample

News

  1. Together with the local feature ContextDesc, we won both the stereo and muti-view tracks at the CVPR19 Image Matching Challenge (June. 2, 2019).

  2. We also rank the third place on the Visual Localization Benchmark using ContextDesc (Aug. 30, 2019).

Acknowledgement

This code is heavily borrowed from Learned-Correspondence. If you use the part of code related to data generation, testing and evaluation, you should cite this paper and follow its license.

@inproceedings{yi2018learning,
  title={Learning to Find Good Correspondences},
  author={Kwang Moo Yi* and Eduard Trulls* and Yuki Ono and Vincent Lepetit and Mathieu Salzmann and Pascal Fua},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  year={2018}
}

Changelog

2019.09.29

  • Release code for data generation.

2019.10.04

  • Release model and data for SUN3D.

2019.12.09

  • Release a general purpose model trained on GL3D-v2, which has been tested on FM-Benchmark. This model achieves 66.1/92.3/84.0/47.0 on TUM/KITTI/T&T/CPC respectively using SIFT.
  • Release model trained using ContextDesc.
Comments
  • if I want to train my own dataset

    if I want to train my own dataset

    thanks ahead. I have read your preprocessing code on the yfcc dataset, but I do not understand the process of it. Now If I want to do the feature matching on my own dataset, what steps should I do?

    opened by passion3394 25
  • The segmentation fault(core dump) error after hundreds of training iterations

    The segmentation fault(core dump) error after hundreds of training iterations

    Hi, Thanks for the amazing work. I'm trying to train your OANet and my own method on YFCC100M dataset. But there is a segmentation fault(core dump) error after hundreds of or thousands of training iterations. Have you ever got the similar error?

    opened by sailor-z 11
  • how to load contextdesc model?

    how to load contextdesc model?

    when i use contextdesc-yfcc model in the demo script
    self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for OANet: size mismatch for weights_init.conv1.weight: copying a param with shape torch.Size([128, 5, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 4, 1, 1]). size mismatch for weights_iter.0.conv1.weight: copying a param with shape torch.Size([128, 7, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 6, 1, 1]).

    how to use the contextdesc model ? thanks

    opened by tomjerrygithub 7
  • YFCC100M depth Data

    YFCC100M depth Data

    hi, thanks for your great job. Recently, i want to use the dataset of YFCC100M, but i don't find the depth data. while depth.txt exists. Can you tell me how to get the all data

    best.

    opened by zwyking 6
  • Lincense and Citations

    Lincense and Citations

    Hi Zixin,

    I just noticed that there is a bit of an issue with the license notification and citation acknowledgement for the CVPR 2018 paper. Could you please add them? EPFL and UVic have copyrights to the code and they are only released for research purposes. Thus, you are actually violating it by releasing your code as MIT. Can you please make that part explicit?

    Thanks! Kwang

    opened by kmyi 4
  • SIFT keypoints number and descriptors in fundamental model

    SIFT keypoints number and descriptors in fundamental model

    I tried to re-train the fundamental model using 8000 sift keypoints. However, using the default setting of in extract_feature.py , only 4000-6000 keypoints can be extracted. And the trained model performed bad compared with provided fundamental estimation model. Is there any suggestion on the setting of get more points. Thanks~

    opened by BruceWangzp 4
  • A question about the computation of loss

    A question about the computation of loss

    Hi Jiahui, I'm trying to reproduce the results on YFCC. I have a question about the computation of loss. I find that the essential loss is used after 20k steps and only those essential loss less than 0.1 is used in the backward. (https://github.com/zjhthu/OANet/blob/master/core/loss.py#L49 and https://github.com/zjhthu/OANet/blob/master/core/loss.py#L84) I am wondering what is the motivation behind this implementation and what will happen if we use all essential losses all the time. Thank you for the excellent work.

    opened by liuyuan-pal 3
  • How to calculate mAP via the results?

    How to calculate mAP via the results?

    Excuse me, I have run the code and get result saved as shown in the image. AAD5167F-4203-4037-8053-AEEFDE7B6424 I was wondering how to calculate mAP in the paper via these AUC results.

    Thank you,

    opened by olivercho98 2
  • The accuracy on YFCC with GL3D model

    The accuracy on YFCC with GL3D model

    Hi, I have a question about the GL3D model. When I test it on the YFCC test set, the results are very bad: test result [0.09993750000000001, 0.029445680575755823, 0.5177923955358564, 0.9643927037450776, 0.446788042617176, 0.6026962917102501, 0.46986473430161074]

    Is it something wrong with the test setting? And what hyperparameters do you use for training the GL3D model? I cannot see any codes in the repo.

    Thank you very much.

    opened by guohengkai 2
  • Where is the implementation of the Spatial Correlation Layer?

    Where is the implementation of the Spatial Correlation Layer?

    Excuse me, I wonder where is the implementation of the Spatial Correlation Layer.

    In your paper, you added the Spatial Correlation Layer into the original PointnetCN structure to:

    explicitly model relation between different nodes and capture the complex global context

    The graph in your paper displayed as two transpose charts but I can not find it in the code. Could you please tell me where is the implementation? Thanks.

    opened by ZeroSteven618 2
  • A question about the evaluation metric

    A question about the evaluation metric

    Hi, I have a minor question about the evaluation metrics. In the paper, the standard metric is mAP under 5 degree. But I find that the computation of mAP uses an interval of 5 degree (https://github.com/zjhthu/OANet/blob/51d71ff3f57161e912ec72420cd91cf7db64ab74/core/test.py#L47), so that the actual metric is the precision of pose under 5 degree. I don't know whether I have missed any part of this code.

    Thank you!

    opened by liuyuan-pal 2
  • Application on 3D reconstructions

    Application on 3D reconstructions

    Hello @zjhthu ,

    I really appreciate your great work, but I wanted to know how the 3D construction results are attained (using the output of OANet)

    Thanks in advance!

    opened by alien19 0
  • Question about “best_model”

    Question about “best_model”

    Hi, thanks for sharing the code.

    I found that on the dataset yfcc, the best model for the estimation of the fundamental matrix is in sift-side-8k directory. Does this mean that both use_ratio and use_mutual are used?

    Look forward to your reply.

    Regards

    opened by CARRLIANSS 0
  • About side

    About side

    Thank you for a great project. As I dig deeper into your code, I see that the run function of the NNMatcher(Learnedmatcher.py) function returns corr, sides, corr_Idx. Corr and corr_Idx are the corresponding match point and the index of descriptor respectively, but what does sides mean? Distribution of inside and outside points? Hope you can help answer, thank you

    opened by szgy66 1
  • SUN3D test data

    SUN3D test data

    Hello, i can't find the test data scene in raw SUN3D data, due to i need find their depth data. Could you tell me how did you generate these test data.

    opened by zwyking 0
  • yfcc-sift-2000.train.hdf5 is too large

    yfcc-sift-2000.train.hdf5 is too large

    the first time i extract feature and run yfcc.py,the file just is 5.1G,but the second time i extract feature and run yfcc.py,the file is 32.7G,so which is right?

    opened by ameliamlz 0
Owner
Jiahui Zhang
Tsinghua University
Jiahui Zhang
Inference code for "StylePeople: A Generative Model of Fullbody Human Avatars" paper. This code is for the part of the paper describing video-based avatars.

NeuralTextures This is repository with inference code for paper "StylePeople: A Generative Model of Fullbody Human Avatars" (CVPR21). This code is for

Visual Understanding Lab @ Samsung AI Center Moscow 18 Oct 6, 2022
Code for paper ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization in the Loop.

Who Left the Dogs Out? Evaluation and demo code for our ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization

Benjamin Biggs 29 Dec 28, 2022
The project is an official implementation of our CVPR2019 paper "Deep High-Resolution Representation Learning for Human Pose Estimation"

Deep High-Resolution Representation Learning for Human Pose Estimation (CVPR 2019) News [2020/07/05] A very nice blog from Towards Data Science introd

Leo Xiao 3.9k Jan 5, 2023
Home repository for the Regularized Greedy Forest (RGF) library. It includes original implementation from the paper and multithreaded one written in C++, along with various language-specific wrappers.

Regularized Greedy Forest Regularized Greedy Forest (RGF) is a tree ensemble machine learning method described in this paper. RGF can deliver better r

RGF-team 364 Dec 28, 2022
Official implementation of AAAI-21 paper "Label Confusion Learning to Enhance Text Classification Models"

Description: This is the official implementation of our AAAI-21 accepted paper Label Confusion Learning to Enhance Text Classification Models. The str

null 101 Nov 25, 2022
Official PyTorch implementation for paper Context Matters: Graph-based Self-supervised Representation Learning for Medical Images

Context Matters: Graph-based Self-supervised Representation Learning for Medical Images Official PyTorch implementation for paper Context Matters: Gra

null 49 Nov 23, 2022
A PyTorch re-implementation of the paper 'Exploring Simple Siamese Representation Learning'. Reproduced the 67.8% Top1 Acc on ImageNet.

Exploring simple siamese representation learning This is a PyTorch re-implementation of the SimSiam paper on ImageNet dataset. The results match that

Taojiannan Yang 72 Nov 9, 2022
Implementation of the paper NAST: Non-Autoregressive Spatial-Temporal Transformer for Time Series Forecasting.

Non-AR Spatial-Temporal Transformer Introduction Implementation of the paper NAST: Non-Autoregressive Spatial-Temporal Transformer for Time Series For

Chen Kai 66 Nov 28, 2022
This is a Pytorch implementation of the paper: Self-Supervised Graph Transformer on Large-Scale Molecular Data.

This is a Pytorch implementation of the paper: Self-Supervised Graph Transformer on Large-Scale Molecular Data.

null 212 Dec 25, 2022
Official implementation of the ICLR 2021 paper

You Only Need Adversarial Supervision for Semantic Image Synthesis Official PyTorch implementation of the ICLR 2021 paper "You Only Need Adversarial S

Bosch Research 272 Dec 28, 2022
Implementation of Nyström Self-attention, from the paper Nyströmformer

Nyström Attention Implementation of Nyström Self-attention, from the paper Nyströmformer. Yannic Kilcher video Install $ pip install nystrom-attention

Phil Wang 95 Jan 2, 2023
Implementation of SETR model, Original paper: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.

SETR - Pytorch Since the original paper (Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.) has no official

zhaohu xing 112 Dec 16, 2022
Official implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis https://arxiv.org/abs/2011.13775

CIPS -- Official Pytorch Implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis Requirements pip install -r requi

Multimodal Lab @ Samsung AI Center Moscow 201 Dec 21, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
PyTorch implementation of paper "Neural Scene Flow Fields for Space-Time View Synthesis of Dynamic Scenes", CVPR 2021

Neural Scene Flow Fields PyTorch implementation of paper "Neural Scene Flow Fields for Space-Time View Synthesis of Dynamic Scenes", CVPR 20

Zhengqi Li 585 Jan 4, 2023
Implementation of Barlow Twins paper

barlowtwins PyTorch Implementation of Barlow Twins paper: Barlow Twins: Self-Supervised Learning via Redundancy Reduction This is currently a work in

IgorSusmelj 86 Dec 20, 2022
Official pytorch implementation of paper "Inception Convolution with Efficient Dilation Search" (CVPR 2021 Oral).

IC-Conv This repository is an official implementation of the paper Inception Convolution with Efficient Dilation Search. Getting Started Download Imag

Jie Liu 111 Dec 31, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
Functional TensorFlow Implementation of Singular Value Decomposition for paper Fast Graph Learning

tf-fsvd TensorFlow Implementation of Functional Singular Value Decomposition for paper Fast Graph Learning with Unique Optimal Solutions Cite If you f

Sami Abu-El-Haija 14 Nov 25, 2021