diff --git a/README.md b/README.md index de20be7..31c42f2 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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`格式并通过官网左侧的“提交结果”标签页提交。 diff --git a/benchmark.sh b/benchmark.sh index b332f99..f337413 100644 --- a/benchmark.sh +++ b/benchmark.sh @@ -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