Ver código fonte

add 200th seg (#2081)

* add 200th seg

* add 200th seg

* add 200th seg

* add 200th seg

* add 200th seg
Sunflower7788 1 ano atrás
pai
commit
c99153df50

+ 1 - 1
README.md

@@ -100,7 +100,7 @@ PaddleX 3.0 覆盖了 16 条产业级模型产线,其中 9 条基础产线可
     <td rowspan="2">通用语义分割</td>
     <td>语义分割</td>
     <td>OCRNet_HRNet-W48<br/>OCRNet_HRNet-W18<br/>PP-LiteSeg-T<details>
-    <summary><b>more</b></summary><br/>Deeplabv3-R50<br/>Deeplabv3-R101<br/>Deeplabv3_Plus-R50<br/>Deeplabv3_Plus-R101<br/>SeaFormer_tiny<br/
+    <summary><b>more</b></summary><br/>PP-LiteSeg-B<br/>Deeplabv3-R50<br/>Deeplabv3-R101<br/>Deeplabv3_Plus-R50<br/>Deeplabv3_Plus-R101<br/>SeaFormer_tiny<br/
     >SeaFormer_small<br/>SeaFormer_base<br/>SeaFormer_large<br/
     >SegFormer-B0<br/>SegFormer-B1<br/>SegFormer-B2<br/
     >SegFormer-B3<br/>SegFormer-B4<br/>SegFormer-B5</details></td>

+ 4 - 3
docs/tutorials/models/support_model_list.md

@@ -144,9 +144,9 @@
 | PP-YOLOE_plus-M | [PP-YOLOE_plus-M.yaml](../../../paddlex/configs/object_detection/PP-YOLOE_plus-M.yaml)|
 | PP-YOLOE_plus-L | [PP-YOLOE_plus-L.yaml](../../../paddlex/configs/object_detection/PP-YOLOE_plus-L.yaml)|
 | PP-YOLOE_plus-X | [PP-YOLOE_plus-X.yaml](../../../paddlex/configs/object_detection/PP-YOLOE_plus-X.yaml)|
-| PP-YOLOE+_SOD-L | [PP-YOLOE+_SOD-L.yaml](../../../paddlex/configs/small_object_detection/PP-YOLOE+_SOD-L.yaml)|
-| PP-YOLOE+_SOD-S | [PP-YOLOE+_SOD-S.yaml](../../../paddlex/configs/small_object_detection/PP-YOLOE+_SOD-S.yaml)|
-| PP-YOLOE+_SOD-largesize-L | [PP-YOLOE+_SOD-largesize-L.yaml](../../../paddlex/configs/small_object_detection/PP-YOLOE+_SOD-largesize-L.yaml)|
+| PP-YOLOE_plus_SOD-L | [PP-YOLOE_plus_SOD-L.yaml](../../../paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-L.yaml)|
+| PP-YOLOE_plus_SOD-S | [PP-YOLOE_plus_SOD-S.yaml](../../../paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-S.yaml)|
+| PP-YOLOE_plus_SOD-largesize-L | [PP-YOLOE_plus_SOD-largesize-L.yaml](../../../paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml)|
 ### 2. RT-DETR 系列
 | 模型名称 | config |
 | :--- | :---: |
@@ -239,6 +239,7 @@
 | 模型名称 | config |
 | :--- | :---: |
 | PP-LiteSeg-T | [PP-LiteSeg-T.yaml](../../../paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml)|
+| PP-LiteSeg-B | [PP-LiteSeg-B.yaml](../../../paddlex/configs/semantic_segmentation/PP-LiteSeg-B.yaml)|
 ### 4.SegFormer 系列
 | 模型名称 | config |
 | :--- | :---: |

+ 41 - 0
paddlex/configs/semantic_segmentation/PP-LiteSeg-B.yaml

@@ -0,0 +1,41 @@
+Global:
+  model: PP-LiteSeg-B
+  mode: check_dataset # check_dataset/train/evaluate/predict
+  dataset_dir: "/paddle/dataset/paddlex/seg/seg_optic_examples"
+  device: gpu:0,1,2,3
+  output: "output"
+
+CheckDataset:
+  convert: 
+    enable: False
+    src_dataset_type: null
+  split: 
+    enable: False
+    train_percent: null
+    val_percent: null
+
+Train:
+  epochs_iters: 500
+  num_classes: 2
+  batch_size: 2
+  learning_rate: 0.01
+  pretrain_weight_path: null
+  warmup_steps: 0
+  resume_path: null
+  log_interval: 10
+  eval_interval: 100
+
+Evaluate:
+  weight_path: "output/best_model/model.pdparams"
+  log_interval: 10
+
+Export:
+  weight_path: https://paddleseg.bj.bcebos.com/dygraph/cityscapes/pp_liteseg_stdc2_cityscapes_1024x512_scale0.5_160k/model.pdparams
+
+Predict:
+  batch_size: 1
+  model_dir: "output/best_model/inference"
+  input: "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_002.png"
+
+  kernel_option:
+    run_mode: paddle

+ 1 - 0
paddlex/inference/utils/official_models.py

@@ -162,6 +162,7 @@ PP-ShiTuV2_rec_CLIP_vit_base_infer.tar",
     "PP-ShiTuV2_rec_CLIP_vit_large": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/\
 PP-ShiTuV2_rec_CLIP_vit_large_infer.tar",
     "PP-LiteSeg-T": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/PP-LiteSeg-T_infer.tar",
+    "PP-LiteSeg-B": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/PP-LiteSeg-B_infer.tar",
     "OCRNet_HRNet-W48": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/OCRNet_HRNet-W48_infer.tar",
     "OCRNet_HRNet-W18": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/OCRNet_HRNet-W18_infer.tar",
     "SegFormer-B0": "https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0b1_v2/SegFormer-B0_infer.tar",

+ 1 - 0
paddlex/modules/semantic_segmentation/model_list.py

@@ -21,6 +21,7 @@ MODELS = [
     "OCRNet_HRNet-W48",
     "OCRNet_HRNet-W18",
     "PP-LiteSeg-T",
+    "PP-LiteSeg-B",
     "SegFormer-B0",
     "SegFormer-B1",
     "SegFormer-B2",

+ 55 - 0
paddlex/repo_apis/PaddleSeg_api/configs/PP-LiteSeg-B.yaml

@@ -0,0 +1,55 @@
+batch_size: 2
+iters: 80000
+
+train_dataset:
+  type: Dataset
+  dataset_root: datasets/Cityscapes
+  train_path: datasets/Cityscapes/train.txt
+  num_classes: 19
+  transforms:
+    - type: ResizeStepScaling
+      min_scale_factor: 0.5
+      max_scale_factor: 2.0
+      scale_step_size: 0.25
+    - type: RandomPaddingCrop
+      crop_size: [512, 512]
+    - type: RandomHorizontalFlip
+    - type: RandomDistort
+      brightness_range: 0.4
+      contrast_range: 0.4
+      saturation_range: 0.4
+    - type: Normalize
+  mode: train
+
+val_dataset:
+  type: Dataset
+  dataset_root: datasets/Cityscapes
+  val_path: datasets/Cityscapes/val.txt
+  num_classes: 19
+  transforms:
+    - type: Normalize
+  mode: val
+
+model:
+  type: PPLiteSeg
+  backbone:
+    type: STDC2
+    pretrained: https://bj.bcebos.com/paddleseg/dygraph/PP_STDCNet2.tar.gz
+
+optimizer: 
+  type: SGD
+  momentum: 0.9
+  weight_decay: 4.0e-5
+
+lr_scheduler:
+  type: PolynomialDecay
+  learning_rate: 0.01
+  end_lr: 0
+  power: 0.9
+
+loss:
+  types:
+    - type: CrossEntropyLoss
+    - type: CrossEntropyLoss
+    - type: CrossEntropyLoss
+  coef: [1, 1, 1]

+ 23 - 0
paddlex/repo_apis/PaddleSeg_api/seg/register.py

@@ -80,6 +80,29 @@ register_model_info(
     }
 )
 
+# PP-LiteSeg
+register_model_info(
+    {
+        "model_name": "PP-LiteSeg-B",
+        "suite": "Seg",
+        "config_path": osp.join(PDX_CONFIG_DIR, "PP-LiteSeg-B.yaml"),
+        "supported_apis": ["train", "evaluate", "predict", "export"],
+        "supported_train_opts": {
+            "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
+            "dy2st": True,
+            "amp": ["O1", "O2"],
+        },
+        "supported_evaluate_opts": {
+            "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
+            "amp": [],
+        },
+        "supported_predict_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
+        "supported_infer_opts": {"device": ["cpu", "gpu", "xpu", "npu", "mlu"]},
+        "supported_dataset_types": [],
+        "hpi_config_path": HPI_CONFIG_DIR / "PP-LiteSeg-B.yaml",
+    }
+)
+
 # seaformer
 register_model_info(
     {

+ 34 - 0
paddlex/utils/hpi_configs/PP-LiteSeg-B.yaml

@@ -0,0 +1,34 @@
+Hpi:
+  backend_config:
+    onnx_runtime:
+      cpu_num_threads: 8
+    paddle_infer:
+      cpu_num_threads: 8
+      enable_log_info: false
+    paddle_tensorrt:
+      dynamic_shapes:
+        x:
+        - []
+        - []
+        - []
+      enable_log_info: false
+      max_batch_size: null
+    tensorrt:
+      dynamic_shapes:
+        x:
+        - []
+        - []
+        - []
+      max_batch_size: null
+  selected_backends:
+    cpu: onnx_runtime
+    gpu: tensorrt
+  supported_backends:
+    cpu:
+    - paddle_infer
+    - onnx_runtime
+    gpu:
+    - paddle_infer
+    - paddle_tensorrt
+    - onnx_runtime
+    - tensorrt