Closed KaizerJ closed 3 years ago
Please git clone the upstream version.
I think is a config issue in swin configs there is still pretrain_style parameter.
_base_ = [
'../_base_/models/upernet_swin.py', '../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
model = dict(
pretrained='pretrain/swin_tiny_patch4_window7_224.pth',
backbone=dict(
embed_dims=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
use_abs_pos_embed=False,
drop_path_rate=0.3,
patch_norm=True,
pretrain_style='official'),
decode_head=dict(in_channels=[96, 192, 384, 768], num_classes=150),
auxiliary_head=dict(in_channels=384, num_classes=150))
PD: base/models/upernet_swin.py aswell
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
backbone_norm_cfg = dict(type='LN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained=None,
backbone=dict(
type='SwinTransformer',
pretrain_img_size=224,
embed_dims=96,
patch_size=4,
window_size=7,
mlp_ratio=4,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
strides=(4, 2, 2, 2),
out_indices=(0, 1, 2, 3),
qkv_bias=True,
qk_scale=None,
patch_norm=True,
drop_rate=0.,
attn_drop_rate=0.,
drop_path_rate=0.3,
use_abs_pos_embed=False,
act_cfg=dict(type='GELU'),
norm_cfg=backbone_norm_cfg,
pretrain_style='official'),
decode_head=dict(
type='UPerHead',
in_channels=[96, 192, 384, 768],
in_index=[0, 1, 2, 3],
pool_scales=(1, 2, 3, 6),
channels=512,
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=384,
in_index=2,
channels=256,
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=0.4)),
# model training and testing settings
train_cfg=dict(),
test_cfg=dict(mode='whole'))
Just removing 'pretrained_style' from upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py
and _base_/models/upernet_swin.py
fixed it.
Hi @KaizerJ Thanks for your feedback. We will fix it in the next version.
Checklist
Describe the bug When exporting Swin-S + Upernet model to ONNX format using provided script an error occur.
Reproduction
What command or script did you run?
Did you make any modifications on the code or config? Did you understand what you have modified? No.
What dataset did you use? Irrelevant
Environment
python mmseg/utils/collect_env.py
to collect necessary environment infomation and paste it here.$PATH
,$LD_LIBRARY_PATH
,$PYTHONPATH
, etc.) I'm using a conda environment, pytorch installed with conda.Error traceback
I've seen a similar closed issue ( https://github.com/open-mmlab/mmsegmentation/issues/850 ) but I have got latest versions of mmcv-full and mmsegmentation and still get that error.