• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PyTorch reimplementation of the paper "Involution: Inverting the Inherence of Convolution for Visual Recognition" (2D and 3D Involution) [CVPR 2021].

Involution: Inverting the Inherence of Convolution for Visual Recognition

License: MIT

Unofficial PyTorch reimplementation of the paper Involution: Inverting the Inherence of Convolution for Visual Recognition by Duo Li, Jie Hu, Changhu Wang et al. published at CVPR 2021.

This repository includes a pure PyTorch implementation of a 2D and 3D involution.

Please note that the official implementation provides a more memory efficient CuPy implementation of the 2D involution. Additionally, shikishima-TasakiLab provides a fast and memory efficent CUDA implementation of the 2D Involution.

Installation

The 2D and 3D involution can be easily installed by using pip.

pip install git+https://github.com/ChristophReich1996/Involution

Example Usage

Additional examples, such as strided involutions or transposed convolution like involutions, can be found in the example.py file.

The 2D involution can be used as a nn.Module as follows:

import torch
from involution import Involution2d

involution = Involution2d(in_channels=32, out_channels=64)
output = involution(torch.rand(1, 32, 128, 128))

The 2D involution takes the following parameters.

Parameter Description Type
in_channels Number of input channels int
out_channels Number of output channels int
sigma_mapping Non-linear mapping as introduced in the paper. If none BN + ReLU is utilized (default=None) Optional[nn.Module]
kernel_size Kernel size to be used (default=(7, 7)) Union[int, Tuple[int, int]]
stride Stride factor to be utilized (default=(1, 1)) Union[int, Tuple[int, int]]
groups Number of groups to be employed (default=1) int
reduce_ratio Reduce ration of involution channels (default=1) int
dilation Dilation in unfold to be employed (default=(1, 1)) Union[int, Tuple[int, int]]
padding Padding to be used in unfold operation (default=(3, 3)) Union[int, Tuple[int, int]]
bias If true bias is utilized in each convolution layer (default=False) bool
force_shape_match If true potential shape mismatch is solved by performing avg pool (default=False) bool
**kwargs Unused additional key word arguments Any

The 3D involution can be used as a nn.Module as follows:

import torch
from involution import Involution3d

involution = Involution3d(in_channels=8, out_channels=16)
output = involution(torch.rand(1, 8, 32, 32, 32))

The 3D involution takes the following parameters.

Parameter Description Type
in_channels Number of input channels int
out_channels Number of output channels int
sigma_mapping Non-linear mapping as introduced in the paper. If none BN + ReLU is utilized Optional[nn.Module]
kernel_size Kernel size to be used (default=(7, 7, 7)) Union[int, Tuple[int, int, int]]
stride Stride factor to be utilized (default=(1, 1, 1)) Union[int, Tuple[int, int, int]]
groups Number of groups to be employed (default=1) int
reduce_ratio Reduce ration of involution channels (default=1) int
dilation Dilation in unfold to be employed (default=(1, 1, 1)) Union[int, Tuple[int, int, int]]
padding Padding to be used in unfold operation (default=(3, 3, 3)) Union[int, Tuple[int, int, int]]
bias If true bias is utilized in each convolution layer (default=False) bool
force_shape_match If true potential shape mismatch is solved by performing avg pool (default=False) bool
**kwargs Unused additional key word arguments Any

Reference

@inproceedings{Li2021,
    author = {Li, Duo and Hu, Jie and Wang, Changhu and Li, Xiangtai and She, Qi and Zhu, Lei and Zhang, Tong and Chen, Qifeng},
    title = {Involution: Inverting the Inherence of Convolution for Visual Recognition},
    booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month = {June},
    year = {2021}
}

More Repositories

1

Swin-Transformer-V2

PyTorch reimplementation of the paper "Swin Transformer V2: Scaling Up Capacity and Resolution" [CVPR 2022].
Python
141
star
2

MaxViT

PyTorch reimplementation of the paper "MaxViT: Multi-Axis Vision Transformer" [arXiv 2022].
Python
135
star
3

Cell-DETR

Official and maintained implementation of the paper "Attention-Based Transformers for Instance Segmentation of Cells in Microstructures" [BIBM 2020].
Python
88
star
4

Semantic_Pyramid_for_Image_Generation

PyTorch reimplementation of the paper: "Semantic Pyramid for Image Generation" [CVPR 2020].
Python
46
star
5

Mode_Collapse

Mode collapse example of GANs in 2D (PyTorch).
Python
30
star
6

ECG_Classification

Official and maintained implementation of the paper "Exploring Novel Algorithms for Atrial Fibrillation Detection by Driving Graduate Level Education in Medical Machine Learning" (ECG-DualNet) [Physiological Measurement 2022].
Python
27
star
7

OSS-Net

Official and maintained implementation of the paper "OSS-Net: Memory Efficient High Resolution Semantic Segmentation of 3D Medical Data" [BMVC 2021].
Python
24
star
8

SmeLU

PyTorch reimplementation of the Smooth ReLU activation function proposed in the paper "Real World Large Scale Recommendation Systems Reproducibility and Smooth Activations" [arXiv 2022].
Python
17
star
9

ToeffiPy

ToeffiPy is a PyTorch like autograd/deep learning library based only on NumPy.
Python
16
star
10

Dirac-GAN

PyTorch reimplementation of the DiracGAN proposed in the paper "Which Training Methods for GANs do actually Converge?" [ICML 2018].
Python
16
star
11

Optical-Flow-Visualization-PyTorch

PyTorch implementation of the classical optical flow visualization by Baker et al. [ICCV 2007].
Python
13
star
12

HyperMixer

PyTorch reimplementation of the paper "HyperMixer: An MLP-based Green AI Alternative to Transformers" [arXiv 2022].
Python
13
star
13

Multi-StyleGAN

Official and maintained implementation of the paper "Multi-StyleGAN: Towards Image-Based Simulation of Time-Lapse Live-Cell Microscopy" [MICCAI 2021].
Python
10
star
14

DeepFoveaPP_for_Video_Reconstruction_and_Super_Resolution

DeepFovea++: Reconstruction and Super-Resolution for Natural Foveated Rendered Videos (PyTorch).
Python
10
star
15

FNet2D

FNet 2D: Scaling Fourier Transform Token Mixing To Vision
Python
7
star
16

Differentiable_JPEG

This repo reimplements the differentiable JPEG proposed in "JPEG-resistant Adversarial Images".
Python
6
star
17

Yeast-in-Microstructures-Dataset

Official and maintained implementation of the dataset paper "An Instance Segmentation Dataset of Yeast Cells in Microstructures" [EMBC 2023].
Python
6
star
18

Pade-Activation-Unit

PyTorch reimplementation of the paper "Padé Activation Units: End-to-end Learning of Flexible Activation Functions in Deep Networks" [ICLR 2020].
Python
5
star
19

Scaling_Vision_Transformers_22B_Param

Reimplementation of the paper "Scaling Vision Transformers to 22 Billion Parameters" by Dehghani et al. [arXiv, 2023]
3
star
20

DL4NLP_Cheatsheet_TUD

Cheatsheet for the lecture Deep Learning for Natural Language Processing at TU Darmstadt
3
star
21

3D_Baggage_Segmentation

This repo implements a 3D segmentation task for an airport baggage dataset.
Python
2
star
22

SmeLU-Triton

Triton reimplementation of the Smooth ReLU activation function proposed in the paper "Real World Large Scale Recommendation Systems Reproducibility and Smooth Activations" [arXiv 2022].
Python
2
star
23

simple_logistic_regression

Simple logistic regression model with autograd for Statistics II
Python
1
star
24

CV2_Cheatsheet_TUD

Cheatsheet for the lecture Computer Vision at TU Darmstadt
1
star
25

Latex_Auto_Compile

Short python script for auto compiling Latex files.
Python
1
star
26

Elektronik_Formelsammlung_TUD

Formelsammlung für das Modul Elektronik (TU Darmstadt).
1
star
27

Neural_Network_cpp

Neural network from scratch in C++.
C++
1
star