Tutorials - Model Training

May 8, 2023 · View on GitHub

简体中文 | English

Tutorials - Model Training

Sample code using the PaddleRS training model is curated in this directory. The code provides automatic downloading of sample data, and uses GPU to train the model.

Sample Code PathTaskModel
change_detection/bit.pyChange DetectionBIT
change_detection/cdnet.pyChange DetectionCDNet
change_detection/changeformer.pyChange DetectionChangeFormer
change_detection/dsamnet.pyChange DetectionDSAMNet
change_detection/dsifn.pyChange DetectionDSIFN
change_detection/fc_ef.pyChange DetectionFC-EF
change_detection/fc_siam_conc.pyChange DetectionFC-Siam-conc
change_detection/fc_siam_diff.pyChange DetectionFC-Siam-diff
change_detection/fccdn.pyChange DetectionFCCDN
change_detection/p2v.pyChange DetectionP2V-CD
change_detection/snunet.pyChange DetectionSNUNet
change_detection/stanet.pyChange DetectionSTANet
classification/condensenetv2.pyScene ClassificationCondenseNet V2
classification/hrnet.pyScene ClassificationHRNet
classification/mobilenetv3.pyScene ClassificationMobileNetV3
classification/resnet50_vd.pyScene ClassificationResNet50-vd
image_restoration/drn.pyImage RestorationDRN
image_restoration/esrgan.pyImage RestorationESRGAN
image_restoration/lesrcnn.pyImage RestorationLESRCNN
object_detection/faster_rcnn.pyObject DetectionFaster R-CNN
object_detection/fcosr.pyObject DetectionFCOSR
object_detection/ppyolo.pyObject DetectionPP-YOLO
object_detection/ppyolo_tiny.pyObject DetectionPP-YOLO Tiny
object_detection/ppyolov2.pyObject DetectionPP-YOLOv2
object_detection/yolov3.pyObject DetectionYOLOv3
semantic_segmentation/bisenetv2.pyImage SegmentationBiSeNet V2
semantic_segmentation/deeplabv3p.pyImage SegmentationDeepLab V3+
semantic_segmentation/factseg.pyImage SegmentationFactSeg
semantic_segmentation/farseg.pyImage SegmentationFarSeg
semantic_segmentation/fast_scnn.pyImage SegmentationFast-SCNN
semantic_segmentation/hrnet.pyImage SegmentationHRNet
semantic_segmentation/unet.pyImage SegmentationUNet

Start Training

  • After PaddleRS is installed, run the following commands to launch training with a single GPU. The script will automatically download the training data. Take DeepLab V3+ image segmentation model as an example:
# Specifies the GPU device number to be used
export CUDA_VISIBLE_DEVICES=0
python tutorials/train/semantic_segmentation/deeplabv3p.py
  • If multiple GPUs are required for training, for example, two graphics cards, run the following command:
python -m paddle.distributed.launch --gpus 0,1 tutorials/train/semantic_segmentation/deeplabv3p.py

Visualize Training Metrics via VisualDL

Set the use_vdl argument passed to the train() method to True, and then the training log will be automatically saved in VisualDL format in a subdirectory named vdl_log under the directory specified by save_dir (a user-specified path) during the model training process. You can run the following command to start the VisualDL service and view the indicators and metrics. We also take DeepLab V3+ as an example:

# The specified port number is 8001
visualdl --logdir output/deeplabv3p/vdl_log --port 8001

Once the service is started, open https://0.0.0.0:8001 or https://localhost:8001 in your browser to access the VisualDL page.