You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2.1 KiB

使用教程——训练模型

本目录下整理了使用PaddleRS训练模型的示例代码,代码中均提供了示例数据的自动下载,并均使用单张GPU卡进行训练。

代码 模型任务 数据
object_detection/ppyolo.py 目标检测PPYOLO 昆虫检测
semantic_segmentation/deeplabv3p_resnet50_vd.py 语义分割DeepLabV3 视盘分割

环境准备

  • 版本要求:PaddlePaddle>=2.1.0

开始训练

  • 修改tutorials/train/semantic_segmentation/deeplabv3p_resnet50_vd.py中sys.path路径
sys.path.append("your/PaddleRS/path")
  • 在安装PaddleRS后,使用如下命令开始训练,代码会自动下载训练数据, 并均使用单张GPU卡进行训练。
export CUDA_VISIBLE_DEVICES=0
python tutorials/train/semantic_segmentation/deeplabv3p_resnet50_vd.py
  • 若需使用多张GPU卡进行训练,例如使用2张卡时执行:
python -m paddle.distributed.launch --gpus 0,1 tutorials/train/semantic_segmentation/deeplabv3p_resnet50_vd.py

使用多卡时,参考训练参数调整调整学习率和批量大小。

VisualDL可视化训练指标

在模型训练过程,在train函数中,将use_vdl设为True,则训练过程会自动将训练日志以VisualDL的格式打点在save_dir(用户自己指定的路径)下的vdl_log目录,用户可以使用如下命令启动VisualDL服务,查看可视化指标

visualdl --logdir output/deeplabv3p_resnet50_vd/vdl_log --port 8001

服务启动后,使用浏览器打开 https://0.0.0.0:8001https://localhost:8001