Skip to content

Commit

Permalink
Replace convert_syncbatchnorm in mmseg (open-mmlab#93)
Browse files Browse the repository at this point in the history
* replace convert_syncbatchnorm with revert_sync_batchnorm from mmcv

* change logger
  • Loading branch information
RunningLeon authored Jan 26, 2022
1 parent 003cf1b commit 0556fee
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 68 deletions.
5 changes: 5 additions & 0 deletions configs/mmseg/segmentation_pplnn_static-512x1024.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
_base_ = ['./segmentation_static.py', '../_base_/backends/pplnn.py']

onnx_config = dict(input_shape=[1024, 512])

backend_config = dict(model_inputs=dict(opt_shape=[1, 3, 512, 1024]))
2 changes: 1 addition & 1 deletion docs/en/codebases/mmseg.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Please refer to [get_started.md](https://github.com/open-mmlab/mmsegmentation/bl
| DeepLabV3 | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/deeplabv3) |
| DeepLabV3+ | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/deeplabv3plus) |
| Fast-SCNN[*](#static_shape) | Y | Y | N | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/fastscnn) |
| UNet | Y | Y | Y | N | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/unet) |
| UNet[*](#static_shape) | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/unet) |

### Reminder

Expand Down
2 changes: 1 addition & 1 deletion docs/en/supported_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The table below lists the models that are guaranteed to be exportable to other b
| DeepLabV3 | MMSegmentation | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/deeplabv3) |
| DeepLabV3+ | MMSegmentation | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/deeplabv3plus) |
| Fast-SCNN[*static](#note) | MMSegmentation | Y | Y | N | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/fastscnn) |
| UNet | MMSegmentation | Y | Y | Y | N | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/unet) |
| UNet[*static](#note) | MMSegmentation | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/unet) |
| SRCNN | MMEditing | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmediting/tree/master/configs/restorers/srcnn) |
| ESRGAN | MMEditing | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmediting/tree/master/configs/restorers/esrgan) |
| SRGAN | MMEditing | Y | Y | Y | Y | Y | [config](https://github.com/open-mmlab/mmediting/tree/master/configs/restorers/srresnet_srgan) |
Expand Down
3 changes: 1 addition & 2 deletions mmdeploy/codebase/mmseg/deploy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .mmsegmentation import MMSegmentation
from .segmentation import Segmentation
from .utils import convert_syncbatchnorm

__all__ = ['convert_syncbatchnorm', 'MMSegmentation', 'Segmentation']
__all__ = ['MMSegmentation', 'Segmentation']
5 changes: 2 additions & 3 deletions mmdeploy/codebase/mmseg/deploy/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ def init_pytorch_model(self,
codebases.
"""
from mmseg.apis import init_segmentor
from mmdeploy.codebase.mmseg.deploy import convert_syncbatchnorm
from mmcv.cnn.utils import revert_sync_batchnorm
model = init_segmentor(self.model_cfg, model_checkpoint, self.device)
model = convert_syncbatchnorm(model)

model = revert_sync_batchnorm(model)
return model.eval()

def create_input(self,
Expand Down
31 changes: 0 additions & 31 deletions mmdeploy/codebase/mmseg/deploy/utils.py

This file was deleted.

30 changes: 0 additions & 30 deletions tests/test_codebase/test_mmseg/test_mmseg_utils.py

This file was deleted.

0 comments on commit 0556fee

Please sign in to comment.