diff --git a/doc/doc_ch/detection.md b/doc/doc_ch/detection.md index 2bca1b1db1fe235c10215a0ab5ce8944aa42019c..a31907015de3c6a119764917893ade29a0ff5493 100644 --- a/doc/doc_ch/detection.md +++ b/doc/doc_ch/detection.md @@ -73,12 +73,15 @@ tar -xf ./pretrain_models/MobileNetV3_large_x0_5_pretrained.tar ./pretrain_model *如果您安装的是cpu版本,请将配置文件中的 `use_gpu` 字段修改为false* ```shell -# 训练 mv3_db 模型,并将训练日志保存为 tain_det.log +# 单机单卡训练 mv3_db 模型 python3 tools/train.py -c configs/det/det_mv3_db.yml \ - -o Global.pretrain_weights=./pretrain_models/MobileNetV3_large_x0_5_pretrained/ \ - 2>&1 | tee train_det.log + -o Global.pretrain_weights=./pretrain_models/MobileNetV3_large_x0_5_pretrained/ +# 单机多卡训练,通过 --select_gpus 参数设置使用的GPU ID; +python3 -m paddle.distributed.launch --selected_gpus '0,1,2,3' tools/train.py -c configs/det/det_mv3_db.yml \ + -o Global.pretrain_weights=./pretrain_models/MobileNetV3_large_x0_5_pretrained/ ``` + 上述指令中,通过-c 选择训练使用configs/det/det_db_mv3.yml配置文件。 有关配置文件的详细解释,请参考[链接](./config.md)。 @@ -92,6 +95,8 @@ python3 tools/train.py -c configs/det/det_mv3_db.yml -o Optimizer.base_lr=0.0001 如果训练程序中断,如果希望加载训练中断的模型从而恢复训练,可以通过指定Global.checkpoints指定要加载的模型路径: ```shell python3 tools/train.py -c configs/det/det_mv3_db.yml -o Global.checkpoints=./your/trained/model + + ``` **注意**:`Global.checkpoints`的优先级高于`Global.pretrain_weights`的优先级,即同时指定两个参数时,优先加载`Global.checkpoints`指定的模型,如果`Global.checkpoints`指定的模型路径有误,会加载`Global.pretrain_weights`指定的模型。 diff --git a/doc/doc_en/detection_en.md b/doc/doc_en/detection_en.md index 7f1fc2aab2551516e790e8097fd1564cee71cdac..83e949344f1821aae2dcb57911aff7173246076f 100644 --- a/doc/doc_en/detection_en.md +++ b/doc/doc_en/detection_en.md @@ -64,7 +64,7 @@ tar -xf ./pretrain_models/MobileNetV3_large_x0_5_pretrained.tar ./pretrain_model #### START TRAINING *If CPU version installed, please set the parameter `use_gpu` to `false` in the configuration.* ```shell -python3 tools/train.py -c configs/det/det_mv3_db.yml 2>&1 | tee train_det.log +python3 tools/train.py -c configs/det/det_mv3_db.yml ``` In the above instruction, use `-c` to select the training to use the `configs/det/det_db_mv3.yml` configuration file. @@ -72,7 +72,12 @@ For a detailed explanation of the configuration file, please refer to [config](. You can also use `-o` to change the training parameters without modifying the yml file. For example, adjust the training learning rate to 0.0001 ```shell +# single GPU training python3 tools/train.py -c configs/det/det_mv3_db.yml -o Optimizer.base_lr=0.0001 + +# multi-GPU training +# Set the GPU ID used by the '--select_gpus' parameter; +python3 -m paddle.distributed.launch --selected_gpus '0,1,2,3' tools/train.py -c configs/det/det_mv3_db.yml -o Optimizer.base_lr=0.0001 ``` #### load trained model and continue training