Bladeren bron

update some wrong links in tutorials and examples

FlyingQianMM 4 jaren geleden
bovenliggende
commit
3cfcb1f1a8

+ 1 - 1
examples/industrial_quality_inspection/train_yolov3.py

@@ -45,7 +45,7 @@ num_classes = len(train_dataset.labels)
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-yolov3
 model = pdx.det.YOLOv3(num_classes=num_classes, backbone='MobileNetV3_large')
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#train
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id1
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=400,

+ 1 - 1
examples/meter_reader/train_detection.py

@@ -44,7 +44,7 @@ eval_dataset = pdx.datasets.CocoDetection(
 # 浏览器打开 https://0.0.0.0:8001即可
 # 其中0.0.0.0为本机访问,如为远程服务, 改成相应机器IP
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/latest/apis/models/detection.html#yolov3
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-yolov3
 num_classes = len(train_dataset.labels)
 model = pdx.det.YOLOv3(
     num_classes=num_classes, backbone='DarkNet53', label_smooth=True)

+ 2 - 2
examples/meter_reader/train_segmentation.py

@@ -21,7 +21,7 @@ eval_transforms = transforms.Compose([
     transforms.Normalize(),
 ])
 # 定义训练和验证所用的数据集
-# API说明: https://paddlex.readthedocs.io/zh_CN/latest/apis/datasets/semantic_segmentation.html#segdataset
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/datasets.html#paddlex-datasets-segdataset
 train_dataset = pdx.datasets.SegDataset(
     data_dir='meter_seg/',
     file_list='meter_seg/train.txt',
@@ -40,7 +40,7 @@ eval_dataset = pdx.datasets.SegDataset(
 # 浏览器打开 https://0.0.0.0:8001即可
 # 其中0.0.0.0为本机访问,如为远程服务, 改成相应机器IP
 #
-# API说明: https://paddlex.readthedocs.io/zh_CN/latest/apis/models/semantic_segmentation.html#deeplabv3p
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/semantic_segmentation.html#paddlex-seg-deeplabv3p
 model = pdx.seg.DeepLabv3p(
     num_classes=len(train_dataset.labels), backbone='Xception65')
 model.train(

+ 55 - 0
tutorials/train/image_classification/mobilenetv3_large.py

@@ -0,0 +1,55 @@
+# 环境变量配置,用于控制是否使用GPU
+# 说明文档:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html#gpu
+import os
+os.environ['CUDA_VISIBLE_DEVICES'] = '0'
+
+from paddlex.cls import transforms
+import paddlex as pdx
+
+# 下载和解压蔬菜分类数据集
+veg_dataset = 'https://bj.bcebos.com/paddlex/datasets/vegetables_cls.tar.gz'
+pdx.utils.download_and_decompress(veg_dataset, path='./')
+
+# 定义训练和验证时的transforms
+# API说明https://paddlex.readthedocs.io/zh_CN/develop/apis/transforms/cls_transforms.html
+train_transforms = transforms.Compose([
+    transforms.RandomCrop(crop_size=224), transforms.RandomHorizontalFlip(),
+    transforms.Normalize()
+])
+eval_transforms = transforms.Compose([
+    transforms.ResizeByShort(short_size=256),
+    transforms.CenterCrop(crop_size=224), transforms.Normalize()
+])
+
+# 定义训练和验证所用的数据集
+# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/datasets.html#paddlex-datasets-imagenet
+train_dataset = pdx.datasets.ImageNet(
+    data_dir='vegetables_cls',
+    file_list='vegetables_cls/train_list.txt',
+    label_list='vegetables_cls/labels.txt',
+    transforms=train_transforms,
+    shuffle=True)
+eval_dataset = pdx.datasets.ImageNet(
+    data_dir='vegetables_cls',
+    file_list='vegetables_cls/val_list.txt',
+    label_list='vegetables_cls/labels.txt',
+    transforms=eval_transforms)
+
+# 初始化模型,并进行训练
+# 可使用VisualDL查看训练指标
+# VisualDL启动方式: visualdl --logdir output/mobilenetv2/vdl_log --port 8001
+# 浏览器打开 https://0.0.0.0:8001即可
+# 其中0.0.0.0为本机访问,如为远程服务, 改成相应机器IP
+model = pdx.cls.MobileNetV3_large(num_classes=len(train_dataset.labels))
+
+# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/models/classification.html#train
+# 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
+model.train(
+    num_epochs=10,
+    train_dataset=train_dataset,
+    train_batch_size=32,
+    eval_dataset=eval_dataset,
+    lr_decay_epochs=[4, 6, 8],
+    learning_rate=0.025,
+    save_dir='output/mobilenetv3_large',
+    use_vdl=True)

+ 1 - 1
tutorials/train/image_classification/mobilenetv3_small_ssld.py

@@ -39,7 +39,7 @@ eval_dataset = pdx.datasets.ImageNet(
 # 可使用VisualDL查看训练指标,参考https://paddlex.readthedocs.io/zh_CN/develop/train/visualdl.html
 model = pdx.cls.MobileNetV3_small_ssld(num_classes=len(train_dataset.labels))
 
-# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/datasets.html#paddlex-datasets-imagenet
+# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/models/classification.html#train
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=10,

+ 52 - 0
tutorials/train/image_classification/resnet50_vd.py

@@ -0,0 +1,52 @@
+# 环境变量配置,用于控制是否使用GPU
+# 说明文档:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html#gpu
+import os
+os.environ['CUDA_VISIBLE_DEVICES'] = '0'
+
+from paddlex.cls import transforms
+import paddlex as pdx
+
+# 下载和解压蔬菜分类数据集
+veg_dataset = 'https://bj.bcebos.com/paddlex/datasets/vegetables_cls.tar.gz'
+pdx.utils.download_and_decompress(veg_dataset, path='./')
+
+# 定义训练和验证时的transforms
+# API说明https://paddlex.readthedocs.io/zh_CN/develop/apis/transforms/cls_transforms.html
+train_transforms = transforms.Compose([
+    transforms.RandomCrop(crop_size=224), transforms.RandomHorizontalFlip(),
+    transforms.Normalize()
+])
+eval_transforms = transforms.Compose([
+    transforms.ResizeByShort(short_size=256),
+    transforms.CenterCrop(crop_size=224), transforms.Normalize()
+])
+
+# 定义训练和验证所用的数据集
+# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/datasets.html#paddlex-datasets-imagenet
+train_dataset = pdx.datasets.ImageNet(
+    data_dir='vegetables_cls',
+    file_list='vegetables_cls/train_list.txt',
+    label_list='vegetables_cls/labels.txt',
+    transforms=train_transforms,
+    shuffle=True)
+eval_dataset = pdx.datasets.ImageNet(
+    data_dir='vegetables_cls',
+    file_list='vegetables_cls/val_list.txt',
+    label_list='vegetables_cls/labels.txt',
+    transforms=eval_transforms)
+
+# 初始化模型,并进行训练
+# 可使用VisualDL查看训练指标,参考https://paddlex.readthedocs.io/zh_CN/develop/train/visualdl.html
+model = pdx.cls.ResNet50_vd(num_classes=len(train_dataset.labels))
+
+# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/models/classification.html#train
+# 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
+model.train(
+    num_epochs=10,
+    train_dataset=train_dataset,
+    train_batch_size=32,
+    eval_dataset=eval_dataset,
+    lr_decay_epochs=[4, 6, 8],
+    learning_rate=0.025,
+    save_dir='output/resnet50_vd_ssld',
+    use_vdl=True)

+ 1 - 1
tutorials/train/object_detection/faster_rcnn_hrnet_fpn.py

@@ -45,7 +45,7 @@ num_classes = len(train_dataset.labels) + 1
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-fasterrcnn
 model = pdx.det.FasterRCNN(num_classes=num_classes, backbone='HRNet_W18')
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id1
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id5
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=12,

+ 1 - 1
tutorials/train/object_detection/faster_rcnn_r18_fpn.py

@@ -47,7 +47,7 @@ num_classes = len(train_dataset.labels) + 1
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-fasterrcnn
 model = pdx.det.FasterRCNN(num_classes=num_classes, backbone='ResNet18')
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id1
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id5
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=12,

+ 1 - 1
tutorials/train/object_detection/faster_rcnn_r50_fpn.py

@@ -47,7 +47,7 @@ num_classes = len(train_dataset.labels) + 1
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-fasterrcnn
 model = pdx.det.FasterRCNN(num_classes=num_classes, backbone='ResNet50')
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id1
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id5
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=12,

+ 1 - 1
tutorials/train/object_detection/ppyolo.py

@@ -42,7 +42,7 @@ eval_dataset = pdx.datasets.VOCDetection(
 # 可使用VisualDL查看训练指标,参考https://paddlex.readthedocs.io/zh_CN/develop/train/visualdl.html
 num_classes = len(train_dataset.labels)
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-yolov3
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-ppyolo
 model = pdx.det.PPYOLO(num_classes=num_classes)
 
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#train

+ 1 - 1
tutorials/train/object_detection/yolov3_darknet53.py

@@ -45,7 +45,7 @@ num_classes = len(train_dataset.labels)
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-yolov3
 model = pdx.det.YOLOv3(num_classes=num_classes, backbone='DarkNet53')
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#train
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id1
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=270,

+ 1 - 1
tutorials/train/object_detection/yolov3_mobilenetv1.py

@@ -50,7 +50,7 @@ num_classes = len(train_dataset.labels)
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-yolov3
 model = pdx.det.YOLOv3(num_classes=num_classes, backbone='MobileNetV1')
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#train
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id1
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=270,

+ 1 - 1
tutorials/train/object_detection/yolov3_mobilenetv3.py

@@ -45,7 +45,7 @@ num_classes = len(train_dataset.labels)
 # API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#paddlex-det-yolov3
 model = pdx.det.YOLOv3(num_classes=num_classes, backbone='MobileNetV3_large')
 
-# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#train
+# API说明: https://paddlex.readthedocs.io/zh_CN/develop/apis/models/detection.html#id1
 # 各参数介绍与调整说明:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html
 model.train(
     num_epochs=270,

+ 1 - 1
tutorials/train/semantic_segmentation/unet.py

@@ -40,7 +40,7 @@ eval_dataset = pdx.datasets.SegDataset(
 # 可使用VisualDL查看训练指标,参考https://paddlex.readthedocs.io/zh_CN/develop/train/visualdl.html
 num_classes = len(train_dataset.labels)
 
-# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/models/semantic_segmentation.html#paddlex-seg-deeplabv3p
+# API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/models/semantic_segmentation.html#paddlex-seg-unet
 model = pdx.seg.UNet(num_classes=num_classes)
 
 # API说明:https://paddlex.readthedocs.io/zh_CN/develop/apis/models/semantic_segmentation.html#train