Swin-Transformer
Swin-Transformer copied to clipboard
How can I load a "swin_large_patch4_window7_224_22k" model?
Actually, I successfully load the small type and base type model by --resume. But when I want to use large model, I get a message that: "size mismatch for head.bias: copying a param with shape torch.Size([21841]) from checkpoint, the shape in current model is torch.Size([1000])."
Has this been resolved? Or is there currently no support for training a Swin-L model? I know we need both the pth file and the python config file.
I see config files for tiny, small, and base but none for large. Can we use a config like configs/swin/cascade_mask_rcnn_swin_base_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py
with swin_large_patch4_window7_224_22k and have it work correctly?
你要把checkpoint里不匹配的扔掉
Hi, friend, I have solved it. When you init the swin_transformer.SwinTransformer() , you need to set the num_classes as 21841 instead of 1000(it is default) , because it is "22k" model. Good luck for you !
@zgj-gutou @cwq63 Perhaps my problem is same for theirs? I'm using my dataset & change some part which can work well in ‘Swin-Transformer-Semantic-Segmentation ’code but show me errors in mmsegmentation swin code(with official pretrain model ‘upernet_swin_tiny_patch4_window7_512x512.pth’): size mismatch for stages.0.downsample.norm.weight: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([192]). size mismatch for stages.0.downsample.norm.bias: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([192]).
Thanks for your help.