JingjunYi / SET

[ACM MM2024] Learning Spectral-Decomposed Tokens for Domain Generalized Semantic Segmentation
https://arxiv.org/abs/2407.18568
13 stars 1 forks source link

How to get trainable parameter number? #2

Open FlyingMark77 opened 4 weeks ago

FlyingMark77 commented 4 weeks ago

Great job for the field of Semantic Segmentation! However, when I'm trying to count the trainable parameter number of this network, I found the mmseg official tool_(tools/analysis_tools/getflops.py) doesn't support MaskFormer and Mask2Former, for which I have no idea how to get the trainable parameter number of the network. May I have any advice on it?

JingjunYi commented 4 weeks ago

Hi, thanks for your attention. I think you can try the script from mask2former project, I successed to get the trainable parameters from here. https://github.com/facebookresearch/Mask2Former/blob/main/tools/analyze_model.py

FlyingMark77 commented 4 weeks ago

Appreciate your reply! Am I supposed to directly use the config files like citys_rein_dinov2_mask2former_512x512_bs1x4.py or others? And how to convert it into the format for analyze_model.py?

FlyingMark77 commented 4 weeks ago

There is a #similar issue published on Rein yesterday. It works on getting parameters of the model. However, FLOPs and MACs are not mentioned. Is there any possible way to get FLOPs?

JingjunYi commented 5 days ago

I think you can try thop and torch summary to get these metrics.