未验证 提交 91700aaa 编写于 作者: W wangguanzhong 提交者: GitHub

polish doc (#286)

上级 441b3623
...@@ -157,7 +157,7 @@ cd dataset/wider_face && ./download.sh ...@@ -157,7 +157,7 @@ cd dataset/wider_face && ./download.sh
export CUDA_VISIBLE_DEVICES=0 export CUDA_VISIBLE_DEVICES=0
export PYTHONPATH=$PYTHONPATH:. export PYTHONPATH=$PYTHONPATH:.
python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \ python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \
-o weights=output/blazeface/model_final/ \ -o weights=output/blazeface/model_final \
--eval_mode=widerface --eval_mode=widerface
``` ```
评估完成后,将在`output/pred`中生成txt格式的测试结果。 评估完成后,将在`output/pred`中生成txt格式的测试结果。
...@@ -222,7 +222,7 @@ EvalReader: ...@@ -222,7 +222,7 @@ EvalReader:
评估并生成结果文件: 评估并生成结果文件:
``` ```
python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \ python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \
-o weights=output/blazeface/model_final/ \ -o weights=output/blazeface/model_final \
--eval_mode=fddb --eval_mode=fddb
``` ```
评估完成后,将在`output/pred/pred_fddb_res.txt`中生成txt格式的测试结果。 评估完成后,将在`output/pred/pred_fddb_res.txt`中生成txt格式的测试结果。
......
...@@ -172,7 +172,7 @@ Default is `False`, it will select `single-scale` evaluation. ...@@ -172,7 +172,7 @@ Default is `False`, it will select `single-scale` evaluation.
export CUDA_VISIBLE_DEVICES=0 export CUDA_VISIBLE_DEVICES=0
export PYTHONPATH=$PYTHONPATH:. export PYTHONPATH=$PYTHONPATH:.
python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \ python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \
-o weights=output/blazeface/model_final/ \ -o weights=output/blazeface/model_final \
--eval_mode=widerface --eval_mode=widerface
``` ```
After the evaluation is completed, the test result in txt format will be generated in `output/pred`. After the evaluation is completed, the test result in txt format will be generated in `output/pred`.
...@@ -239,7 +239,7 @@ EvalReader: ...@@ -239,7 +239,7 @@ EvalReader:
Evaluate and generate results files: Evaluate and generate results files:
``` ```
python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \ python -u tools/face_eval.py -c configs/face_detection/blazeface.yml \
-o weights=output/blazeface/model_final/ \ -o weights=output/blazeface/model_final \
--eval_mode=fddb --eval_mode=fddb
``` ```
After the evaluation is completed, the test result in txt format will be generated in `output/pred/pred_fddb_res.txt`. After the evaluation is completed, the test result in txt format will be generated in `output/pred/pred_fddb_res.txt`.
......
...@@ -29,7 +29,7 @@ list below can be viewed by `--help` ...@@ -29,7 +29,7 @@ list below can be viewed by `--help`
| FLAG | script supported | description | default | remark | | FLAG | script supported | description | default | remark |
| :----------------------: | :------------: | :---------------: | :--------------: | :-----------------: | | :----------------------: | :------------: | :---------------: | :--------------: | :-----------------: |
| -c | ALL | Select config file | None | **The whole description of configure can refer to [config_example](config_example)** | | -c | ALL | Select config file | None | **The description of configure can refer to [CONFIG.md](../advanced_tutorials/CONFIG.md)** |
| -o | ALL | Set parameters in configure file | None | `-o` has higher priority to file configured by `-c`. Such as `-o use_gpu=False max_iter=10000` | | -o | ALL | Set parameters in configure file | None | `-o` has higher priority to file configured by `-c`. Such as `-o use_gpu=False max_iter=10000` |
| -r/--resume_checkpoint | train | Checkpoint path for resuming training | None | `-r output/faster_rcnn_r50_1x/10000` | | -r/--resume_checkpoint | train | Checkpoint path for resuming training | None | `-r output/faster_rcnn_r50_1x/10000` |
| --eval | train | Whether to perform evaluation in training | False | | | --eval | train | Whether to perform evaluation in training | False | |
...@@ -70,7 +70,7 @@ list below can be viewed by `--help` ...@@ -70,7 +70,7 @@ list below can be viewed by `--help`
```bash ```bash
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \
-o pretrain_weights=output/faster_rcnn_r50_1x/model_final/ \ -o pretrain_weights=output/faster_rcnn_r50_1x/model_final \
finetune_exclude_pretrained_params = ['cls_score','bbox_pred'] finetune_exclude_pretrained_params = ['cls_score','bbox_pred']
``` ```
...@@ -120,7 +120,6 @@ Also, please note mixed precision training currently requires changing `norm_typ ...@@ -120,7 +120,6 @@ Also, please note mixed precision training currently requires changing `norm_typ
export CUDA_VISIBLE_DEVICES=0 export CUDA_VISIBLE_DEVICES=0
python -u tools/eval.py -c configs/faster_rcnn_r50_1x.yml \ python -u tools/eval.py -c configs/faster_rcnn_r50_1x.yml \
-o weights=https://paddlemodels.bj.bcebos.com/object_detection/faster_rcnn_r50_1x.tar \ -o weights=https://paddlemodels.bj.bcebos.com/object_detection/faster_rcnn_r50_1x.tar \
-d dataset/coco
``` ```
The path of model to be evaluted can be both local path and link in [MODEL_ZOO](../MODEL_ZOO_cn.md). The path of model to be evaluted can be both local path and link in [MODEL_ZOO](../MODEL_ZOO_cn.md).
......
...@@ -26,7 +26,7 @@ python tools/infer.py -c configs/faster_rcnn_r50_1x.yml --infer_img=demo/0000005 ...@@ -26,7 +26,7 @@ python tools/infer.py -c configs/faster_rcnn_r50_1x.yml --infer_img=demo/0000005
| FLAG | 支持脚本 | 用途 | 默认值 | 备注 | | FLAG | 支持脚本 | 用途 | 默认值 | 备注 |
| :----------------------: | :------------: | :---------------: | :--------------: | :-----------------: | | :----------------------: | :------------: | :---------------: | :--------------: | :-----------------: |
| -c | ALL | 指定配置文件 | None | **完整配置说明请参考[配置案例](config_example)** | | -c | ALL | 指定配置文件 | None | **配置模块说明请参考[配置模块](../advanced_tutorials/CONFIG_cn.md)** |
| -o | ALL | 设置配置文件里的参数内容 | None | 使用-o配置相较于-c选择的配置文件具有更高的优先级。例如:`-o use_gpu=False max_iter=10000` | | -o | ALL | 设置配置文件里的参数内容 | None | 使用-o配置相较于-c选择的配置文件具有更高的优先级。例如:`-o use_gpu=False max_iter=10000` |
| -r/--resume_checkpoint | train | 从某一检查点恢复训练 | None | `-r output/faster_rcnn_r50_1x/10000` | | -r/--resume_checkpoint | train | 从某一检查点恢复训练 | None | `-r output/faster_rcnn_r50_1x/10000` |
| --eval | train | 是否边训练边测试 | False | | | --eval | train | 是否边训练边测试 | False | |
...@@ -50,7 +50,7 @@ python tools/infer.py -c configs/faster_rcnn_r50_1x.yml --infer_img=demo/0000005 ...@@ -50,7 +50,7 @@ python tools/infer.py -c configs/faster_rcnn_r50_1x.yml --infer_img=demo/0000005
```bash ```bash
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml --eval -d dataset/coco python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml --eval
``` ```
在训练中交替执行评估, 评估在每个snapshot\_iter时开始。每次评估后还会评出最佳mAP模型保存到`best_model`文件夹下。 在训练中交替执行评估, 评估在每个snapshot\_iter时开始。每次评估后还会评出最佳mAP模型保存到`best_model`文件夹下。
...@@ -68,7 +68,7 @@ python tools/infer.py -c configs/faster_rcnn_r50_1x.yml --infer_img=demo/0000005 ...@@ -68,7 +68,7 @@ python tools/infer.py -c configs/faster_rcnn_r50_1x.yml --infer_img=demo/0000005
```bash ```bash
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \
-o pretrain_weights=output/faster_rcnn_r50_1x/model_final/ \ -o pretrain_weights=output/faster_rcnn_r50_1x/model_final \
finetune_exclude_pretrained_params=['cls_score','bbox_pred'] finetune_exclude_pretrained_params=['cls_score','bbox_pred']
``` ```
...@@ -118,10 +118,9 @@ python -m paddle.distributed.launch --selected_gpus 0,1,2,3,4,5,6,7 tools/train. ...@@ -118,10 +118,9 @@ python -m paddle.distributed.launch --selected_gpus 0,1,2,3,4,5,6,7 tools/train.
export CUDA_VISIBLE_DEVICES=0 export CUDA_VISIBLE_DEVICES=0
python -u tools/eval.py -c configs/faster_rcnn_r50_1x.yml \ python -u tools/eval.py -c configs/faster_rcnn_r50_1x.yml \
-o weights=https://paddlemodels.bj.bcebos.com/object_detection/faster_rcnn_r50_1x.tar \ -o weights=https://paddlemodels.bj.bcebos.com/object_detection/faster_rcnn_r50_1x.tar \
-d dataset/coco
``` ```
评估模型可以为本地路径,例如`output/faster_rcnn_r50_1x/model_final/`, 也可以是[MODEL_ZOO](../MODEL_ZOO_cn.md)中给出的模型链接。 评估模型可以为本地路径,例如`output/faster_rcnn_r50_1x/model_final`, 也可以是[MODEL_ZOO](../MODEL_ZOO_cn.md)中给出的模型链接。
- 通过json文件评估 - 通过json文件评估
...@@ -180,6 +179,5 @@ batch size可以达到每GPU 4 (Tesla V100 16GB)。 ...@@ -180,6 +179,5 @@ batch size可以达到每GPU 4 (Tesla V100 16GB)。
**A:** 可在配置文件中设置 `sample_transform`。注意需要在配置文件中加入**完整预处理** **A:** 可在配置文件中设置 `sample_transform`。注意需要在配置文件中加入**完整预处理**
例如RCNN模型中`DecodeImage`, `NormalizeImage` and `Permute` 例如RCNN模型中`DecodeImage`, `NormalizeImage` and `Permute`
**Q:** affine_channel和batch norm是什么关系? </br>
**Q:** affine_channel和batch norm是什么关系? **A:** 在RCNN系列模型加载预训练模型初始化,有时候会固定住batch norm的参数, 使用预训练模型中的全局均值和方式,并且batch norm的scale和bias参数不更新,已发布的大多ResNet系列的RCNN模型采用这种方式。这种情况下可以在config中设置norm_type为bn或affine_channel, freeze_norm为true (默认为true),两种方式等价。affne_channel的计算方式为`scale * x + bias`。只不过设置affine_channel时,内部对batch norm的参数自动做了融合。如果训练使用的affine_channel,用保存的模型做初始化,训练其他任务时,既可使用affine_channel, 也可使用batch norm, 参数均可正确加载。
**A:** 在RCNN系列模型加载预训练模型初始化,有时候会固定住batch norm的参数, 使用预训练模型中的全局均值和方式,并且batch norm的scale和bias参数不更新,已发布的大多ResNet系列的RCNN模型采用这种方式。这种情况下可以在config中设置norm_type为bn或affine_channel, freeze_norm为true (默认为true),两种方式等价。affne_channel的计算方式为`scale * x + bias`。只不过设置affine_channel时,内部对batch norm的参数自动做了融合。如果训练使用的affine_channel,用保存的模型做初始化,训练其他任务时,即可使用affine_channel, 也可使用batch norm, 参数均可正确加载。
...@@ -13,7 +13,7 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -13,7 +13,7 @@ export CUDA_VISIBLE_DEVICES=0
## Data Preparation ## Data Preparation
Dataset refers to [Kaggle](https://www.kaggle.com/mbkinaci/fruit-images-for-object-detection), which contains 240 images in train dataset and 60 images in test dataset. Data categories are apple, orange and banana. Download [here](https://dataset.bj.bcebos.com/PaddleDetection_demo/fruit-detection.tar) and uncompress the dataset after download, script for data preparation is located at [download_fruit.py](https://github.com/PaddlePaddle/PaddleDetection/blob/master/dataset/fruit/download_fruit.py). Command is as follows: Dataset refers to [Kaggle](https://www.kaggle.com/mbkinaci/fruit-images-for-object-detection), which contains 240 images in train dataset and 60 images in test dataset. Data categories are apple, orange and banana. Download [here](https://dataset.bj.bcebos.com/PaddleDetection_demo/fruit-detection.tar) and uncompress the dataset after download, script for data preparation is located at [download_fruit.py](../../dataset/fruit/download_fruit.py). Command is as follows:
```bash ```bash
python dataset/fruit/download_fruit.py python dataset/fruit/download_fruit.py
......
...@@ -13,7 +13,7 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -13,7 +13,7 @@ export CUDA_VISIBLE_DEVICES=0
## 数据准备 ## 数据准备
数据集参考[Kaggle数据集](https://www.kaggle.com/mbkinaci/fruit-images-for-object-detection),其中训练数据集240张图片,测试数据集60张图片,数据类别为3类:苹果,橘子,香蕉。[下载链接](https://dataset.bj.bcebos.com/PaddleDetection_demo/fruit-detection.tar)。数据下载后分别解压即可, 数据准备脚本位于[download_fruit.py](../dataset/fruit/download_fruit.py)。下载数据方式如下: 数据集参考[Kaggle数据集](https://www.kaggle.com/mbkinaci/fruit-images-for-object-detection),其中训练数据集240张图片,测试数据集60张图片,数据类别为3类:苹果,橘子,香蕉。[下载链接](https://dataset.bj.bcebos.com/PaddleDetection_demo/fruit-detection.tar)。数据下载后分别解压即可, 数据准备脚本位于[download_fruit.py](../../dataset/fruit/download_fruit.py)。下载数据方式如下:
```bash ```bash
python dataset/fruit/download_fruit.py python dataset/fruit/download_fruit.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册