Keras_FLOP_Estimator icon indicating copy to clipboard operation
Keras_FLOP_Estimator copied to clipboard

A probelm about factor when calculating the FLOPs of DepthwiseConv2D?

Open Mogul5306 opened this issue 2 years ago • 2 comments

when calulating the FLOPs of DW conv, the results was divide by a factor (1000000) ?

flops = 2 * ((ks[0] * ks[1] * i_shape[2]) * ((i_shape[0] / strides[0]) * (i_shape[1] / strides[1]))) / factor ?

when the FlOPs of all layers were calculated, the totoal FLOPs would divided the factor again ?

Becasue i found that when increasing the kernel size of DW conv, the FLOPs has no change. So i check the code and the output. when the input feature map is (13, 13, 512), the kernel size of DW conv is 3, the FLOPs is only 1.5575. i think it is a bug? i want to identify it from you.

Mogul5306 avatar May 11 '22 07:05 Mogul5306

Hi,

Yes it seems that indeed there is an error there. The variable factor is used for scaling so it should only be applied once at the end. I corrected the code if you wish to test it again.

ckyrkou avatar May 16 '22 10:05 ckyrkou

Ok! Thank you.

---- Replied Message ---- | From | Christos @.> | | Date | 05/16/2022 18:44 | | To | @.> | | Cc | @.@.> | | Subject | Re: [ckyrkou/Keras_FLOP_Estimator] A probelm about factor when calculating the FLOPs of DepthwiseConv2D? (Issue #6) |

Hi,

Yes it seems that indeed there is an error there. The variable factor is used for scaling so it should only be applied once at the end. I corrected the code if you wish to test it again.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Mogul5306 avatar May 16 '22 11:05 Mogul5306