Skip to content

Commit f28b56b

Browse files
committed
init
0 parents  commit f28b56b

25 files changed

+2077
-0
lines changed

.circleci/config.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2.1
2+
3+
jobs:
4+
python_lint:
5+
docker:
6+
- image: circleci/python:3.7
7+
steps:
8+
- checkout
9+
- run:
10+
command: |
11+
pip install --user --progress-bar off flake8 typing
12+
flake8 .
13+
test:
14+
docker:
15+
- image: circleci/python:3.7
16+
steps:
17+
- checkout
18+
- run:
19+
command: |
20+
pip install --user --progress-bar off pytest
21+
pip install --user --progress-bar off torch torchvision
22+
pip install --user --progress-bar off timm==0.3.2
23+
pytest .
24+
25+
workflows:
26+
build:
27+
jobs:
28+
- python_lint

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.swp
2+
**/__pycache__/**
3+
imnet_resnet50_scratch/timm_temp/
4+
.dumbo.json
5+
checkpoints/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Shoufa Chen
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# A MLP-like Architecture for Dense Prediction
2+
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
![Python 3.8](https://img.shields.io/badge/python-3.8-green.svg)
5+
6+
7+
8+
<p align="middle">
9+
<img src="figures/teaser.png" height="300" />
10+
&nbsp;&nbsp;&nbsp;&nbsp;
11+
<img src="figures/flops.png" height="300" />
12+
</p>
13+
14+
# Updates
15+
16+
- (22/07/2021) Initial release.
17+
18+
19+
20+
# Model Zoo
21+
22+
We provide CycleMLP models pretrained on ImageNet 2012.
23+
24+
| Model | Parameters | FLOPs | Top 1 Acc. | Download |
25+
| :------------------- | :--------- | :------- | :--------- | :------- |
26+
| CycleMLP-B1 | 15M | 2.1G | 78.9% | |
27+
| CycleMLP-B2 | 27M | 3.9G | 81.6% | |
28+
| CycleMLP-B3 | 38M | 6.9G | 82.4% | |
29+
| CycleMLP-B4 | 52M | 10.1G | 83.0% | |
30+
| CycleMLP-B5 | 76M | 12.3G | 83.2% | |
31+
32+
33+
# Usage
34+
35+
36+
## Install
37+
38+
- PyTorch 1.7.0+ and torchvision 0.8.1+
39+
- [timm](https://github.com/rwightman/pytorch-image-models/tree/c2ba229d995c33aaaf20e00a5686b4dc857044be):
40+
```
41+
pip install 'git+https://github.com/rwightman/pytorch-image-models@c2ba229d995c33aaaf20e00a5686b4dc857044be'
42+
43+
or
44+
45+
git clone https://github.com/rwightman/pytorch-image-models
46+
cd pytorch-image-models
47+
git checkout c2ba229d995c33aaaf20e00a5686b4dc857044be
48+
pip install -e .
49+
```
50+
- fvcore (optional, for FLOPs calculation)
51+
- mmcv, mmdetection, mmsegmentation (optional)
52+
53+
## Data preparation
54+
55+
Download and extract ImageNet train and val images from http://image-net.org/.
56+
The directory structure is:
57+
58+
```
59+
│path/to/imagenet/
60+
├──train/
61+
│ ├── n01440764
62+
│ │ ├── n01440764_10026.JPEG
63+
│ │ ├── n01440764_10027.JPEG
64+
│ │ ├── ......
65+
│ ├── ......
66+
├──val/
67+
│ ├── n01440764
68+
│ │ ├── ILSVRC2012_val_00000293.JPEG
69+
│ │ ├── ILSVRC2012_val_00002138.JPEG
70+
│ │ ├── ......
71+
│ ├── ......
72+
```
73+
74+
## Evaluation
75+
To evaluate a pre-trained CycleMLP-B5 on ImageNet val with a single GPU run:
76+
```
77+
python main.py --eval --model CycleMLP_B5 --resume path/to/CycleMLP_B5.pth --data-path /path/to/imagenet
78+
```
79+
80+
81+
## Training
82+
83+
To train CycleMLP-B5 on ImageNet on a single node with 8 gpus for 300 epochs run:
84+
```
85+
python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --model CycleMLP_B5 --batch-size 128 --data-path /path/to/imagenet --output_dir /path/to/save
86+
```
87+
88+
89+
# License
90+
91+
CycleMLP is released under MIT License.

0 commit comments

Comments
 (0)