[Feature] Provide URLs of STDC, Segmenter and Twins pretrained models (#1357)

This commit is contained in:
MengzhangLI 2022-03-09 13:19:41 +08:00 committed by GitHub
parent e8cc3224e1
commit 8f33d68b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 61 additions and 38 deletions

View File

@ -1,8 +1,9 @@
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segmenter/vit_base_p16_384_20220308-96dfe169.pth' # noqa
# model settings # model settings
backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True) backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True)
model = dict( model = dict(
type='EncoderDecoder', type='EncoderDecoder',
pretrained='pretrain/vit_base_p16_384.pth', pretrained=checkpoint,
backbone=dict( backbone=dict(
type='VisionTransformer', type='VisionTransformer',
img_size=(512, 512), img_size=(512, 512),

View File

@ -1,3 +1,5 @@
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_small_20220308-e638c41c.pth' # noqa
# model settings # model settings
backbone_norm_cfg = dict(type='LN') backbone_norm_cfg = dict(type='LN')
norm_cfg = dict(type='SyncBN', requires_grad=True) norm_cfg = dict(type='SyncBN', requires_grad=True)
@ -5,8 +7,7 @@ model = dict(
type='EncoderDecoder', type='EncoderDecoder',
backbone=dict( backbone=dict(
type='PCPVT', type='PCPVT',
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/pcpvt_small.pth'),
in_channels=3, in_channels=3,
embed_dims=[64, 128, 320, 512], embed_dims=[64, 128, 320, 512],
num_heads=[1, 2, 5, 8], num_heads=[1, 2, 5, 8],

View File

@ -1,3 +1,5 @@
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_small_20220308-e638c41c.pth' # noqa
# model settings # model settings
backbone_norm_cfg = dict(type='LN') backbone_norm_cfg = dict(type='LN')
norm_cfg = dict(type='SyncBN', requires_grad=True) norm_cfg = dict(type='SyncBN', requires_grad=True)
@ -5,8 +7,7 @@ model = dict(
type='EncoderDecoder', type='EncoderDecoder',
backbone=dict( backbone=dict(
type='PCPVT', type='PCPVT',
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/pcpvt_small.pth'),
in_channels=3, in_channels=3,
embed_dims=[64, 128, 320, 512], embed_dims=[64, 128, 320, 512],
num_heads=[1, 2, 5, 8], num_heads=[1, 2, 5, 8],

View File

@ -33,9 +33,9 @@ Image segmentation is often ambiguous at the level of individual image patches a
## Usage ## Usage
To use the pre-trained ViT model from [Segmenter](https://github.com/rstrudel/segmenter), it is necessary to convert keys. We have provided pretrained models converted from [ViT-AugReg](https://github.com/rwightman/pytorch-image-models/blob/f55c22bebf9d8afc449d317a723231ef72e0d662/timm/models/vision_transformer.py#L54-L106).
We provide a script [`vitjax2mmseg.py`](../../tools/model_converters/vitjax2mmseg.py) in the tools directory to convert the key of models from [ViT-AugReg](https://github.com/rwightman/pytorch-image-models/blob/f55c22bebf9d8afc449d317a723231ef72e0d662/timm/models/vision_transformer.py#L54-L106) to MMSegmentation style. If you want to convert keys on your own to use the pre-trained ViT model from [Segmenter](https://github.com/rstrudel/segmenter), we also provide a script [`vitjax2mmseg.py`](../../tools/model_converters/vitjax2mmseg.py) in the tools directory to convert the key of models from [ViT-AugReg](https://github.com/rwightman/pytorch-image-models/blob/f55c22bebf9d8afc449d317a723231ef72e0d662/timm/models/vision_transformer.py#L54-L106) to MMSegmentation style.
```shell ```shell
python tools/model_converters/vitjax2mmseg.py ${PRETRAIN_PATH} ${STORE_PATH} python tools/model_converters/vitjax2mmseg.py ${PRETRAIN_PATH} ${STORE_PATH}

View File

@ -3,9 +3,10 @@ _base_ = [
'../_base_/datasets/ade20k.py', '../_base_/default_runtime.py', '../_base_/datasets/ade20k.py', '../_base_/default_runtime.py',
'../_base_/schedules/schedule_160k.py' '../_base_/schedules/schedule_160k.py'
] ]
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segmenter/vit_large_p16_384_20220308-d4efb41d.pth' # noqa
model = dict( model = dict(
pretrained='pretrain/vit_large_p16_384.pth', pretrained=checkpoint,
backbone=dict( backbone=dict(
type='VisionTransformer', type='VisionTransformer',
img_size=(640, 640), img_size=(640, 640),

View File

@ -4,9 +4,11 @@ _base_ = [
'../_base_/schedules/schedule_160k.py' '../_base_/schedules/schedule_160k.py'
] ]
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segmenter/vit_small_p16_384_20220308-410f6037.pth' # noqa
backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True) backbone_norm_cfg = dict(type='LN', eps=1e-6, requires_grad=True)
model = dict( model = dict(
pretrained='pretrain/vit_small_p16_384.pth', pretrained=checkpoint,
backbone=dict( backbone=dict(
img_size=(512, 512), img_size=(512, 512),
embed_dims=384, embed_dims=384,

View File

@ -4,8 +4,10 @@ _base_ = [
'../_base_/schedules/schedule_160k.py' '../_base_/schedules/schedule_160k.py'
] ]
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segmenter/vit_tiny_p16_384_20220308-cce8c795.pth' # noqa
model = dict( model = dict(
pretrained='pretrain/vit_tiny_p16_384.pth', pretrained=checkpoint,
backbone=dict(embed_dims=192, num_heads=3), backbone=dict(embed_dims=192, num_heads=3),
decode_head=dict( decode_head=dict(
type='SegmenterMaskTransformerHead', type='SegmenterMaskTransformerHead',

View File

@ -35,9 +35,9 @@ BiSeNet has been proved to be a popular two-stream network for real-time segment
## Usage ## Usage
To use original repositories' [ImageNet Pretrained STDCNet Weights](https://drive.google.com/drive/folders/1wROFwRt8qWHD4jSo8Zu1gp1d6oYJ3ns1) , it is necessary to convert keys. We have provided [ImageNet Pretrained STDCNet Weights](https://drive.google.com/drive/folders/1wROFwRt8qWHD4jSo8Zu1gp1d6oYJ3ns1) models converted from [official repo](https://github.com/MichaelFan01/STDC-Seg).
We provide a script [`stdc2mmseg.py`](../../tools/model_converters/stdc2mmseg.py) in the tools directory to convert the key of models from [the official repo](https://github.com/MichaelFan01/STDC-Seg) to MMSegmentation style. If you want to convert keys on your own to use official repositories' pre-trained models, we also provide a script [`stdc2mmseg.py`](../../tools/model_converters/stdc2mmseg.py) in the tools directory to convert the key of models from [the official repo](https://github.com/MichaelFan01/STDC-Seg) to MMSegmentation style.
```shell ```shell
python tools/model_converters/stdc2mmseg.py ${PRETRAIN_PATH} ${STORE_PATH} ${STDC_TYPE} python tools/model_converters/stdc2mmseg.py ${PRETRAIN_PATH} ${STORE_PATH} ${STDC_TYPE}

View File

@ -1,6 +1,6 @@
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/stdc/stdc1_20220308-5368626c.pth' # noqa
_base_ = './stdc1_512x1024_80k_cityscapes.py' _base_ = './stdc1_512x1024_80k_cityscapes.py'
model = dict( model = dict(
backbone=dict( backbone=dict(
backbone_cfg=dict( backbone_cfg=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint))))
type='Pretrained', checkpoint='./pretrained/stdc1.pth'))))

View File

@ -1,6 +1,6 @@
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/stdc/stdc2_20220308-7dbd9127.pth' # noqa
_base_ = './stdc2_512x1024_80k_cityscapes.py' _base_ = './stdc2_512x1024_80k_cityscapes.py'
model = dict( model = dict(
backbone=dict( backbone=dict(
backbone_cfg=dict( backbone_cfg=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint))))
type='Pretrained', checkpoint='./pretrained/stdc2.pth'))))

View File

@ -34,9 +34,9 @@ Very recently, a variety of vision transformer architectures for dense predictio
## Usage ## Usage
To use other repositories' pre-trained models, it is necessary to convert keys. We have provided pretrained models converted from [official repo](https://github.com/Meituan-AutoML/Twins).
We provide a script [`twins2mmseg.py`](../../tools/model_converters/twins2mmseg.py) in the tools directory to convert the key of models from [the official repo](https://github.com/Meituan-AutoML/Twins) to MMSegmentation style. If you want to convert keys on your own to use official repositories' pre-trained models, we also provide a script [`twins2mmseg.py`](../../tools/model_converters/twins2mmseg.py) in the tools directory to convert the key of models from [the official repo](https://github.com/Meituan-AutoML/Twins) to MMSegmentation style.
```shell ```shell
python tools/model_converters/twins2mmseg.py ${PRETRAIN_PATH} ${STORE_PATH} ${MODEL_TYPE} python tools/model_converters/twins2mmseg.py ${PRETRAIN_PATH} ${STORE_PATH} ${MODEL_TYPE}

View File

@ -1,7 +1,8 @@
_base_ = ['./twins_pcpvt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py'] _base_ = ['./twins_pcpvt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_base_20220308-0621964c.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/pcpvt_base.pth'),
depths=[3, 4, 18, 3]), ) depths=[3, 4, 18, 3]), )

View File

@ -1,9 +1,10 @@
_base_ = ['./twins_pcpvt-s_uperhead_8x4_512x512_160k_ade20k.py'] _base_ = ['./twins_pcpvt-s_uperhead_8x4_512x512_160k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_base_20220308-0621964c.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/pcpvt_base.pth'),
depths=[3, 4, 18, 3], depths=[3, 4, 18, 3],
drop_path_rate=0.3)) drop_path_rate=0.3))

View File

@ -1,7 +1,8 @@
_base_ = ['./twins_pcpvt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py'] _base_ = ['./twins_pcpvt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_large_20220308-37579dc6.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/pcpvt_large.pth'),
depths=[3, 8, 27, 3])) depths=[3, 8, 27, 3]))

View File

@ -1,8 +1,10 @@
_base_ = ['./twins_pcpvt-s_uperhead_8x4_512x512_160k_ade20k.py'] _base_ = ['./twins_pcpvt-s_uperhead_8x4_512x512_160k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_large_20220308-37579dc6.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/pcpvt_large.pth'),
depths=[3, 8, 27, 3], depths=[3, 8, 27, 3],
drop_path_rate=0.3)) drop_path_rate=0.3))

View File

@ -1,9 +1,10 @@
_base_ = ['./twins_svt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py'] _base_ = ['./twins_svt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/alt_gvt_base_20220308-1b7eb711.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/alt_gvt_base.pth'),
embed_dims=[96, 192, 384, 768], embed_dims=[96, 192, 384, 768],
num_heads=[3, 6, 12, 24], num_heads=[3, 6, 12, 24],
depths=[2, 2, 18, 2]), depths=[2, 2, 18, 2]),

View File

@ -1,8 +1,10 @@
_base_ = ['./twins_svt-s_uperhead_8x2_512x512_160k_ade20k.py'] _base_ = ['./twins_svt-s_uperhead_8x2_512x512_160k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/alt_gvt_base_20220308-1b7eb711.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/alt_gvt_base.pth'),
embed_dims=[96, 192, 384, 768], embed_dims=[96, 192, 384, 768],
num_heads=[3, 6, 12, 24], num_heads=[3, 6, 12, 24],
depths=[2, 2, 18, 2]), depths=[2, 2, 18, 2]),

View File

@ -1,9 +1,10 @@
_base_ = ['./twins_svt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py'] _base_ = ['./twins_svt-s_fpn_fpnhead_8x4_512x512_80k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/alt_gvt_large_20220308-fb5936f3.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/alt_gvt_large.pth'),
embed_dims=[128, 256, 512, 1024], embed_dims=[128, 256, 512, 1024],
num_heads=[4, 8, 16, 32], num_heads=[4, 8, 16, 32],
depths=[2, 2, 18, 2], depths=[2, 2, 18, 2],

View File

@ -1,8 +1,10 @@
_base_ = ['./twins_svt-s_uperhead_8x2_512x512_160k_ade20k.py'] _base_ = ['./twins_svt-s_uperhead_8x2_512x512_160k_ade20k.py']
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/alt_gvt_large_20220308-fb5936f3.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/alt_gvt_large.pth'),
embed_dims=[128, 256, 512, 1024], embed_dims=[128, 256, 512, 1024],
num_heads=[4, 8, 16, 32], num_heads=[4, 8, 16, 32],
depths=[2, 2, 18, 2], depths=[2, 2, 18, 2],

View File

@ -2,11 +2,13 @@ _base_ = [
'../_base_/models/twins_pcpvt-s_fpn.py', '../_base_/datasets/ade20k.py', '../_base_/models/twins_pcpvt-s_fpn.py', '../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'
] ]
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/alt_gvt_small_20220308-7e1c3695.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
type='SVT', type='SVT',
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/alt_gvt_small.pth'),
embed_dims=[64, 128, 256, 512], embed_dims=[64, 128, 256, 512],
num_heads=[2, 4, 8, 16], num_heads=[2, 4, 8, 16],
mlp_ratios=[4, 4, 4, 4], mlp_ratios=[4, 4, 4, 4],

View File

@ -3,11 +3,13 @@ _base_ = [
'../_base_/datasets/ade20k.py', '../_base_/default_runtime.py', '../_base_/datasets/ade20k.py', '../_base_/default_runtime.py',
'../_base_/schedules/schedule_160k.py' '../_base_/schedules/schedule_160k.py'
] ]
checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/alt_gvt_small_20220308-7e1c3695.pth' # noqa
model = dict( model = dict(
backbone=dict( backbone=dict(
type='SVT', type='SVT',
init_cfg=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint),
type='Pretrained', checkpoint='pretrained/alt_gvt_small.pth'),
embed_dims=[64, 128, 256, 512], embed_dims=[64, 128, 256, 512],
num_heads=[2, 4, 8, 16], num_heads=[2, 4, 8, 16],
mlp_ratios=[4, 4, 4, 4], mlp_ratios=[4, 4, 4, 4],