Skip to content

Commit 43f56a5

Browse files
authored
Merge pull request #78 from LielinJiang/dianbiao_contrib
Add mechanical meter to contrib
2 parents 6e99158 + 7bc19a1 commit 43f56a5

7 files changed

+126
-6
lines changed

configs/unet_mechanical_meter.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
EVAL_CROP_SIZE: (2049, 1537) # (width, height), for unpadding rangescaling and stepscaling
2+
TRAIN_CROP_SIZE: (769, 769) # (width, height), for unpadding rangescaling and stepscaling
3+
AUG:
4+
AUG_METHOD: u"stepscaling" # choice unpadding rangescaling and stepscaling
5+
FIX_RESIZE_SIZE: (640, 640) # (width, height), for unpadding
6+
INF_RESIZE_VALUE: 500 # for rangescaling
7+
MAX_RESIZE_VALUE: 600 # for rangescaling
8+
MIN_RESIZE_VALUE: 400 # for rangescaling
9+
MAX_SCALE_FACTOR: 2.0 # for stepscaling
10+
MIN_SCALE_FACTOR: 0.5 # for stepscaling
11+
SCALE_STEP_SIZE: 0.25 # for stepscaling
12+
MIRROR: True
13+
RICH_CROP:
14+
ENABLE: False
15+
16+
BATCH_SIZE: 2
17+
MEAN: [0.5, 0.5, 0.5]
18+
STD: [0.5, 0.5, 0.5]
19+
20+
DATALOADER:
21+
BUF_SIZE: 256
22+
NUM_WORKERS: 4
23+
DATASET:
24+
DATA_DIR: "./dataset/mini_mechanical_industry_meter_data/"
25+
IMAGE_TYPE: "rgb" # choice rgb or rgba
26+
NUM_CLASSES: 5
27+
TEST_FILE_LIST: "./dataset/mini_mechanical_industry_meter_data/val_mini.txt"
28+
TEST_TOTAL_IMAGES: 8
29+
TRAIN_FILE_LIST: "./dataset/mini_mechanical_industry_meter_data/train_mini.txt"
30+
TRAIN_TOTAL_IMAGES: 64
31+
VAL_FILE_LIST: "./dataset/mini_mechanical_industry_meter_data/val_mini.txt"
32+
VAL_TOTAL_IMAGES: 8
33+
SEPARATOR: "|"
34+
IGNORE_INDEX: 255
35+
36+
FREEZE:
37+
MODEL_FILENAME: "__model__"
38+
PARAMS_FILENAME: "__params__"
39+
MODEL:
40+
MODEL_NAME: "unet"
41+
DEFAULT_NORM_TYPE: "bn"
42+
TEST:
43+
TEST_MODEL: "./saved_model/unet_mechanical_meter/final/"
44+
TRAIN:
45+
MODEL_SAVE_DIR: "./saved_model/unet_mechanical_meter/"
46+
PRETRAINED_MODEL_DIR: "./pretrained_model/unet_bn_coco/"
47+
SNAPSHOT_EPOCH: 10
48+
SOLVER:
49+
NUM_EPOCHS: 100
50+
LR: 0.001
51+
LR_POLICY: "poly"
52+
OPTIMIZER: "sgd"

contrib/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,37 @@ python -u infer.py --example RoadLine
9999

100100
预测结果:![](imgs/RoadLine.png)
101101

102+
## 工业用表分割
103+
104+
### 1. 模型结构
105+
106+
unet
107+
108+
### 2. 数据准备
109+
110+
cd到PaddleSeg/dataset文件夹下,执行download_mini_mechanical_industry_meter.py
111+
112+
113+
### 3. 训练与评估
114+
115+
```
116+
CUDA_VISIBLE_DEVICES=0 python ./pdseg/train.py --log_steps 10 --cfg configs/unet_mechanical_meter.yaml --use_gpu --do_eval --use_mpio
117+
```
118+
119+
### 4. 可视化
120+
我们提供了一个训练好的模型,点击[链接](https://paddleseg.bj.bcebos.com/models/unet_mechanical_industry_meter.tar),下载后放在PaddleSeg/pretrained_model下
121+
```
122+
CUDA_VISIBLE_DEVICES=0 python ./pdseg/vis.py --cfg configs/unet_mechanical_meter.yaml --use_gpu --vis_dir vis_meter \
123+
TEST.TEST_MODEL "./pretrained_model/unet_gongyeyongbiao/"
124+
```
125+
可视化结果会保存在vis_meter文件夹下
126+
127+
### 5. 可视化结果示例:
128+
129+
原图:![](imgs/1560143028.5_IMG_3091.JPG)
130+
131+
预测结果:![](imgs/1560143028.5_IMG_3091.png)
132+
102133
# 备注
103134

104135
1. 数据及模型路径等详细配置见ACE2P/HumanSeg/RoadLine下的config.py文件
821 KB
Loading
26.1 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import sys
16+
import os
17+
18+
LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
19+
TEST_PATH = os.path.join(LOCAL_PATH, "..", "test")
20+
sys.path.append(TEST_PATH)
21+
22+
from test_utils import download_file_and_uncompress
23+
24+
25+
def download_deepglobe_road_dataset(savepath, extrapath):
26+
url = "https://paddleseg.bj.bcebos.com/dataset/mini_mechanical_industry_meter_data.zip"
27+
download_file_and_uncompress(
28+
url=url, savepath=savepath, extrapath=extrapath)
29+
30+
31+
if __name__ == "__main__":
32+
download_deepglobe_road_dataset(LOCAL_PATH, LOCAL_PATH)
33+
print("Dataset download finish!")

docs/multiple_gpus_train_and_mixed_precision_train.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### 环境要求
44
* PaddlePaddle >= 1.6.0
5-
* NVIDIA NCCL >= 2.4.7,并在Linux环境下运行
5+
* NVIDIA NCCL >= 2.4.7
66

77
环境配置,数据,预训练模型准备等工作请参考[安装说明](./installation.md)[PaddleSeg使用说明](./usage.md)
88

@@ -49,12 +49,13 @@ python -m paddle.distributed.launch pdseg/train.py --use_gpu \
4949

5050
### benchmark
5151

52-
| 模型 | 数据集合 | batch size | number gpu cards | 多进程训练 | 混合精度训练 | 显存占用 | 速度(image/s) | mIoU on val |
53-
|---|---|---|---|---|---|---|---|---|
54-
| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | False | False | 15988 MiB | 17.27 | 79.20 |
55-
| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | False | 15814 MiB | 19.80 | 78.90 |
56-
| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | True | 14922 MiB | 25.84 |79.06|
52+
| 模型 | 数据集合 | batch size | number gpu cards | 多进程训练 | 混合精度训练 | 速度(image/s) | mIoU on val |
53+
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
54+
| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | False | False | 17.27 | 79.20 |
55+
| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | False | 19.80 | 78.90 |
56+
| DeepLabv3+/Xception65/bn | Cityscapes | 16 | 4 | True | True | 25.84 |79.06|
5757

58+
测试环境:python3.7.3,paddle1.6.0,cuda10,cudnn7.6.2,v100。
5859

5960
### 参考
6061

turtorial/finetune_icnet.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
* 本教程的所有命令都基于PaddleSeg主目录进行执行
88

9+
* 注意 ***`ICNet`*** 不支持在cpu环境上训练和评估
10+
11+
912
## 一. 准备待训练数据
1013

1114
我们提前准备好了一份数据集,通过以下代码进行下载

0 commit comments

Comments
 (0)