diff --git a/configs/unet_mechanical_meter.yaml b/configs/unet_mechanical_meter.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e1bc3a1183d2b435c84ad7b16002a3f604cf85b0 --- /dev/null +++ b/configs/unet_mechanical_meter.yaml @@ -0,0 +1,52 @@ +EVAL_CROP_SIZE: (2049, 1537) # (width, height), for unpadding rangescaling and stepscaling +TRAIN_CROP_SIZE: (769, 769) # (width, height), for unpadding rangescaling and stepscaling +AUG: + AUG_METHOD: u"stepscaling" # choice unpadding rangescaling and stepscaling + FIX_RESIZE_SIZE: (640, 640) # (width, height), for unpadding + INF_RESIZE_VALUE: 500 # for rangescaling + MAX_RESIZE_VALUE: 600 # for rangescaling + MIN_RESIZE_VALUE: 400 # for rangescaling + MAX_SCALE_FACTOR: 2.0 # for stepscaling + MIN_SCALE_FACTOR: 0.5 # for stepscaling + SCALE_STEP_SIZE: 0.25 # for stepscaling + MIRROR: True + RICH_CROP: + ENABLE: False + +BATCH_SIZE: 2 +MEAN: [0.5, 0.5, 0.5] +STD: [0.5, 0.5, 0.5] + +DATALOADER: + BUF_SIZE: 256 + NUM_WORKERS: 4 +DATASET: + DATA_DIR: "./dataset/mini_mechanical_industry_meter_data/" + IMAGE_TYPE: "rgb" # choice rgb or rgba + NUM_CLASSES: 5 + TEST_FILE_LIST: "./dataset/mini_mechanical_industry_meter_data/val_mini.txt" + TEST_TOTAL_IMAGES: 8 + TRAIN_FILE_LIST: "./dataset/mini_mechanical_industry_meter_data/train_mini.txt" + TRAIN_TOTAL_IMAGES: 64 + VAL_FILE_LIST: "./dataset/mini_mechanical_industry_meter_data/val_mini.txt" + VAL_TOTAL_IMAGES: 8 + SEPARATOR: "|" + IGNORE_INDEX: 255 + +FREEZE: + MODEL_FILENAME: "__model__" + PARAMS_FILENAME: "__params__" +MODEL: + MODEL_NAME: "unet" + DEFAULT_NORM_TYPE: "bn" +TEST: + TEST_MODEL: "./saved_model/unet_mechanical_meter/final/" +TRAIN: + MODEL_SAVE_DIR: "./saved_model/unet_mechanical_meter/" + PRETRAINED_MODEL_DIR: "./pretrained_model/unet_bn_coco/" + SNAPSHOT_EPOCH: 10 +SOLVER: + NUM_EPOCHS: 100 + LR: 0.001 + LR_POLICY: "poly" + OPTIMIZER: "sgd" diff --git a/contrib/README.md b/contrib/README.md index 0ff80a5778fc18d183348ac753c7a4ae84698cef..0dbbb9b473500820a919badff3ea21b5b9123bef 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -99,6 +99,37 @@ python -u infer.py --example RoadLine 预测结果:![](imgs/RoadLine.png) +## 工业用表分割 + +### 1. 模型结构 + +unet + +### 2. 数据准备 + +cd到PaddleSeg/dataset文件夹下,执行download_mini_mechanical_industry_meter.py + + +### 3. 训练与评估 + +``` +CUDA_VISIBLE_DEVICES=0 python ./pdseg/train.py --log_steps 10 --cfg configs/unet_mechanical_meter.yaml --use_gpu --do_eval --use_mpio +``` + +### 4. 可视化 +我们提供了一个训练好的模型,点击[链接](https://paddleseg.bj.bcebos.com/models/unet_mechanical_industry_meter.tar),下载后放在PaddleSeg/pretrained_model下 +``` +CUDA_VISIBLE_DEVICES=0 python ./pdseg/vis.py --cfg configs/unet_mechanical_meter.yaml --use_gpu --vis_dir vis_meter \ +TEST.TEST_MODEL "./pretrained_model/unet_gongyeyongbiao/" +``` +可视化结果会保存在vis_meter文件夹下 + +### 5. 可视化结果示例: + + 原图:![](imgs/1560143028.5_IMG_3091.JPG) + + 预测结果:![](imgs/1560143028.5_IMG_3091.png) + # 备注 1. 数据及模型路径等详细配置见ACE2P/HumanSeg/RoadLine下的config.py文件 diff --git a/contrib/imgs/1560143028.5_IMG_3091.JPG b/contrib/imgs/1560143028.5_IMG_3091.JPG new file mode 100644 index 0000000000000000000000000000000000000000..5d9869d29a845297070f0fd625d5a3289a697f4e Binary files /dev/null and b/contrib/imgs/1560143028.5_IMG_3091.JPG differ diff --git a/contrib/imgs/1560143028.5_IMG_3091.png b/contrib/imgs/1560143028.5_IMG_3091.png new file mode 100644 index 0000000000000000000000000000000000000000..440eb76d07d296135f61d59d8f5bc6bae5e3c6a4 Binary files /dev/null and b/contrib/imgs/1560143028.5_IMG_3091.png differ diff --git a/dataset/download_mini_mechanical_industry_meter.py b/dataset/download_mini_mechanical_industry_meter.py new file mode 100644 index 0000000000000000000000000000000000000000..3049df25219df7641990cedd409566779012a08d --- /dev/null +++ b/dataset/download_mini_mechanical_industry_meter.py @@ -0,0 +1,33 @@ +# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import os + +LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) +TEST_PATH = os.path.join(LOCAL_PATH, "..", "test") +sys.path.append(TEST_PATH) + +from test_utils import download_file_and_uncompress + + +def download_deepglobe_road_dataset(savepath, extrapath): + url = "https://paddleseg.bj.bcebos.com/dataset/mini_mechanical_industry_meter_data.zip" + download_file_and_uncompress( + url=url, savepath=savepath, extrapath=extrapath) + + +if __name__ == "__main__": + download_deepglobe_road_dataset(LOCAL_PATH, LOCAL_PATH) + print("Dataset download finish!") diff --git a/docs/multiple_gpus_train_and_mixed_precision_train.md b/docs/multiple_gpus_train_and_mixed_precision_train.md index 2ccc5cde23278c6b7041771bc2c15b83a832695e..b551e75bfc278a38710de0e0a85a06da69a2bce2 100644 --- a/docs/multiple_gpus_train_and_mixed_precision_train.md +++ b/docs/multiple_gpus_train_and_mixed_precision_train.md @@ -2,7 +2,7 @@ ### 环境要求 * PaddlePaddle >= 1.6.0 -* NVIDIA NCCL >= 2.4.7,并在Linux环境下运行 +* NVIDIA NCCL >= 2.4.7 环境配置,数据,预训练模型准备等工作请参考[安装说明](./installation.md),[PaddleSeg使用说明](./usage.md) @@ -49,12 +49,13 @@ python -m paddle.distributed.launch pdseg/train.py --use_gpu \ ### benchmark -| 模型 | 数据集合 | batch size | number gpu cards | 多进程训练 | 混合精度训练 | 显存占用 | 速度(image/s) | mIoU on val | -|---|---|---|---|---|---|---|---|---| -| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | False | False | 15988 MiB | 17.27 | 79.20 | -| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | False | 15814 MiB | 19.80 | 78.90 | -| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | True | 14922 MiB | 25.84 |79.06| +| 模型 | 数据集合 | batch size | number gpu cards | 多进程训练 | 混合精度训练 | 速度(image/s) | mIoU on val | +|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| +| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | False | False | 17.27 | 79.20 | +| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | False | 19.80 | 78.90 | +| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | True | 25.84 |79.06| +测试环境:python3.7.3,paddle1.6.0,cuda10,cudnn7.6.2,v100。 ### 参考 diff --git a/turtorial/finetune_icnet.md b/turtorial/finetune_icnet.md index f1a68e2c75821b5e90592ea82c07170fdc9805d2..00caf4f87f206000bc2dde8440bdbe08ff03f555 100644 --- a/turtorial/finetune_icnet.md +++ b/turtorial/finetune_icnet.md @@ -6,6 +6,9 @@ * 本教程的所有命令都基于PaddleSeg主目录进行执行 +* 注意 ***`ICNet`*** 不支持在cpu环境上训练和评估 + + ## 一. 准备待训练数据 我们提前准备好了一份数据集,通过以下代码进行下载