Skip to content

Commit

Permalink
improve bash, rewrite readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hetong007 committed Mar 20, 2018
1 parent baecd59 commit 5917a90
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Gluon-FashionAI-Attributes

This is the repo for [MXNet/Gluon](http://mxnet.incubator.apache.org/) benchmark scripts for the [FashionAI](https://tianchi.aliyun.com/competition/information.htm?spm=5176.100067.5678.2.505c3a26Oet3cf&raceId=231649) competition by Alibaba.
这是为[阿里天池竞赛——服饰属性标签识别](https://tianchi.aliyun.com/competition/information.htm?spm=5176.100067.5678.2.505c3a26Oet3cf&raceId=231649)提供的`gluon`教程与benchmark代码。

The generated submission will have mAP around 0.95 and Basic Precision around 0.84 on the board.
[`gluon`教程](FashionAI-Attributes-Skirt.ipynb)会从零开始一步步讲解,带你上手此次竞赛,同时也能帮助理解benchmark代码。

1. Download and untar the data files into `data/` folder, the structure should look like
当前Benchmark代码
- 在初赛数据集上能达到大约**0.95**的mAP与**0.84**的准确率,同时还有很大的提升空间。
- 在4块Tesla V100以及32核CPU的 p3.8xlarge 机器上的总运行时间约为2.5小时。

重现benchmark步骤:

1. 前往比赛官网,登录并注册参赛后可在左边“赛题与数据”标签内下载数据。之后将数据解压到`data/`文件夹中。解压后的目录结构应该如下所示:
```
Gluon-FashionAI-Attributes
├── benchmark.sh
Expand All @@ -17,8 +23,8 @@ Gluon-FashionAI-Attributes
├── README.md
└── train_task.py
```
2. Execute `bash benchmark.sh` to prepare data, train and predict for all eight tasks.
3. Compress and submit `submission/submission.csv` via the competition portal.

The script was tested on a [p3.8xlarge](https://aws.amazon.com/ec2/instance-types/p3/) EC2 instance from AWS. It costs around two and half hours.

2. 根据运行环境设置变量
- `num_gpus`,即GPU的个数,设置为0即为只用CPU训练。
- `num_workers`,即用来处理数据的进程个数,建议设置为CPU核心个数。
3. 运行`bash benchmark.sh`,这个脚本会自动准备数据,针对每个任务训练模型并预测,以及最后的合并预测。
4. 运行结束后,将`submission/submission.csv`压缩成`zip`格式并通过官网左侧的“提交结果”标签页提交。
19 changes: 11 additions & 8 deletions benchmark.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
num_gpus=4
num_workers=32

python prepare_data.py

python train_task.py --task collar_design_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task neckline_design_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task skirt_length_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task sleeve_length_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task neck_design_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task coat_length_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task lapel_design_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task pant_length_labels --model resnet50_v2 --num-gpus 4 -j 32 --epochs 40
python train_task.py --task collar_design_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40
python train_task.py --task neckline_design_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40
python train_task.py --task skirt_length_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40
python train_task.py --task sleeve_length_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40
python train_task.py --task neck_design_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40
python train_task.py --task coat_length_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40
python train_task.py --task lapel_design_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40
python train_task.py --task pant_length_labels --model resnet50_v2 --num-gpus $num_gpus -j $num_workers --epochs 40

cd submission
cat collar_design_labels.csv neckline_design_labels.csv skirt_length_labels.csv sleeve_length_labels.csv neck_design_labels.csv coat_length_labels.csv lapel_design_labels.csv pant_length_labels.csv > submission.csv
Expand Down

0 comments on commit 5917a90

Please sign in to comment.