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

refine doc for transfer learning (#3642)

* refine doc for transfer learning
上级 74a3bd04
...@@ -70,7 +70,10 @@ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \ ...@@ -70,7 +70,10 @@ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \
- Fine-tune other task - Fine-tune other task
When using pre-trained model to fine-tune other task, the excluded pre-trained parameters can be set by finetune_exclude_pretrained_params in YAML config or -o finetune_exclude_pretrained_params in the arguments. When using pre-trained model to fine-tune other task, two methods can be used:
1. The excluded pre-trained parameters can be set by `finetune_exclude_pretrained_params` in YAML config
2. Set -o finetune_exclude_pretrained_params in the arguments.
```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
......
...@@ -71,7 +71,10 @@ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \ ...@@ -71,7 +71,10 @@ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \
- Fine-tune其他任务 - Fine-tune其他任务
使用预训练模型fine-tune其他任务时,在YAML配置文件中设置`finetune_exclude_pretrained_params`或在命令行中添加`-o finetune_exclude_pretrained_params`对预训练模型进行选择性加载。 使用预训练模型fine-tune其他任务时,可采用如下两种方式:
1. 在YAML配置文件中设置`finetune_exclude_pretrained_params`
2. 在命令行中添加-o finetune_exclude_pretrained_params对预训练模型进行选择性加载。
```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
......
...@@ -6,7 +6,10 @@ In transfer learning, if different dataset and the number of classes is used, th ...@@ -6,7 +6,10 @@ In transfer learning, if different dataset and the number of classes is used, th
## Transfer Learning in PaddleDetection ## Transfer Learning in PaddleDetection
In transfer learning, it's needed to load pretrained model selectively. Set `finetune_exclude_pretrained_params` in YAML configuration files or set `-o finetune_exclude_pretrained_params` in command line. In transfer learning, it's needed to load pretrained model selectively. The following two methods can be used:
1. Set `finetune_exclude_pretrained_params` in YAML configuration files. Please refer to [configure file](../configs/yolov3_mobilenet_v1_fruit.yml#L15)
2. Set -o finetune_exclude_pretrained_params in command line. For example:
```python ```python
export PYTHONPATH=$PYTHONPATH:. export PYTHONPATH=$PYTHONPATH:.
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
## PaddleDetection进行迁移学习 ## PaddleDetection进行迁移学习
在迁移学习中,对预训练模型进行选择性加载,可通过在 YMAL 配置文件中通过设置 finetune_exclude_pretrained_params字段,也可通过在 train.py的启动参数中设置 -o finetune_exclude_pretrained_params。 在迁移学习中,对预训练模型进行选择性加载,可通过如下两种方式实现:
1. 在 YMAL 配置文件中通过设置`finetune_exclude_pretrained_params`字段。可参考[配置文件](../configs/yolov3_mobilenet_v1_fruit.yml#L15)
2. 在 train.py的启动参数中设置 -o finetune_exclude_pretrained_params。例如:
```python ```python
export PYTHONPATH=$PYTHONPATH:. export PYTHONPATH=$PYTHONPATH:.
......
...@@ -86,6 +86,8 @@ def load_params(exe, prog, path, ignore_params=[]): ...@@ -86,6 +86,8 @@ def load_params(exe, prog, path, ignore_params=[]):
prog (fluid.Program): load weight to which Program object. prog (fluid.Program): load weight to which Program object.
path (string): URL string or loca model path. path (string): URL string or loca model path.
ignore_params (bool): ignore variable to load when finetuning. ignore_params (bool): ignore variable to load when finetuning.
It can be specified by finetune_exclude_pretrained_params
and the usage can refer to docs/TRANSFER_LEARNING.md
""" """
if is_url(path): if is_url(path):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册