Skip to content

Commit 63c0390

Browse files
author
Jianfeng Wang
authored
feat(segmentation): Segmentation supports 1.2 (#87)
1 parent 82a2b7c commit 63c0390

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

official/vision/segmentation/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
## 安装和环境配置
2020

21-
本目录下代码基于MegEngine v1.1,在开始运行本目录下的代码之前,请确保按照[README](../../../README.md)进行了正确的环境配置。
21+
本目录下代码基于MegEngine v1.2,在开始运行本目录下的代码之前,请确保按照[README](../../../README.md)进行了正确的环境配置。
2222

2323
## 如何使用
2424

@@ -102,4 +102,4 @@ python3 tools/test.py -f configs/deeplabv3plus_res101_voc_512size.py -n 8 \
102102

103103
## 参考文献
104104

105-
- [Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation](https://arxiv.org/abs/1802.02611) Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. European Conference on Computer Vision (ECCV), 2018.
105+
- [Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation](https://arxiv.org/abs/1802.02611) Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. European Conference on Computer Vision (ECCV), 2018.

official/vision/segmentation/configs/deeplabv3plus_res101_cityscapes_768size.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def deeplabv3plus_res101_cityscapes_768size(**kwargs):
5050
`"Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation"
5151
<https://arxiv.org/abs/1802.02611>`_
5252
"""
53-
return models.DeepLabV3Plus(**kwargs)
53+
cfg = CityscapesConfig()
54+
cfg.backbone_pretrained = False
55+
return models.DeepLabV3Plus(cfg, **kwargs)
5456

5557

5658
Net = models.DeepLabV3Plus

official/vision/segmentation/configs/deeplabv3plus_res101_voc_512size.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def deeplabv3plus_res101_voc_512size(**kwargs):
5151
`"Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation"
5252
<https://arxiv.org/abs/1802.02611>`_
5353
"""
54-
return models.DeepLabV3Plus(**kwargs)
54+
cfg = VOCConfig()
55+
cfg.backbone_pretrained = False
56+
return models.DeepLabV3Plus(cfg, **kwargs)
5557

5658

5759
Net = models.DeepLabV3Plus

official/vision/segmentation/tools/train.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
logger = mge.get_logger(__name__)
2727
logger.setLevel("INFO")
28-
# mge.device.set_prealloc_config(1024, 1024, 512 * 1024 * 1024, 2.0)
2928

3029

3130
def main():

official/vision/segmentation/tools/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import numpy as np
1515

16-
from megengine.data import Sampler
16+
from megengine.data import MapSampler
1717

1818

1919
class AverageMeter:
@@ -57,7 +57,7 @@ def get_config_info(config):
5757
return config_table
5858

5959

60-
class InferenceSampler(Sampler):
60+
class InferenceSampler(MapSampler):
6161
def __init__(self, dataset, batch_size=1, world_size=None, rank=None):
6262
super().__init__(dataset, batch_size, False, None, world_size, rank)
6363
begin = self.num_samples * self.rank

0 commit comments

Comments
 (0)