Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

DenseMatching

> 编程语言
Open source

Dense matching library based on PyTorch

755 stars0 likes1 views
WebsiteGitHub

About

Dense matching library based on PyTorch

Dense Matching

A general dense matching library based on PyTorch.

For any questions, issues or recommendations, please contact Prune at [email protected]

If you're interested in training a probabilistic correspondence network unsupervised (mix of PDCNet and WarpC), check out our recent work Refign, with code. It is also integrated in this code base as UAWarpC.

Updates

06/03/2022: We found that significantly better performance and reduced training time are obtained when initializing with bilinear interpolation weights the weights of the transposed convolutions used to upsample the predicted flow fields between the different pyramid levels. We have integrated this initialization as the default. We might provide updated pre-trained weights as well. Alternatively, one can directly simply use bilinear interpolation for upsampling with similar (maybe a bit better) performance, which is also now an option proposed.

Highlights

Libraries for implementing, training and evaluating dense matching networks. It includes

  • Common dense matching validation datasets for geometric matching (MegaDepth, RobotCar, ETH3D, HPatches), optical flow (KITTI, Sintel) and semantic matching (TSS, PF-Pascal, PF-Willow, Spair).

  • Scripts to analyse network performance and obtain standard performance scores for matching and pose estimation.

  • General building blocks, including deep networks, optimization, feature extraction and utilities.

  • General training framework for training dense matching networks with

    • Common training datasets for matching networks.
    • Functions to generate random image pairs and their corresponding ground-truth flow, as well as to add moving objects and modify the flow accordingly.
    • Functions for data sampling, processing etc.
    • And much more...
  • Official implementation of GLU-Net (CVPR 2020), GLU-Net-GOCor (NeurIPS 2020), PWC-Net-GOCor (NeurIPS 2020), PDC-Net (CVPR 2021), WarpC models (ICCV 2021), PWarpC models (CVPR 2022) including trained models and respective results.

Dense Matching Networks

The repo contains the implementation of the following matching models. We provide pre-trained model weights, data preparation, evaluation commands, and results for each dataset and method. If you find this library useful, please consider citing the relevant following research papers.

[6] PWarpC: Probabilistic Warp Consistency for Weakly-Supervised Semantic Correspondences. (CVPR 2022)

Authors: Prune Truong, Martin Danelljan, Fisher Yu, Luc Van Gool

[Paper] [Website] [Poster] [Video] [Citation]

We propose Probabilistic Warp Consistency, a weakly-supervised learning objective for semantic matching. Our approach directly supervises the dense matching scores predicted by the network, encoded as a conditional probability distribution. We first construct an image triplet by applying a known warp to one of the images in a pair depicting different instances of the same object class. Our probabilistic learning objectives are then derived using the constraints arising from the resulting image triplet. We further account for occlusion and background clutter present in real image pairs by extending our probabilistic output space with a learnable unmatched state. To supervise it, we design an objective between image pairs depicting different object classes. We validate our method by applying it to four recent semantic matching architectures. Our weakly-supervised approach sets a new state-of-the-art on four challenging semantic matching benchmarks. Lastly, we demonstrate that our objective also brings substantial improvements in the strongly-supervised regime, when combined with keypoint annotations.

[5] PDC-Net+: Enhanced Probabilistic Dense Correspondence Network. (TPAMI 2023)

Authors: Prune Truong, Martin Danelljan, Radu Timofte, Luc Van Gool

[Paper] [Website] [Citation]

[4] WarpC: Warp Consistency for Unsupervised Learning of Dense Correspondences. (ICCV 2021 - ORAL)

Authors: Prune Truong, Martin Danelljan, Fisher Yu, Luc Van Gool

[Paper] [Website] [Poster] [Slides] [Video] [Citation]

Warp Consistency Graph Results

The key challenge in learning dense correspondences lies in the lack of ground-truth matches for real image pairs. While photometric consistency losses provide unsupervised alternatives, they struggle with large appearance changes, which are ubiquitous in geometric and semantic matching tasks. Moreover, methods relying on synthetic training pairs often suffer from poor generalisation to real data. We propose Warp Consistency, an unsupervised learning objective for dense correspondence regression. Our objective is effective even in settings with large appearance and view-point changes. Given a pair of real images, we first construct an image triplet by applying a randomly sampled warp to one of the original images. We derive and analyze all flow-consistency constraints arising between the triplet. From our observations and empirical results, we design a general unsupervised objective employing two of the derived constraints. We validate our warp consistency loss by training three recent dense correspondence networks for the geometric and semantic matching tasks. Our approach sets a new state-of-the-art on several challenging benchmarks, including MegaDepth, RobotCar and TSS.

[3] PDC-Net: Learning Accurate Correspondences and When to Trust Them. (CVPR 2021 - ORAL)

Authors: Prune Truong, Martin Danelljan, Luc Van Gool, Radu Timofte

[Paper] [Website] [Poster] [Slides] [Video] [Citation]

Dense flow estimation is often inaccurate in the case of large displacements or homogeneous regions. For most applications and down-stream tasks, such as pose estimation, image manipulation, or 3D reconstruction, it is crucial to know when and where to trust the estimated matches. In this work, we aim to estimate a dense flow field relating two images, coupled with a robust pixel-wise confidence map indicating the reliability and accuracy of the prediction. We develop a flexible probabilistic approach that jointly learns the flow prediction and its uncertainty. In particular, we parametrize the predictive distribution as a constrained mixture model, ensuring better modelling of both accurate flow predictions and outliers. Moreover, we develop an architecture and training strategy tailored for robust and generalizable uncertainty prediction in the context of self-supervised training.

[2] GOCor: Bringing Globally Optimized Correspondence Volumes into Your Neural Network. (NeurIPS 2020)

Authors: Prune Truong *, Martin Danelljan *, Luc Van Gool, Radu Timofte

[Paper] [Website] [Video] [Citation]

The feature correlation layer serves as a key neural network module in numerous computer vision problems that involve dense correspondences between image pairs. It predicts a correspondence volume by evaluating dense scalar products between feature vectors extracted from pairs of locations in two images. However, this point-to-point feature comparison is insufficient when disambiguating multiple similar regions in an image, severely affecting the performance of the end task. This work proposes GOCor, a fully differentiable dense matching module, acting as a direct replacement to the feature correlation layer. The correspondence volume generated by our module is the result of an internal optimization procedure that explicitly accounts for similar regions in the scene. Moreover, our approach is capable of effectively learning spatial matching priors to resolve further matching ambiguities.

[1] GLU-Net: Global-Local Universal Network for dense flow and correspondences (CVPR 2020 - ORAL).

Authors: Prune Truong, Martin Danelljan and Radu Timofte

[Paper] [Website] [Poster] [Oral Video] [Teaser Video] [Citation]

Pre-trained weights

The pre-trained models can be found in the model zoo

Table of Content

  1. Installation
  2. Test on your own image pairs!
    1. Test on image pairs
    2. Various demos
  3. Overview
  4. Benchmarks and results
    1. Correspondence evaluation
      1. MegaDepth
      2. RobotCar
      3. ETH3D
      4. HPatches
      5. KITTI
      6. Sintel
      7. TSS
      8. PF-Pascal
      9. PF-Willow
      10. Spair-71k
      11. Caltech-101
    2. Pose estimation
      1. YFCC100M
      2. ScanNet
    3. Sparse evaluation on HPatches
  5. Training
  6. Acknowledgement
  7. Changelog

1. Installation

Inference runs for torch version >= 1.0

  • Create and activate conda environment with Python 3.x
bash
conda create -n dense_matching_env python=3.7
conda activate dense_matching_env
  • Install all dependencies (except for cupy, see below) by running the following command:
bash
pip install numpy opencv-python torch torchvision matplotlib imageio jpeg4py scipy pandas tqdm gdown pycocotools timm

Note: CUDA is required to run the code. Indeed, the correlation layer is implemented in CUDA using CuPy, which is why CuPy is a required dependency. It can be installed using pip install cupy or alternatively using one of the provided bin

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言