czczup / ViT-Adapter

[ICLR 2023 Spotlight] Vision Transformer Adapter for Dense Predictions
https://arxiv.org/abs/2205.08534
Apache License 2.0
1.25k stars 138 forks source link

About the GFlops on the ADE20K dataset. #144

Open SaulZhang opened 1 year ago

SaulZhang commented 1 year ago

Hi, I can not find the reported GFlops on the paper about the model Vit-Adapter-L (Mask2former/Beit v2/crop size 896), can you tell me the relevant data or the method to calculate it. Thanks a lot!

czczup commented 1 year ago

Hi, I just uploaded the get_flops.py for calculating GFLOPs, you can try it.

lianzheng-research commented 1 year ago

I run the following command under the directory /ViT-Adapter/segmentation: python get_flops.py configs/ade20k/upernet_deit_adapter_tiny_512_160k_ade20k.py but got an error: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 52, in build_from_cfg return obj_cls(*args) File "/usr/local/lib/python3.6/dist-packages/mmseg/models/segmentors/encoder_decoder.py", line 36, in init self.backbone = builder.build_backbone(backbone) File "/usr/local/lib/python3.6/dist-packages/mmseg/models/builder.py", line 20, in build_backbone return BACKBONES.build(cfg) File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(args, **kwargs, registry=self) File "/usr/local/lib/python3.6/dist-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 45, in build_from_cfg f'{obj_type} is not in the {registry.name} registry') KeyError: 'ViTAdapter is not in the models registry'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "get_flops.py", line 100, in test_cfg=cfg.get('test_cfg')) File "/usr/local/lib/python3.6/dist-packages/mmseg/models/builder.py", line 49, in build_segmentor cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/usr/local/lib/python3.6/dist-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 55, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') KeyError: "EncoderDecoder: 'ViTAdapter is not in the models registry'" I need some help. Thank you very much!

czczup commented 1 year ago

oh, you should import mmcv_custom and mmseg_custom at the begining of this code