Skip to content

Commit f5d9f0c

Browse files
author
Jianfeng Wang
committed
feat(segmentation): migrate to functional api 1.0 (#69)
1 parent dee546c commit f5d9f0c

28 files changed

+1088
-965
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export PYTHONPATH=/path/to/models:$PYTHONPATH
7272

7373
### 目标检测
7474

75-
目标检测同样是计算机视觉中的常见任务,我们提供了两个经典的目标检测模型[Retinanet](./official/vision/detection/models/retinanet.py)[Faster R-CNN](./official/vision/detection/models/faster_rcnn.py),这两个模型在**COCO验证集**上的测试结果如下
75+
目标检测同样是计算机视觉中的常见任务,我们提供了多个经典的目标检测模型,这些模型在COCO2017验证集上的测试结果如下
7676

7777
| 模型 | mAP<br>@5-95 |
7878
| --- | :---: |
@@ -81,21 +81,27 @@ export PYTHONPATH=/path/to/models:$PYTHONPATH
8181
| retinanet-resx101-coco-2x-800size | 42.7 |
8282
| faster-rcnn-res50-coco-1x-800size | 38.0 |
8383
| faster-rcnn-res101-coco-2x-800size | 42.5 |
84-
| faster-rcnn-resx101-coco-2x-800size | 44.7 * |
84+
| faster-rcnn-resx101-coco-2x-800size | 43.6 |
8585
| fcos-res50-coco-1x-800size | 39.7 |
8686
| fcos-res101-coco-2x-800size | 44.1 |
87-
| fcos-resx101-coco-2x-800size | 39.7 * |
87+
| fcos-resx101-coco-2x-800size | 44.9 |
8888
| atss-res50-coco-1x-800size | 40.1 |
8989
| atss-res101-coco-2x-800size | 44.5 |
9090
| atss-resx101-coco-2x-800size | 45.9 |
9191

9292
### 图像分割
9393

94-
我们也提供了经典的语义分割模型--[Deeplabv3plus](./official/vision/segmentation/)这个模型在**PASCAL VOC验证集**上的测试结果如下
94+
我们也提供了经典的语义分割模型--[DeepLabV3+](./official/vision/segmentation/)这个模型在Pascal VOC2012验证集上的测试结果如下
9595

96-
| 模型 | Backbone | mIoU_single | mIoU_multi |
97-
| -- | :--: | :--: | :--: |
98-
| Deeplabv3plus | Resnet101 | 79.0 | 79.8 |
96+
| 模型 | mIoU |
97+
| --- | :--: |
98+
| deeplabv3plus-res101-voc-512size | 79.5 |
99+
100+
在Cityscapes验证集上的测试结果如下:
101+
102+
| 模型 | mIoU |
103+
| --- | :--: |
104+
| deeplabv3plus-res101-cityscapes-768size | 78.5 |
99105

100106
### 人体关节点检测
101107

hubconf.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@
2929
)
3030
from official.vision.detection.configs import (
3131
faster_rcnn_res50_coco_1x_800size,
32-
faster_rcnn_res50_coco_1x_800size_syncbn,
3332
faster_rcnn_res101_coco_2x_800size,
3433
faster_rcnn_resx101_coco_2x_800size,
3534
retinanet_res50_coco_1x_800size,
36-
retinanet_res50_coco_1x_800size_syncbn,
3735
retinanet_res101_coco_2x_800size,
3836
retinanet_resx101_coco_2x_800size,
37+
fcos_res50_coco_1x_800size,
38+
fcos_res101_coco_2x_800size,
39+
fcos_resx101_coco_2x_800size,
40+
atss_res50_coco_1x_800size,
41+
atss_res101_coco_2x_800size,
42+
atss_resx101_coco_2x_800size,
3943
)
40-
from official.vision.detection.models import FasterRCNN, RetinaNet
44+
from official.vision.detection.models import FasterRCNN, RetinaNet, FCOS, ATSS
4145
from official.vision.detection.tools.utils import DetEvaluator
4246
from official.vision.keypoints.inference import KeypointEvaluator
4347
from official.vision.keypoints.models import (
@@ -46,7 +50,8 @@
4650
simplebaseline_res101,
4751
simplebaseline_res152,
4852
)
49-
from official.vision.segmentation.deeplabv3plus import (
50-
DeepLabV3Plus,
51-
deeplabv3plus_res101,
53+
from official.vision.segmentation.configs import (
54+
deeplabv3plus_res101_cityscapes_768size,
55+
deeplabv3plus_res101_voc_512size,
5256
)
57+
from official.vision.segmentation.models import DeepLabV3Plus

official/assets/cat_seg_out.jpg

458 Bytes
Loading

official/vision/detection/README.md

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

33
## 介绍
44

5-
本目录包含了采用MegEngine实现的经典网络结构,包括[RetinaNet](https://arxiv.org/pdf/1708.02002>)[Faster R-CNN](https://arxiv.org/pdf/1612.03144.pdf)等,同时提供了在COCO2017数据集上的完整训练和测试代码。
5+
本目录包含了采用MegEngine实现的如下经典网络结构,并提供了在COCO2017数据集上的完整训练和测试代码:
6+
7+
- [RetinaNet](https://arxiv.org/abs/1708.02002)
8+
- [Faster R-CNN](https://arxiv.org/abs/1612.03144)
9+
- [FCOS](https://arxiv.org/abs/1904.01355)
10+
- [ATSS](https://arxiv.org/abs/1912.02424)
611

712
网络在COCO2017验证集上的性能和结果如下:
813

@@ -13,10 +18,10 @@
1318
| retinanet-resx101-coco-2x-800size | 42.7 | 2 |
1419
| faster-rcnn-res50-coco-1x-800size | 38.0 | 2 |
1520
| faster-rcnn-res101-coco-2x-800size | 42.5 | 2 |
16-
| faster-rcnn-resx101-coco-2x-800size | 44.7 * | 2 |
21+
| faster-rcnn-resx101-coco-2x-800size | 43.6 | 2 |
1722
| fcos-res50-coco-1x-800size | 39.7 | 2 |
1823
| fcos-res101-coco-2x-800size | 44.1 | 2 |
19-
| fcos-resx101-coco-2x-800size | 39.7 * | 2 |
24+
| fcos-resx101-coco-2x-800size | 44.9 | 2 |
2025
| atss-res50-coco-1x-800size | 40.1 | 2 |
2126
| atss-res101-coco-2x-800size | 44.5 | 2 |
2227
| atss-resx101-coco-2x-800size | 45.9 | 2 |
@@ -119,7 +124,7 @@ python3 tools/test.py -f configs/retinanet_res50_coco_1x_800size.py -n 8 \
119124

120125
## 参考文献
121126

122-
- [Focal Loss for Dense Object Detection](https://arxiv.org/pdf/1708.02002) Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, Piotr Dollár. Proceedings of the IEEE international conference on computer vision. 2017: 2980-2988.
123-
- [Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks](https://arxiv.org/pdf/1506.01497.pdf) S. Ren, K. He, R. Girshick, and J. Sun. In: Neural Information Processing Systems(NIPS)(2015).
124-
- [Feature Pyramid Networks for Object Detection](https://arxiv.org/pdf/1612.03144.pdf) T. Lin, P. Dollár, R. Girshick, K. He, B. Hariharan and S. Belongie. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, 2017, pp. 936-944, doi: 10.1109/CVPR.2017.106.
125-
- [Microsoft COCO: Common Objects in Context](https://arxiv.org/pdf/1405.0312.pdf) Lin, Tsung-Yi and Maire, Michael and Belongie, Serge and Hays, James and Perona, Pietro and Ramanan, Deva and Dollár, Piotr and Zitnick, C Lawrence, Lin T Y, Maire M, Belongie S, et al. European conference on computer vision. Springer, Cham, 2014: 740-755.
127+
- [Microsoft COCO: Common Objects in Context](https://arxiv.org/abs/1405.0312) Lin, Tsung-Yi and Maire, Michael and Belongie, Serge and Hays, James and Perona, Pietro and Ramanan, Deva and Dollár, Piotr and Zitnick, C Lawrence, Lin T Y, Maire M, Belongie S, et al. European conference on computer vision. Springer, Cham, 2014: 740-755.
128+
- [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002) Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, Piotr Dollár. Proceedings of the IEEE international conference on computer vision. 2017: 2980-2988.
129+
- [Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks](https://arxiv.org/abs/1506.01497) S. Ren, K. He, R. Girshick, and J. Sun. In: Neural Information Processing Systems(NIPS)(2015).
130+
- [Feature Pyramid Networks for Object Detection](https://arxiv.org/abs/1612.03144) T. Lin, P. Dollár, R. Girshick, K. He, B. Hariharan and S. Belongie. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, 2017, pp. 936-944, doi: 10.1109/CVPR.2017.106.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
from .faster_rcnn_res50_coco_1x_800size import faster_rcnn_res50_coco_1x_800size
2-
from .faster_rcnn_res50_coco_1x_800size_syncbn import faster_rcnn_res50_coco_1x_800size_syncbn
32
from .faster_rcnn_res101_coco_2x_800size import faster_rcnn_res101_coco_2x_800size
43
from .faster_rcnn_resx101_coco_2x_800size import faster_rcnn_resx101_coco_2x_800size
54
from .retinanet_res50_coco_1x_800size import retinanet_res50_coco_1x_800size
6-
from .retinanet_res50_coco_1x_800size_syncbn import retinanet_res50_coco_1x_800size_syncbn
75
from .retinanet_res101_coco_2x_800size import retinanet_res101_coco_2x_800size
86
from .retinanet_resx101_coco_2x_800size import retinanet_resx101_coco_2x_800size
7+
from .fcos_res50_coco_1x_800size import fcos_res50_coco_1x_800size
8+
from .fcos_res101_coco_2x_800size import fcos_res101_coco_2x_800size
9+
from .fcos_resx101_coco_2x_800size import fcos_resx101_coco_2x_800size
10+
from .atss_res50_coco_1x_800size import atss_res50_coco_1x_800size
11+
from .atss_res101_coco_2x_800size import atss_res101_coco_2x_800size
12+
from .atss_resx101_coco_2x_800size import atss_resx101_coco_2x_800size
913

1014
_EXCLUDE = {}
1115
__all__ = [k for k in globals().keys() if k not in _EXCLUDE and not k.startswith("_")]

official/vision/detection/configs/faster_rcnn_res50_objects365_1x_800size.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

official/vision/detection/configs/faster_rcnn_resx101_coco_2x_800size.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self):
2424

2525
@hub.pretrained(
2626
"https://data.megengine.org.cn/models/weights/"
27-
"faster_rcnn_resx101_coco_2x_800size_44dot7_d03b05b2.pkl"
27+
"faster_rcnn_resx101_coco_2x_800size_43dot6_79fb71a7.pkl"
2828
)
2929
def faster_rcnn_resx101_coco_2x_800size(**kwargs):
3030
r"""

official/vision/detection/configs/fcos_resx101_coco_2x_800size.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self):
2424

2525
@hub.pretrained(
2626
"https://data.megengine.org.cn/models/weights/"
27-
"fcos_resx101_coco_2x_800size_39dot7_313ef718.pkl"
27+
"fcos_resx101_coco_2x_800size_44dot9_37e7b921.pkl"
2828
)
2929
def fcos_resx101_coco_2x_800size(**kwargs):
3030
r"""

official/vision/detection/configs/retinanet_res50_objects365_1x_800size.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

official/vision/detection/tools/inference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def main():
4040
cfg.backbone_pretrained = False
4141
model = current_network.Net(cfg)
4242
model.eval()
43+
4344
state_dict = mge.load(args.weight_file)
4445
if "state_dict" in state_dict:
4546
state_dict = state_dict["state_dict"]

0 commit comments

Comments
 (0)