Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Real-time model ERFNet #960

Merged
merged 16 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
32 changes: 32 additions & 0 deletions configs/_base_/models/fcn_erfnet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# model settings
MengzhangLI marked this conversation as resolved.
Show resolved Hide resolved
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained=None,
backbone=dict(
type='ERFNet',
in_channels=3,
enc_downsample_channels=(16, 64, 128),
enc_num_stages_non_bottleneck=(5, 8),
enc_non_bottleneck_dilations=(2, 4, 8, 16),
enc_non_bottleneck_channels=(64, 128),
dec_upsample_channels=(64, 16),
dec_num_stages_non_bottleneck=(2, 2),
dec_non_bottleneck_channels=(64, 16),
dropout_ratio=0.1,
init_cfg=None),
decode_head=dict(
type='FCNHead',
in_channels=16,
channels=512,
num_convs=2,
concat_input=True,
dropout_ratio=0.1,
num_classes=19,
norm_cfg=norm_cfg,
align_corners=False,
loss_decode=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
# model training and testing settings
train_cfg=dict(),
test_cfg=dict(mode='whole'))
38 changes: 38 additions & 0 deletions configs/erfnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ERFNet: Efficient Residual Factorized ConvNet for Real-time Semantic Segmentation

## Introduction

<!-- [ALGORITHM] -->

<a href="https://github.com/Eromera/erfnet_pytorch">Official Repo</a>

<a href="https://github.com/open-mmlab/mmsegmentation/blob/v0.20.0/mmseg/models/backbones/erfnet.py#L321">Code Snippet</a>

<details>
<summary align="right"><a href="http://www.robesafe.uah.es/personal/eduardo.romera/pdfs/Romera17tits.pdf">ERFNet (T-ITS)</a></summary>

```latex
@article{romera2017erfnet,
title={Erfnet: Efficient residual factorized convnet for real-time semantic segmentation},
author={Romera, Eduardo and Alvarez, Jos{\'e} M and Bergasa, Luis M and Arroyo, Roberto},
journal={IEEE Transactions on Intelligent Transportation Systems},
volume={19},
number={1},
pages={263--272},
year={2017},
publisher={IEEE}
}
```

</details>

## Results and models

### Cityscapes

| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | mIoU | mIoU(ms+flip) | config | download |
| --------- | --------- | --------- | ------: | -------- | -------------- | ----: | ------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| FCN | ERFNet | 512x1024 | 160000 | 16.40 | 2.16 | 71.4 | 72.96 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/erfnet/fcn_erfnet_4x4_512x1024_160k_cityscapes.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/erfnet/fcn_erfnet_4x4_512x1024_160k_cityscapes/fcn_erfnet_4x4_512x1024_160k_cityscapes_20211103_011334-8f691334.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/erfnet/fcn_erfnet_4x4_512x1024_160k_cityscapes/fcn_erfnet_4x4_512x1024_160k_cityscapes_20211103_011334.log.json) |
Note:

- Last deconvolution layer in original paper is replaced by normal `FCN` decoder head and upsampling operation.
MengzhangLI marked this conversation as resolved.
Show resolved Hide resolved
37 changes: 37 additions & 0 deletions configs/erfnet/erfnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Collections:
- Name: erfnet
Metadata:
Training Data:
- Cityscapes
Paper:
URL: http://www.robesafe.uah.es/personal/eduardo.romera/pdfs/Romera17tits.pdf
Title: 'ERFNet: Efficient Residual Factorized ConvNet for Real-time Semantic Segmentation'
README: configs/erfnet/README.md
Code:
URL: https://github.com/open-mmlab/mmsegmentation/blob/v0.20.0/mmseg/models/backbones/erfnet.py#L321
Version: v0.20.0
Converted From:
Code: https://github.com/Eromera/erfnet_pytorch
Models:
- Name: fcn_erfnet_4x4_512x1024_160k_cityscapes
In Collection: erfnet
Metadata:
backbone: ERFNet
crop size: (512,1024)
lr schd: 160000
inference time (ms/im):
- value: 462.96
hardware: V100
backend: PyTorch
batch size: 1
mode: FP32
resolution: (512,1024)
memory (GB): 16.4
Results:
- Task: Semantic Segmentation
Dataset: Cityscapes
Metrics:
mIoU: 71.4
mIoU(ms+flip): 72.96
Config: configs/erfnet/fcn_erfnet_4x4_512x1024_160k_cityscapes.py
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/erfnet/fcn_erfnet_4x4_512x1024_160k_cityscapes/fcn_erfnet_4x4_512x1024_160k_cityscapes_20211103_011334-8f691334.pth
9 changes: 9 additions & 0 deletions configs/erfnet/fcn_erfnet_4x4_512x1024_160k_cityscapes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
_base_ = [
'../_base_/models/fcn_erfnet.py', '../_base_/datasets/cityscapes.py',
MengzhangLI marked this conversation as resolved.
Show resolved Hide resolved
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005)
MengzhangLI marked this conversation as resolved.
Show resolved Hide resolved
data = dict(
samples_per_gpu=4,
workers_per_gpu=4,
)
3 changes: 2 additions & 1 deletion mmseg/models/backbones/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .bisenetv1 import BiSeNetV1
from .bisenetv2 import BiSeNetV2
from .cgnet import CGNet
from .erfnet import ERFNet
from .fast_scnn import FastSCNN
from .hrnet import HRNet
from .icnet import ICNet
Expand All @@ -19,5 +20,5 @@
'ResNet', 'ResNetV1c', 'ResNetV1d', 'ResNeXt', 'HRNet', 'FastSCNN',
'ResNeSt', 'MobileNetV2', 'UNet', 'CGNet', 'MobileNetV3',
'VisionTransformer', 'SwinTransformer', 'MixVisionTransformer',
'BiSeNetV1', 'BiSeNetV2', 'ICNet'
'BiSeNetV1', 'BiSeNetV2', 'ICNet', 'ERFNet'
]
Loading