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

Can’t calculate the Params and FLOPs of Backbone #382

Open
Pooky-Z opened this issue Jun 24, 2022 · 0 comments
Open

Can’t calculate the Params and FLOPs of Backbone #382

Pooky-Z opened this issue Jun 24, 2022 · 0 comments

Comments

@Pooky-Z
Copy link

Pooky-Z commented Jun 24, 2022

used thop,torchstat and ptflops to caculate the Flops of the model, but all of the results shows there is 0 params and 0 flops in ResNet and FPN. Why did this happen and how can I calucalte the Flops of model correctly. Thank you!

The example of output of the pyflops:
Warning: module Conv2d is treated as a zero-op.
Warning: module FrozenBatchNorm2d is treated as a zero-op.
Warning: module StemWithFixedBatchNorm is treated as a zero-op.
Warning: module BottleneckWithFixedBatchNorm is treated as a zero-op.
Warning: module ResNet is treated as a zero-op.
Warning: module GeneralizedRCNN is treated as a zero-op.
GeneralizedRCNN(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(backbone): ResNet(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(stem): StemWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(layer1): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(downsample): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(1): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(2): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
)
(layer2): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(downsample): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 512, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 128, kernel_size=(1, 1), stride=(2, 2), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(1): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(2): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(3): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
)
(layer3): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(downsample): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 1024, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 256, kernel_size=(1, 1), stride=(2, 2), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(1): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(2): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(3): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(4): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(5): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
)
(layer4): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(downsample): Sequential(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(0): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 1024, 2048, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 1024, 512, kernel_size=(1, 1), stride=(2, 2), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(1): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 2048, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
(2): BottleneckWithFixedBatchNorm(
0, 0.000% Params, 0.0 Mac, 0.000% MACs,
(conv1): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 2048, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv2): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
(conv3): Conv2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, 512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): FrozenBatchNorm2d(0, 0.000% Params, 0.0 Mac, 0.000% MACs, )
)
)
)
)
0.0 Mac

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

1 participant