Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export PYTHONPATH=/path/to/models:$PYTHONPATH

### 目标检测

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

| 模型 | mAP<br>@5-95 |
| --- | :---: |
Expand All @@ -81,21 +81,27 @@ export PYTHONPATH=/path/to/models:$PYTHONPATH
| retinanet-resx101-coco-2x-800size | 42.7 |
| faster-rcnn-res50-coco-1x-800size | 38.0 |
| faster-rcnn-res101-coco-2x-800size | 42.5 |
| faster-rcnn-resx101-coco-2x-800size | 44.7 * |
| faster-rcnn-resx101-coco-2x-800size | 43.6 |
| fcos-res50-coco-1x-800size | 39.7 |
| fcos-res101-coco-2x-800size | 44.1 |
| fcos-resx101-coco-2x-800size | 39.7 * |
| fcos-resx101-coco-2x-800size | 44.9 |
| atss-res50-coco-1x-800size | 40.1 |
| atss-res101-coco-2x-800size | 44.5 |
| atss-resx101-coco-2x-800size | 45.9 |

### 图像分割

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

| 模型 | Backbone | mIoU_single | mIoU_multi |
| -- | :--: | :--: | :--: |
| Deeplabv3plus | Resnet101 | 79.0 | 79.8 |
| 模型 | mIoU |
| --- | :--: |
| deeplabv3plus-res101-voc-512size | 79.5 |

在Cityscapes验证集上的测试结果如下:

| 模型 | mIoU |
| --- | :--: |
| deeplabv3plus-res101-cityscapes-768size | 78.5 |

### 人体关节点检测

Expand Down
17 changes: 11 additions & 6 deletions hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@
)
from official.vision.detection.configs import (
faster_rcnn_res50_coco_1x_800size,
faster_rcnn_res50_coco_1x_800size_syncbn,
faster_rcnn_res101_coco_2x_800size,
faster_rcnn_resx101_coco_2x_800size,
retinanet_res50_coco_1x_800size,
retinanet_res50_coco_1x_800size_syncbn,
retinanet_res101_coco_2x_800size,
retinanet_resx101_coco_2x_800size,
fcos_res50_coco_1x_800size,
fcos_res101_coco_2x_800size,
fcos_resx101_coco_2x_800size,
atss_res50_coco_1x_800size,
atss_res101_coco_2x_800size,
atss_resx101_coco_2x_800size,
)
from official.vision.detection.models import FasterRCNN, RetinaNet
from official.vision.detection.models import FasterRCNN, RetinaNet, FCOS, ATSS
from official.vision.detection.tools.utils import DetEvaluator
from official.vision.keypoints.inference import KeypointEvaluator
from official.vision.keypoints.models import (
Expand All @@ -46,7 +50,8 @@
simplebaseline_res101,
simplebaseline_res152,
)
from official.vision.segmentation.deeplabv3plus import (
DeepLabV3Plus,
deeplabv3plus_res101,
from official.vision.segmentation.configs import (
deeplabv3plus_res101_cityscapes_768size,
deeplabv3plus_res101_voc_512size,
)
from official.vision.segmentation.models import DeepLabV3Plus
Binary file modified official/assets/cat_seg_out.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 12 additions & 7 deletions official/vision/detection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

## 介绍

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

- [RetinaNet](https://arxiv.org/abs/1708.02002)
- [Faster R-CNN](https://arxiv.org/abs/1612.03144)
- [FCOS](https://arxiv.org/abs/1904.01355)
- [ATSS](https://arxiv.org/abs/1912.02424)

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

Expand All @@ -13,10 +18,10 @@
| retinanet-resx101-coco-2x-800size | 42.7 | 2 |
| faster-rcnn-res50-coco-1x-800size | 38.0 | 2 |
| faster-rcnn-res101-coco-2x-800size | 42.5 | 2 |
| faster-rcnn-resx101-coco-2x-800size | 44.7 * | 2 |
| faster-rcnn-resx101-coco-2x-800size | 43.6 | 2 |
| fcos-res50-coco-1x-800size | 39.7 | 2 |
| fcos-res101-coco-2x-800size | 44.1 | 2 |
| fcos-resx101-coco-2x-800size | 39.7 * | 2 |
| fcos-resx101-coco-2x-800size | 44.9 | 2 |
| atss-res50-coco-1x-800size | 40.1 | 2 |
| atss-res101-coco-2x-800size | 44.5 | 2 |
| atss-resx101-coco-2x-800size | 45.9 | 2 |
Expand Down Expand Up @@ -119,7 +124,7 @@ python3 tools/test.py -f configs/retinanet_res50_coco_1x_800size.py -n 8 \

## 参考文献

- [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.
- [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).
- [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.
- [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.
- [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.
- [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.
- [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).
- [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.
8 changes: 6 additions & 2 deletions official/vision/detection/configs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from .faster_rcnn_res50_coco_1x_800size import faster_rcnn_res50_coco_1x_800size
from .faster_rcnn_res50_coco_1x_800size_syncbn import faster_rcnn_res50_coco_1x_800size_syncbn
from .faster_rcnn_res101_coco_2x_800size import faster_rcnn_res101_coco_2x_800size
from .faster_rcnn_resx101_coco_2x_800size import faster_rcnn_resx101_coco_2x_800size
from .retinanet_res50_coco_1x_800size import retinanet_res50_coco_1x_800size
from .retinanet_res50_coco_1x_800size_syncbn import retinanet_res50_coco_1x_800size_syncbn
from .retinanet_res101_coco_2x_800size import retinanet_res101_coco_2x_800size
from .retinanet_resx101_coco_2x_800size import retinanet_resx101_coco_2x_800size
from .fcos_res50_coco_1x_800size import fcos_res50_coco_1x_800size
from .fcos_res101_coco_2x_800size import fcos_res101_coco_2x_800size
from .fcos_resx101_coco_2x_800size import fcos_resx101_coco_2x_800size
from .atss_res50_coco_1x_800size import atss_res50_coco_1x_800size
from .atss_res101_coco_2x_800size import atss_res101_coco_2x_800size
from .atss_resx101_coco_2x_800size import atss_resx101_coco_2x_800size

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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self):

@hub.pretrained(
"https://data.megengine.org.cn/models/weights/"
"faster_rcnn_resx101_coco_2x_800size_44dot7_d03b05b2.pkl"
"faster_rcnn_resx101_coco_2x_800size_43dot6_79fb71a7.pkl"
)
def faster_rcnn_resx101_coco_2x_800size(**kwargs):
r"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self):

@hub.pretrained(
"https://data.megengine.org.cn/models/weights/"
"fcos_resx101_coco_2x_800size_39dot7_313ef718.pkl"
"fcos_resx101_coco_2x_800size_44dot9_37e7b921.pkl"
)
def fcos_resx101_coco_2x_800size(**kwargs):
r"""
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions official/vision/detection/tools/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def main():
cfg.backbone_pretrained = False
model = current_network.Net(cfg)
model.eval()

state_dict = mge.load(args.weight_file)
if "state_dict" in state_dict:
state_dict = state_dict["state_dict"]
Expand Down
3 changes: 1 addition & 2 deletions official/vision/detection/tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ def main():
result_list.append(result_queue.get())
for p in procs:
p.join()

else:
result_list = []

worker(
current_network, weight_file, args.dataset_dir,
None, None, args.ngpus, 0, result_list
None, None, 1, 0, result_list
)

all_results = DetEvaluator.format(result_list, cfg)
Expand Down
Loading