-
Notifications
You must be signed in to change notification settings - Fork 307
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
Computing flops #35
Comments
A1: Flops can be estimated as soon as the architecture of your model has been defined. For classical training schemes (like when you train ResNet-50 on Imagenet via SGD) the architecture is defined in advance and flops are not changing during the training. A2: Giga means 10^6, so in your example 0.03 GMac = 30 MMac, you're right. A3: See #16 |
Thank you very much, regarding the second answer A2 I think Giga means 10 ^9 based your code so when we change to Million Mac we should GMac* 1000= Milion MAC, regarding the A3 I have seen these issues but actually still not clear |
Yes, giga is 10^9 |
This is the computation cost of mobilenetv2 which I think it is not correct,, what do you think?
|
It seems OK to me. mobilenetv2 for Imagenet has different amount of params/macs than mobilenetv2 on CIFAR10. Why do you think this result is not correct? |
I compared that is why I am confused if we look at page 5 in this paper we can see that the highest flops are 42.0 million for mobileNet v2 while if we look at the above result it is 90.0 million flops, also your code does not count block in the code while there are some convolution layer in the block "Warning: module Block is treated as a zero-op. |
The numbers in this paper are quite weird: that are the differences between MobileNetV2 for CIFAR10 and MobileNetV2 for SVHN? Both the datasets have 32x32 images and 10 classes, so from the architecture perspective MobilNets should be identical in tables 5 and 6 and have the same amount of flops, but the paper reports less flops for SVHN. May be you'd better ask the authors of the paper if there is a difference between the stock MobileNetV2 and their versions. Regarding warnings: you should treat them carefully. Module block is custom and ptflops doesn't have a rule for it, but at the same it's just a container for other modules that can be parsed correctly. Unfortunately I couldn't figure out a criterion how to distinguish such containers and modules that really need a custom rule to count flops correctly and because of that ptflops just outputs warnings about any unknown module. |
Thank you, yes that is really a problem I am confused why these two flops are different, |
please could you answer my questions
Q1- can we computing flops for a model without training the model? is there any relation between flops and training? can training affect flops? when flops can be computed?
I am asking this question because I defined a model and then I computed the flops and here is the results.
Computational complexity: 0.03 GMac
Number of parameters: 2.24 M
Q2- if we want to have flops in million, we should multiply 0.03 * 1000 ? if yes then for this case the computational complexity is 30.0 million.
Q3- what I understand from your code, Mac is flops, am I right ?
Thank you
The text was updated successfully, but these errors were encountered: