diff --git a/cv/classification/poolformer_s24/README.md b/cv/classification/poolformer_s24/README.md new file mode 100644 index 00000000..1e87679d --- /dev/null +++ b/cv/classification/poolformer_s24/README.md @@ -0,0 +1,65 @@ +## Poolformer-S24 + +### 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/. + +### Code Structure + + + ``` + . + ├── configs -> ../configs + │ ├── ... + │ └── default_settings.yaml + ├── data -> ../data + │ ├── __init__.py + │ ├── build.py + │ ├── cached_image_folder.py + │ ├── samplers.py + │ └── zipreader.py + ├── utils.py -> ../utils.py + ├── config.py -> ../config.py + ├── logger.py -> ../logger.py + ├── lr_scheduler.py -> ../lr_scheduler.py + ├── optimizer.py -> ../optimizer.py + ├── main.py + ├── train.sh + └── infer.sh + ``` + + + +### Training +You can use bash script `train.sh` to train this model. +``````` +sh train.sh +``````` + +### Inference + +Bash script `infer.sh` is used to infer the trained model. +``````` +sh infer.sh +``````` diff --git a/cv/classification/poolformer_s24/config.py b/cv/classification/poolformer_s24/config.py new file mode 120000 index 00000000..3721332c --- /dev/null +++ b/cv/classification/poolformer_s24/config.py @@ -0,0 +1 @@ +../config.py \ No newline at end of file diff --git a/cv/classification/poolformer_s24/configs b/cv/classification/poolformer_s24/configs new file mode 120000 index 00000000..bd0ab477 --- /dev/null +++ b/cv/classification/poolformer_s24/configs @@ -0,0 +1 @@ +../configs/ \ No newline at end of file diff --git a/cv/classification/poolformer_s24/data b/cv/classification/poolformer_s24/data new file mode 120000 index 00000000..eed2d0bc --- /dev/null +++ b/cv/classification/poolformer_s24/data @@ -0,0 +1 @@ +../data/ \ No newline at end of file diff --git a/cv/classification/poolformer_s24/infer.sh b/cv/classification/poolformer_s24/infer.sh new file mode 100755 index 00000000..37c26043 --- /dev/null +++ b/cv/classification/poolformer_s24/infer.sh @@ -0,0 +1,15 @@ +export PYTHONPATH=$PWD:$PYTHONPATH +set -aux + +GPU_NUMS=1 +PORT=12346 +MODEL_ARCH="poolformer_s24" + +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/poolformer_s24/logger.py b/cv/classification/poolformer_s24/logger.py new file mode 120000 index 00000000..e1dc8ceb --- /dev/null +++ b/cv/classification/poolformer_s24/logger.py @@ -0,0 +1 @@ +../logger.py \ No newline at end of file diff --git a/cv/classification/poolformer_s24/lr_scheduler.py b/cv/classification/poolformer_s24/lr_scheduler.py new file mode 120000 index 00000000..268fb140 --- /dev/null +++ b/cv/classification/poolformer_s24/lr_scheduler.py @@ -0,0 +1 @@ +../lr_scheduler.py \ No newline at end of file diff --git a/cv/classification/poolformer_s24/main.py b/cv/classification/poolformer_s24/main.py new file mode 120000 index 00000000..f05f7527 --- /dev/null +++ b/cv/classification/poolformer_s24/main.py @@ -0,0 +1 @@ +../main.py \ No newline at end of file diff --git a/cv/classification/poolformer_s24/optimizer.py b/cv/classification/poolformer_s24/optimizer.py new file mode 120000 index 00000000..e5dec61d --- /dev/null +++ b/cv/classification/poolformer_s24/optimizer.py @@ -0,0 +1 @@ +../optimizer.py \ No newline at end of file diff --git a/cv/classification/poolformer_s24/requirements.txt b/cv/classification/poolformer_s24/requirements.txt new file mode 120000 index 00000000..dc833dd4 --- /dev/null +++ b/cv/classification/poolformer_s24/requirements.txt @@ -0,0 +1 @@ +../requirements.txt \ No newline at end of file diff --git a/cv/classification/poolformer_s24/train.sh b/cv/classification/poolformer_s24/train.sh new file mode 100755 index 00000000..dadf3dcd --- /dev/null +++ b/cv/classification/poolformer_s24/train.sh @@ -0,0 +1,19 @@ +export PYTHONPATH=$PWD:$PYTHONPATH +set -aux + +GPU_NUMS=4 +PORT=12346 +MODEL_ARCH="poolformer_s24" +BATCH_SIZE=64 +LEARNING_RATE=1e-4 + +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 \ + --batch-size $BATCH_SIZE \ + --lr $LEARNING_RATE + diff --git a/cv/classification/poolformer_s24/utils.py b/cv/classification/poolformer_s24/utils.py new file mode 120000 index 00000000..50fbc6d8 --- /dev/null +++ b/cv/classification/poolformer_s24/utils.py @@ -0,0 +1 @@ +../utils.py \ No newline at end of file