NVlabs / SegFormer

Official PyTorch implementation of SegFormer
https://arxiv.org/abs/2105.15203
Other
2.58k stars 357 forks source link

ADE B3 model SS mIoU doesn't match paper Table 1. #125

Open gathierry opened 1 year ago

gathierry commented 1 year ago

Run python tools/test.py local_configs/segformer/B3/segformer.b3.512x512.ade.160k.py segformer.b3.512x512.ade.160k.pth with given pretrained checkpoint in this repo. And got

+--------+-------+-------+-------+
| Scope  | mIoU  | mAcc  | aAcc  |
+--------+-------+-------+-------+
| global | 45.48 | 58.22 | 81.19 |
+--------+-------+-------+-------+

which is different from paper table 1. where mIoU is 49.4

BlueskyFR commented 1 year ago

I also have 36.21 mIoU for B1 on ADE instead of 42.2 😕

ShristiDasBiswas commented 1 year ago

Were you able to figure out what the ''sr_ratio'' parameter does and stands for?>

class mit_b1(MixVisionTransformer): def __init__(self, **kwargs): super(mit_b1, self).__init__( patch_size=4, embed_dims=[64, 128, 320, 512], num_heads=[1, 2, 5, 8], mlp_ratios=[4, 4, 4, 4], qkv_bias=True, norm_layer=partial(nn.LayerNorm, eps=1e-6), depths=[2, 2, 2, 2], sr_ratios=[8, 4, 2, 1], drop_rate=0.0, drop_path_rate=0.1)

gathierry commented 1 year ago

@ShristiDasBiswas I think sr_ratio is the square root of R of equation 2 in the paper. It is square root since it is implemented in a Conv2D layer