Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flops: MambaIR vs Restormer #94

Open
Sravanth-k27 opened this issue Mar 5, 2025 · 2 comments
Open

Flops: MambaIR vs Restormer #94

Sravanth-k27 opened this issue Mar 5, 2025 · 2 comments

Comments

@Sravanth-k27
Copy link

Sravanth-k27 commented Mar 5, 2025

The Previous calculation of flops using the thop library is not accurate. As it is ignoring the scan flops.

Using the latest code using fv_core method, which is the modification from VMamba Paper, they have also modified according to the Albert Gu Method of calculation of flops for SSMs. I am getting the below results

1 MambaIR Block

GFlops: 61.45901 Params: 106097

1 Restormer Block

GFlops: 7.2507 Params: 31729

So my questions are

Why is the MambaIR block almost 9 times more expensive to compute than the Restormer Block?

Why are the parameters almost thrice as those of the restormer block?

I didn't see any flop comparison with restormer in the Real Denoising Case, in the Paper of MambaIR v1

@csguoh
Copy link
Owner

csguoh commented Mar 9, 2025

Hi, thanks for your interest!
In the ./analysis folder in this repo, we have already update the FLOPs calculation code which uses fvcore for calculation.

As for the model complexity, it is suggested to evaluate the whole model instead of only one block, given different methods have varying layer number hyper-parameters.

@Sravanth-k27
Copy link
Author

Hi Author, Thank you for the reply.

  1. I have used the latest code from ./analysis , The results which I pasted above are from flops_param_fvcore.py

  2. Coming to Model complexity, I have compared the entire model flops of restormer vs MambaIR for denoising task, which uses UNET Shaped MambaIR Model which is similar to the case of Restormer. Which was mentioned in Paper & code, That for denoising task UNET based MambaIR is taken for fair comparison with Restormer. The below are my results on an image of shape 3,128,128

Restormer Results:

GFlops: 38.720 Params: 26111668

MambaIR Results:

GFlops: 57.450916 Params: 26779480

Requesting you to please look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants