All Projects → limacv → CorrelationLayer

limacv / CorrelationLayer

Licence: other
Pure Pytorch implementation of Correlation Layer that commonly used in learning based optical flow estimator

Programming Languages

Cuda
1817 projects
python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to CorrelationLayer

flow1d
[ICCV 2021 Oral] High-Resolution Optical Flow from 1D Attention and Correlation
Stars: ✭ 91 (+313.64%)
Mutual labels:  correlation, optical-flow
GuidedNet
Caffe implementation for "Guided Optical Flow Learning"
Stars: ✭ 28 (+27.27%)
Mutual labels:  optical-flow
CorBinian
CorBinian: A toolbox for modelling and simulating high-dimensional binary and count-data with correlations
Stars: ✭ 15 (-31.82%)
Mutual labels:  correlation
xmca
Maximum Covariance Analysis in Python
Stars: ✭ 41 (+86.36%)
Mutual labels:  correlation
nfc-laboratory
NFC signal and protocol analyzer using SDR receiver
Stars: ✭ 41 (+86.36%)
Mutual labels:  correlation
Optical-Flow-based-Obstacle-Avoidance
Image based obstacle avoidance using optical flow
Stars: ✭ 24 (+9.09%)
Mutual labels:  optical-flow
heatmaps
Better heatmaps in Python
Stars: ✭ 117 (+431.82%)
Mutual labels:  correlation
video features
Extract video features from raw videos using multiple GPUs. We support RAFT and PWC flow frames as well as S3D, I3D, R(2+1)D, VGGish, CLIP, ResNet features.
Stars: ✭ 225 (+922.73%)
Mutual labels:  optical-flow
humanflow2
Official repository of Learning Multi-Human Optical Flow (IJCV 2019)
Stars: ✭ 37 (+68.18%)
Mutual labels:  optical-flow
Posthog
🦔 PostHog provides open-source product analytics that you can self-host.
Stars: ✭ 5,488 (+24845.45%)
Mutual labels:  correlation
Naos
A mildly opiniated modern cloud service architecture blueprint + reference implementation
Stars: ✭ 19 (-13.64%)
Mutual labels:  correlation
tuneta
Intelligently optimizes technical indicators and optionally selects the least intercorrelated for use in machine learning models
Stars: ✭ 77 (+250%)
Mutual labels:  correlation
mmflow
OpenMMLab optical flow toolbox and benchmark
Stars: ✭ 711 (+3131.82%)
Mutual labels:  optical-flow
TreeCorr
Code for efficiently computing 2-point and 3-point correlation functions. For documentation, go to
Stars: ✭ 85 (+286.36%)
Mutual labels:  correlation
Machine-Learning-for-Asset-Managers
Implementation of code snippets, exercises and application to live data from Machine Learning for Asset Managers (Elements in Quantitative Finance) written by Prof. Marcos López de Prado.
Stars: ✭ 168 (+663.64%)
Mutual labels:  correlation
mcorr
Inferring bacterial recombination rates from large-scale sequencing datasets.
Stars: ✭ 29 (+31.82%)
Mutual labels:  correlation
Joint-Motion-Estimation-and-Segmentation
[MICCAI'18] Joint Learning of Motion Estimation and Segmentation for Cardiac MR Image Sequences
Stars: ✭ 45 (+104.55%)
Mutual labels:  optical-flow
msda
Library for multi-dimensional, multi-sensor, uni/multivariate time series data analysis, unsupervised feature selection, unsupervised deep anomaly detection, and prototype of explainable AI for anomaly detector
Stars: ✭ 80 (+263.64%)
Mutual labels:  correlation
EPC
Every Pixel Counts ++: Joint Learning of Geometry and Motion with 3D Holistic Understanding
Stars: ✭ 27 (+22.73%)
Mutual labels:  optical-flow
CrowdFlow
Optical Flow Dataset and Benchmark for Visual Crowd Analysis
Stars: ✭ 87 (+295.45%)
Mutual labels:  optical-flow

Pure Pytorch implementation of Correlation Layer

This repository implement a very simple correlation layer using pure pytorch, which is widely used in current learning based optical flow estimation.

correlation layer

Purpose

The best and official implementation of correlation layer can be find in FlowNet2 correlation_package

However, the cuda implementation has some limitations, for example, didn't support Tensor in CPU, lack support for TorchScript, and maybe troublesome compiling the code. So this repo's implementation uses pure pytorch API, which has nature support for back-propagate, TorchScript...

But this implementation may not be as efficient & memory friendly as the cuda implementaion. Also it currently only supports adjusting the max_displacement parameters, stride and kernel_size are strictly limited to 1 (since that already satisfy most existing flow network)

Usage

The API is compatiable with official Correlation class. And since there are no learnable parameter in the layer, this can be integrated into any network with pertrained weights that use the official implementation

To use this layer, copy the correlation_torch.py file to your workspace, replace the original Correlation package

Please double check whether the original usage of Correlation has kernel size == 1 and stride1 == stride2 == 1 and pad_size == max_displacement

from correlation_package.correlation import Correlation

to

from correlation_torch import CorrTorch as Correlation

that should seamlessly switch to the new layer.

Sample of test

only for reference.

-----test for: maxdisp=2, kernelsize=1, stride1=1, stride2=1
	official corr time: 0.06024980545043945s, torch corr time: 0.008973121643066406s
	official corr memory: 62.5MB, torch corr cost: 86.9140625MB
	sum of abs err: 0.036905914545059204
	mean of abs err: 5.766549016072986e-09
-----test for: maxdisp=3, kernelsize=1, stride1=1, stride2=1
	official corr time: 0.06620001792907715s, torch corr time: 0.00886392593383789s
	official corr memory: 0.0MB, torch corr cost: 23.4375MB
	sum of abs err: 0.07153448462486267
	mean of abs err: 5.702684990893658e-09
-----test for: maxdisp=4, kernelsize=1, stride1=1, stride2=1
	official corr time: 0.0799558162689209s, torch corr time: 0.015619039535522461s
	official corr memory: 17.5MB, torch corr cost: 49.6484375MB
	sum of abs err: 0.11687405407428741
	mean of abs err: 5.636287436772136e-09
-----test for: maxdisp=5, kernelsize=1, stride1=1, stride2=1
	official corr time: 0.08356404304504395s, torch corr time: 0.02199840545654297s
	official corr memory: 38.1640625MB, torch corr cost: 76.328125MB
	sum of abs err: 0.17250248789787292
	mean of abs err: 5.568908001407635e-09
-----test for: maxdisp=6, kernelsize=1, stride1=1, stride2=1
	official corr time: 0.1089165210723877s, torch corr time: 0.026157140731811523s
	official corr memory: 47.8359375MB, torch corr cost: 95.671875MB
	sum of abs err: 0.2382783591747284
	mean of abs err: 5.507543310301344e-09
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].