From db6074c194de2369bda9d969ac5f70b4afacdecf Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Mon, 21 Sep 2020 11:46:53 +0800 Subject: [PATCH] add the usage of anchor cluster in doc (#1446) * add usage of tools/anchor_cluster.py in doc (#1440) * modify doc for anchor cluster --- configs/ppyolo/README.md | 6 ++++++ configs/ppyolo/README_cn.md | 4 ++++ configs/yolov4/README.md | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/configs/ppyolo/README.md b/configs/ppyolo/README.md index 11837a1b6..92790e947 100644 --- a/configs/ppyolo/README.md +++ b/configs/ppyolo/README.md @@ -82,6 +82,12 @@ Training PP-YOLO on 8 GPUs with following command(all commands should be run und CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python tools/train.py -c configs/ppyolo/ppyolo.yml --eval ``` +optional: Run `tools/anchor_cluster.py` to get anchors suitable for your dataset, and modify the anchor setting in `configs/ppyolo/ppyolo.yml`. + +``` bash +python tools/anchor_cluster.py -c configs/ppyolo/ppyolo.yml -n 9 -s 608 -m v2 -i 1000 +``` + ### 2. Evaluation Evaluating PP-YOLO on COCO val2017 dataset in single GPU with following commands: diff --git a/configs/ppyolo/README_cn.md b/configs/ppyolo/README_cn.md index 2c81cd9d6..7f3fb5104 100644 --- a/configs/ppyolo/README_cn.md +++ b/configs/ppyolo/README_cn.md @@ -82,6 +82,10 @@ PP-YOLO从如下方面优化和提升YOLOv3模型的精度和速度: ```bash CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python tools/train.py -c configs/ppyolo/ppyolo.yml --eval ``` +可选:在训练之前使用`tools/anchor_cluster.py`得到适用于你的数据集的anchor,并修改`configs/ppyolo/ppyolo.yml`中的anchor设置 +```bash +python tools/anchor_cluster.py -c configs/ppyolo/ppyolo.yml -n 9 -s 608 -m v2 -i 1000 +``` ### 2. 评估 diff --git a/configs/yolov4/README.md b/configs/yolov4/README.md index 5127d88c8..9394975af 100644 --- a/configs/yolov4/README.md +++ b/configs/yolov4/README.md @@ -21,6 +21,21 @@ - label_smooth - grid_sensitive +目前支持YOLO系列的Anchor聚类算法 +``` bash +python tools/anchor_cluster.py -c ${config} -m ${method} -s ${size} +``` +主要参数配置参考下表 +| 参数 | 用途 | 默认值 | 备注 | +|:------:|:------:|:------:|:------:| +| -c/--config | 模型的配置文件 | 无默认值 | 必须指定 | +| -n/--n | 聚类的簇数 | 9 | Anchor的数目 | +| -s/--size | 图片的输入尺寸 | None | 若指定,则使用指定的尺寸,如果不指定, 则尝试从配置文件中读取图片尺寸 | +| -m/--method | 使用的Anchor聚类方法 | v2 | 目前只支持yolov2/v5的聚类算法 | +| -i/--iters | kmeans聚类算法的迭代次数 | 1000 | kmeans算法收敛或者达到迭代次数后终止 | +| -gi/--gen_iters | 遗传算法的迭代次数 | 1000 | 该参数只用于yolov5的Anchor聚类算法 | +| -t/--thresh| Anchor尺度的阈值 | 0.25 | 该参数只用于yolov5的Anchor聚类算法 | + ## 模型库 下表中展示了当前支持的网络结构。 -- GitLab