https://github.com/rish-16/involution_pytorch
Unofficial PyTorch implementation of the Involution layer from CVPR 2021
https://github.com/rish-16/involution_pytorch
Last synced: about 1 year ago
JSON representation
Unofficial PyTorch implementation of the Involution layer from CVPR 2021
- Host: GitHub
- URL: https://github.com/rish-16/involution_pytorch
- Owner: rish-16
- License: mit
- Created: 2021-05-09T01:15:56.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-09T08:18:15.000Z (about 5 years ago)
- Last Synced: 2025-05-27T20:46:02.499Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 44.9 KB
- Stars: 45
- Watchers: 2
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# involution_pytorch
Unofficial PyTorch implementation of "Involution: Inverting the Inherence of Convolution for Visual Recognition" by Li et al. presented at CVPR 2021.
[[`abs`](https://arxiv.org/abs/2103.06255), [`pdf`](https://arxiv.org/pdf/2103.06255.pdf), [`Yannic's Video`](https://www.youtube.com/watch?v=pH2jZun8MoY)]

## Installation
You can install `involution_pytorch` via `pip`:
```bash
pip install involution_pytorch
```
## Usage
You can use the `Inv2d` layer as you would with any PyTorch layer:
```python
import torch
from involution_pytorch import Inv2d
inv = Inv2d(
channels=16,
kernel_size=3,
stride=1
)
x = torch.rand(1, 16, 32, 32)
y = inv(x) # [1, 16, 32, 32]
```
> The paper talks about using Self-Attention for the dynamic kernel generation function. I'll try implementing it later if time permits.
## Contributing
If I've made any errors anywhere in the implementation, please do let me know by raising an issue. If there's any cool addition you want to introduce, all PRs appreciated!
## License
[MIT](https://github.com/rish-16/involution_pytorch/blob/main/LICENSE)