https://github.com/lucidrains/res-mlp-pytorch
Implementation of ResMLP, an all MLP solution to image classification, in Pytorch
https://github.com/lucidrains/res-mlp-pytorch
artificial-intelligence deep-learning vision
Last synced: 10 months ago
JSON representation
Implementation of ResMLP, an all MLP solution to image classification, in Pytorch
- Host: GitHub
- URL: https://github.com/lucidrains/res-mlp-pytorch
- Owner: lucidrains
- License: mit
- Created: 2021-05-10T02:31:27.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-02T14:07:09.000Z (over 3 years ago)
- Last Synced: 2025-08-23T02:44:56.748Z (11 months ago)
- Topics: artificial-intelligence, deep-learning, vision
- Language: Python
- Homepage:
- Size: 61.5 KB
- Stars: 198
- Watchers: 4
- Forks: 32
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

## ResMLP - Pytorch
Implementation of ResMLP, an all MLP solution to image classification out of Facebook AI, in Pytorch
## Install
```bash
$ pip install res-mlp-pytorch
```
## Usage
```python
import torch
from res_mlp_pytorch import ResMLP
model = ResMLP(
image_size = 256,
patch_size = 16,
dim = 512,
depth = 12,
num_classes = 1000
)
img = torch.randn(1, 3, 256, 256)
pred = model(img) # (1, 1000)
```
Rectangular image
```python
import torch
from res_mlp_pytorch import ResMLP
model = ResMLP(
image_size = (128, 256), # (128 x 256)
patch_size = 16,
dim = 512,
depth = 12,
num_classes = 1000
)
img = torch.randn(1, 3, 128, 256)
pred = model(img) # (1, 1000)
```
## Citations
```bibtex
@misc{touvron2021resmlp,
title = {ResMLP: Feedforward networks for image classification with data-efficient training},
author = {Hugo Touvron and Piotr Bojanowski and Mathilde Caron and Matthieu Cord and Alaaeldin El-Nouby and Edouard Grave and Armand Joulin and Gabriel Synnaeve and Jakob Verbeek and Hervé Jégou},
year = {2021},
eprint = {2105.03404},
archivePrefix = {arXiv},
primaryClass = {cs.CV}
}
```