diff --git a/PaddleCV/PaddleDetection/docs/GETTING_STARTED.md b/PaddleCV/PaddleDetection/docs/GETTING_STARTED.md index ca3a6df0a7c159c98b6ece8afb4c8aa6b9e242ec..1dd31e0fd0b850ae04b80d4c4c0229900d2452da 100644 --- a/PaddleCV/PaddleDetection/docs/GETTING_STARTED.md +++ b/PaddleCV/PaddleDetection/docs/GETTING_STARTED.md @@ -70,7 +70,10 @@ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \ - 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 export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 diff --git a/PaddleCV/PaddleDetection/docs/GETTING_STARTED_cn.md b/PaddleCV/PaddleDetection/docs/GETTING_STARTED_cn.md index 9bbd12892a3c5f385619c8f85cd13dbb0ec6632c..edf12170f5ad043aa410e560297503abdad1321f 100644 --- a/PaddleCV/PaddleDetection/docs/GETTING_STARTED_cn.md +++ b/PaddleCV/PaddleDetection/docs/GETTING_STARTED_cn.md @@ -71,7 +71,10 @@ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \ - 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 export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 diff --git a/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING.md b/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING.md index 61bc1312364e32b8ecb8d0c0ffb618894e1d6f2b..ec2d38e600e76a2a1238a1c9d988672a8392e42c 100644 --- a/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING.md +++ b/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING.md @@ -6,7 +6,10 @@ In transfer learning, if different dataset and the number of classes is used, th ## 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 export PYTHONPATH=$PYTHONPATH:. diff --git a/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING_cn.md b/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING_cn.md index 255d31857799a4b04558ecb6c84244a1e69f803b..a54210d0aa9ef32096620e1830d49a2b2430b189 100644 --- a/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING_cn.md +++ b/PaddleCV/PaddleDetection/docs/TRANSFER_LEARNING_cn.md @@ -6,7 +6,10 @@ ## 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 export PYTHONPATH=$PYTHONPATH:. diff --git a/PaddleCV/PaddleDetection/ppdet/utils/checkpoint.py b/PaddleCV/PaddleDetection/ppdet/utils/checkpoint.py index d19653494732685fe8eb45aa3d3109e0342df8d0..f5d7c5f56997a34be3cd2f094ea493a32d1784d1 100644 --- a/PaddleCV/PaddleDetection/ppdet/utils/checkpoint.py +++ b/PaddleCV/PaddleDetection/ppdet/utils/checkpoint.py @@ -86,6 +86,8 @@ def load_params(exe, prog, path, ignore_params=[]): prog (fluid.Program): load weight to which Program object. path (string): URL string or loca model path. 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):