okankop / Efficient-3DCNNs

PyTorch Implementation of "Resource Efficient 3D Convolutional Neural Networks", codes and pretrained models.
MIT License
777 stars 151 forks source link

FLOPs mismatch problems #43

Closed WUSHUANGPPP closed 3 years ago

WUSHUANGPPP commented 3 years ago

https://github.com/okankop/Efficient-3DCNNs/blob/d60c6c48cf2e81380d0a513e22e9d7f8467731af/thop/count_hooks.py#L47 As the code above, I wondering why the calculation different from other FLOPs counting project like https://github.com/sovrasov/flops-counter.pytorch (Resnet18 3D same input output different FLOPs result, this one outputs ~8.32 G,but your implementation given 5G or so.) The reason is that you divide stride to the outputs size just like the code above. Could you please explain about it? Appreciate it! @ahmetgunduz @tdh512194 @okankop ps: image Shouldn't it calculate in this way?

okankop commented 3 years ago

Yes, unfortunately we verify the bug you presented. At the time of our paper, we have used the famous FLOP calculation repo https://github.com/Lyken17/pytorch-OpCounter , and this bug comes from their implementation. As you can see, they also divide output size by stride number https://github.com/Lyken17/pytorch-OpCounter/blob/16c2276ac0fd3cce4dc12c72cfd9a6a547f4b5fc/thop/count_hooks.py#L18. Trusting their high star number at github, we unfortunately have not checked the correctness of their implementation.

We are now fixing the bug and modifying our FLOP numbers in the paper.

Thanks for raising the issue!

WUSHUANGPPP commented 3 years ago

OK,It's delighted to see your fast reply. That's really release my nervous and doubt~~

okankop commented 3 years ago

Thanks again for raising the issue!