diff --git a/cv/classification/mlp_mixer_b16_224_miil/README.md b/cv/classification/mlp_mixer_b16_224_miil/README.md new file mode 100644 index 00000000..70e39206 --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/README.md @@ -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 +``` + diff --git a/cv/classification/mlp_mixer_b16_224_miil/config.py b/cv/classification/mlp_mixer_b16_224_miil/config.py new file mode 120000 index 00000000..3721332c --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/config.py @@ -0,0 +1 @@ +../config.py \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/configs b/cv/classification/mlp_mixer_b16_224_miil/configs new file mode 120000 index 00000000..271eaab3 --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/configs @@ -0,0 +1 @@ +../configs \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/data b/cv/classification/mlp_mixer_b16_224_miil/data new file mode 120000 index 00000000..4909e06e --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/data @@ -0,0 +1 @@ +../data \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/infer.sh b/cv/classification/mlp_mixer_b16_224_miil/infer.sh new file mode 100755 index 00000000..907f8cd4 --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/infer.sh @@ -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 + diff --git a/cv/classification/mlp_mixer_b16_224_miil/logger.py b/cv/classification/mlp_mixer_b16_224_miil/logger.py new file mode 120000 index 00000000..e1dc8ceb --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/logger.py @@ -0,0 +1 @@ +../logger.py \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/lr_scheduler.py b/cv/classification/mlp_mixer_b16_224_miil/lr_scheduler.py new file mode 120000 index 00000000..268fb140 --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/lr_scheduler.py @@ -0,0 +1 @@ +../lr_scheduler.py \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/main.py b/cv/classification/mlp_mixer_b16_224_miil/main.py new file mode 120000 index 00000000..f05f7527 --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/main.py @@ -0,0 +1 @@ +../main.py \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/optimizer.py b/cv/classification/mlp_mixer_b16_224_miil/optimizer.py new file mode 120000 index 00000000..e5dec61d --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/optimizer.py @@ -0,0 +1 @@ +../optimizer.py \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/requirements.txt b/cv/classification/mlp_mixer_b16_224_miil/requirements.txt new file mode 120000 index 00000000..dc833dd4 --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/requirements.txt @@ -0,0 +1 @@ +../requirements.txt \ No newline at end of file diff --git a/cv/classification/mlp_mixer_b16_224_miil/train.sh b/cv/classification/mlp_mixer_b16_224_miil/train.sh new file mode 100755 index 00000000..87d54eeb --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/train.sh @@ -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 + diff --git a/cv/classification/mlp_mixer_b16_224_miil/utils.py b/cv/classification/mlp_mixer_b16_224_miil/utils.py new file mode 120000 index 00000000..50fbc6d8 --- /dev/null +++ b/cv/classification/mlp_mixer_b16_224_miil/utils.py @@ -0,0 +1 @@ +../utils.py \ No newline at end of file