-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* BiSeNetV2 first commit * BiSeNetV2 unittest * remove pytest * add pytest module * fix ConvModule input name * fix pytest error * fix unittest * refactor * BiSeNetV2 Refactory * fix docstrings and add some small changes * use_sigmoid=False * fix potential bugs about upsampling * Use ConvModule instead * Use ConvModule instead * fix typos * fix typos * fix typos * discard nn.conv2d * discard nn.conv2d * discard nn.conv2d * delete **kwargs * uploading markdown and model * final commit * BiSeNetV2 adding Unittest for its modules * BiSeNetV2 adding Unittest for its modules * BiSeNetV2 adding Unittest for its modules * BiSeNetV2 adding Unittest for its modules * BiSeNetV2 adding Unittest for its modules * BiSeNetV2 adding Unittest for its modules * BiSeNetV2 adding Unittest for its modules * Fix README conflict * Fix unittest problem * Fix unittest problem * BiSeNetV2 * Fixing fps * Fixing typpos * bisenetv2
- Loading branch information
1 parent
29c82ea
commit 4003b8f
Showing
15 changed files
with
952 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
_base_ = './cityscapes.py' | ||
img_norm_cfg = dict( | ||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) | ||
crop_size = (1024, 1024) | ||
train_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='LoadAnnotations'), | ||
dict(type='Resize', img_scale=(2048, 1024), ratio_range=(0.5, 2.0)), | ||
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), | ||
dict(type='RandomFlip', prob=0.5), | ||
dict(type='PhotoMetricDistortion'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255), | ||
dict(type='DefaultFormatBundle'), | ||
dict(type='Collect', keys=['img', 'gt_semantic_seg']), | ||
] | ||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict( | ||
type='MultiScaleFlipAug', | ||
img_scale=(2048, 1024), | ||
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75], | ||
flip=False, | ||
transforms=[ | ||
dict(type='Resize', keep_ratio=True), | ||
dict(type='RandomFlip'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='ImageToTensor', keys=['img']), | ||
dict(type='Collect', keys=['img']), | ||
]) | ||
] | ||
data = dict( | ||
train=dict(pipeline=train_pipeline), | ||
val=dict(pipeline=test_pipeline), | ||
test=dict(pipeline=test_pipeline)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# model settings | ||
norm_cfg = dict(type='SyncBN', requires_grad=True) | ||
model = dict( | ||
type='EncoderDecoder', | ||
pretrained=None, | ||
backbone=dict( | ||
type='BiSeNetV2', | ||
detail_channels=(64, 64, 128), | ||
semantic_channels=(16, 32, 64, 128), | ||
semantic_expansion_ratio=6, | ||
bga_channels=128, | ||
out_indices=(0, 1, 2, 3, 4), | ||
init_cfg=None, | ||
align_corners=False), | ||
decode_head=dict( | ||
type='FCNHead', | ||
in_channels=128, | ||
in_index=0, | ||
channels=1024, | ||
num_convs=1, | ||
concat_input=False, | ||
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)), | ||
auxiliary_head=[ | ||
dict( | ||
type='FCNHead', | ||
in_channels=16, | ||
channels=16, | ||
num_convs=2, | ||
num_classes=19, | ||
in_index=1, | ||
norm_cfg=norm_cfg, | ||
concat_input=False, | ||
align_corners=False, | ||
loss_decode=dict( | ||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), | ||
dict( | ||
type='FCNHead', | ||
in_channels=32, | ||
channels=64, | ||
num_convs=2, | ||
num_classes=19, | ||
in_index=2, | ||
norm_cfg=norm_cfg, | ||
concat_input=False, | ||
align_corners=False, | ||
loss_decode=dict( | ||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), | ||
dict( | ||
type='FCNHead', | ||
in_channels=64, | ||
channels=256, | ||
num_convs=2, | ||
num_classes=19, | ||
in_index=3, | ||
norm_cfg=norm_cfg, | ||
concat_input=False, | ||
align_corners=False, | ||
loss_decode=dict( | ||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), | ||
dict( | ||
type='FCNHead', | ||
in_channels=128, | ||
channels=1024, | ||
num_convs=2, | ||
num_classes=19, | ||
in_index=4, | ||
norm_cfg=norm_cfg, | ||
concat_input=False, | ||
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')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Bisenet v2: Bilateral Network with Guided Aggregation for Real-time Semantic Segmentation | ||
|
||
## Introduction | ||
|
||
<!-- [ALGORITHM] --> | ||
|
||
```latex | ||
@article{yu2021bisenet, | ||
title={Bisenet v2: Bilateral network with guided aggregation for real-time semantic segmentation}, | ||
author={Yu, Changqian and Gao, Changxin and Wang, Jingbo and Yu, Gang and Shen, Chunhua and Sang, Nong}, | ||
journal={International Journal of Computer Vision}, | ||
pages={1--18}, | ||
year={2021}, | ||
publisher={Springer} | ||
} | ||
``` | ||
|
||
## Results and models | ||
|
||
### Cityscapes | ||
|
||
| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | mIoU | mIoU(ms+flip) | config | download | | ||
| ------ | -------- | --------- | ------: | -------- | -------------- | ----: | ------------: | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| BiSeNetV2 | BiSeNetV2 | 1024x1024 | 160000 | 7.64 | 31.77 | 73.21 | 75.74 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/bisenetv2/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes_20210902_015551-bcf10f09.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes_20210902_015551.log.json) | | ||
| BiSeNetV2 (OHEM) | BiSeNetV2 | 1024x1024 | 160000 | 7.64 | - | 73.57 | 75.80 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes_20210902_112947-5f8103b4.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes_20210902_112947.log.json) | | ||
| BiSeNetV2 (4x8) | BiSeNetV2 | 1024x1024 | 160000 | 15.05 | - | 75.76 | 77.79 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/bisenetv2/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes_20210903_000032-e1a2eed6.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes_20210903_000032.log.json) | | ||
| BiSeNetV2 (FP16) | BiSeNetV2 | 1024x1024 | 160000 | 5.77 | 36.65 | 73.07 | 75.13 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/bisenetv2/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes_20210902_045942-b979777b.pth) | [log](https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes_20210902_045942.log.json) | | ||
|
||
Note: | ||
|
||
- `OHEM` means Online Hard Example Mining (OHEM) is adopted in training. | ||
- `FP16` means Mixed Precision (FP16) is adopted in training. | ||
- `4x8` means 4 GPUs with 8 samples per GPU in training. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
Collections: | ||
- Metadata: | ||
Training Data: | ||
- Cityscapes | ||
Name: bisenetv2 | ||
Models: | ||
- Config: configs/bisenetv2/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes.py | ||
In Collection: bisenetv2 | ||
Metadata: | ||
backbone: BiSeNetV2 | ||
crop size: (1024,1024) | ||
inference time (ms/im): | ||
- backend: PyTorch | ||
batch size: 1 | ||
hardware: V100 | ||
mode: FP32 | ||
resolution: (1024,1024) | ||
value: 31.48 | ||
lr schd: 160000 | ||
memory (GB): 7.64 | ||
Name: bisenetv2_fcn_4x4_1024x1024_160k_cityscapes | ||
Results: | ||
Dataset: Cityscapes | ||
Metrics: | ||
mIoU: 73.21 | ||
mIoU(ms+flip): 75.74 | ||
Task: Semantic Segmentation | ||
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes_20210902_015551-bcf10f09.pth | ||
- Config: configs/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes.py | ||
In Collection: bisenetv2 | ||
Metadata: | ||
backbone: BiSeNetV2 | ||
crop size: (1024,1024) | ||
lr schd: 160000 | ||
memory (GB): 7.64 | ||
Name: bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes | ||
Results: | ||
Dataset: Cityscapes | ||
Metrics: | ||
mIoU: 73.57 | ||
mIoU(ms+flip): 75.8 | ||
Task: Semantic Segmentation | ||
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes_20210902_112947-5f8103b4.pth | ||
- Config: configs/bisenetv2/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes.py | ||
In Collection: bisenetv2 | ||
Metadata: | ||
backbone: BiSeNetV2 | ||
crop size: (1024,1024) | ||
lr schd: 160000 | ||
memory (GB): 15.05 | ||
Name: bisenetv2_fcn_4x8_1024x1024_160k_cityscapes | ||
Results: | ||
Dataset: Cityscapes | ||
Metrics: | ||
mIoU: 75.76 | ||
mIoU(ms+flip): 77.79 | ||
Task: Semantic Segmentation | ||
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes_20210903_000032-e1a2eed6.pth | ||
- Config: configs/bisenetv2/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes.py | ||
In Collection: bisenetv2 | ||
Metadata: | ||
backbone: BiSeNetV2 | ||
crop size: (1024,1024) | ||
inference time (ms/im): | ||
- backend: PyTorch | ||
batch size: 1 | ||
hardware: V100 | ||
mode: FP32 | ||
resolution: (1024,1024) | ||
value: 27.29 | ||
lr schd: 160000 | ||
memory (GB): 5.77 | ||
Name: bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes | ||
Results: | ||
Dataset: Cityscapes | ||
Metrics: | ||
mIoU: 73.07 | ||
mIoU(ms+flip): 75.13 | ||
Task: Semantic Segmentation | ||
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes_20210902_045942-b979777b.pth |
11 changes: 11 additions & 0 deletions
11
configs/bisenetv2/bisenetv2_fcn_4x4_1024x1024_160k_cityscapes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
_base_ = [ | ||
'../_base_/models/bisenetv2.py', | ||
'../_base_/datasets/cityscapes_1024x1024.py', | ||
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' | ||
] | ||
lr_config = dict(warmup='linear', warmup_iters=1000) | ||
optimizer = dict(lr=0.05) | ||
data = dict( | ||
samples_per_gpu=4, | ||
workers_per_gpu=4, | ||
) |
11 changes: 11 additions & 0 deletions
11
configs/bisenetv2/bisenetv2_fcn_4x8_1024x1024_160k_cityscapes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
_base_ = [ | ||
'../_base_/models/bisenetv2.py', | ||
'../_base_/datasets/cityscapes_1024x1024.py', | ||
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' | ||
] | ||
lr_config = dict(warmup='linear', warmup_iters=1000) | ||
optimizer = dict(lr=0.05) | ||
data = dict( | ||
samples_per_gpu=8, | ||
workers_per_gpu=8, | ||
) |
5 changes: 5 additions & 0 deletions
5
configs/bisenetv2/bisenetv2_fcn_fp16_4x4_1024x1024_160k_cityscapes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
_base_ = './bisenetv2_fcn_4x4_1024x1024_160k_cityscapes.py' | ||
# fp16 settings | ||
optimizer_config = dict(type='Fp16OptimizerHook', loss_scale=512.) | ||
# fp16 placeholder | ||
fp16 = dict() |
12 changes: 12 additions & 0 deletions
12
configs/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
_base_ = [ | ||
'../_base_/models/bisenetv2.py', | ||
'../_base_/datasets/cityscapes_1024x1024.py', | ||
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' | ||
] | ||
sampler = dict(type='OHEMPixelSampler', thresh=0.7, min_kept=10000) | ||
lr_config = dict(warmup='linear', warmup_iters=1000) | ||
optimizer = dict(lr=0.05) | ||
data = dict( | ||
samples_per_gpu=4, | ||
workers_per_gpu=4, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.