Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions cv/classification/mlp_mixer_b16_224_miil/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## mlp_mixer_b16_224_miil

### Installation
- Install the latest version of OneFlow
```bash
python3 -m pip install oneflow -f https://staging.oneflow.info/branch/master/[PLATFORM]
```
Find more information on [install oneflow](https://github.com/Oneflow-Inc/oneflow#install-oneflow)

- Install flowvision

Then install the latest stable release of flowvision

```bash
pip install flowvision==0.2.1
```

- Install other requirements
```bash
python3 -m pip install -r requirements.txt
```

### Dataset
#### ImageNet
For ImageNet dataset, you can download it from http://image-net.org/. We provide the following two ways to load data:

- For standard folder dataset, move validation images to labeled sub-folders. The file structure should look like:
```bash
$ tree data
imagenet
├── train
│ ├── class1
│ │ ├── img1.jpeg
│ │ ├── img2.jpeg
│ │ └── ...
│ ├── class2
│ │ ├── img3.jpeg
│ │ └── ...
│ └── ...
└── val
├── class1
│ ├── img4.jpeg
│ ├── img5.jpeg
│ └── ...
├── class2
│ ├── img6.jpeg
│ └── ...
└── ...


### Training

You can use bash script `train.sh` to train this model.

```bash
sh train.sh
```

### inference

Bash script `infer.sh` is used to infer the trained model.

```bash
sh infer.sh
```

1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/config.py
1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/configs
1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/data
16 changes: 16 additions & 0 deletions cv/classification/mlp_mixer_b16_224_miil/infer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=1
PORT=12346
MODEL_ARCH="mlp_mixer_b16_224_miil"

python3 -m oneflow.distributed.launch \
--nproc_per_node $GPU_NUMS \
--master_addr 127.0.0.1 \
--master_port $PORT \
main.py \
--cfg configs/default_settings.yaml \
--model_arch $MODEL_ARCH \
--throughput

1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/logger.py
1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/lr_scheduler.py
1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/main.py
1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/optimizer.py
1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/requirements.txt
16 changes: 16 additions & 0 deletions cv/classification/mlp_mixer_b16_224_miil/train.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=8
PORT=12346
MODEL_ARCH="mlp_mixer_b16_224_miil"

python3 -m oneflow.distributed.launch \
--nproc_per_node $GPU_NUMS \
--master_addr 127.0.0.1 \
--master_port $PORT \
main.py \
--cfg configs/default_settings.yaml \
--model_arch $MODEL_ARCH \
--lr 0.001

1 change: 1 addition & 0 deletions cv/classification/mlp_mixer_b16_224_miil/utils.py