Yolo-FastestV2 icon indicating copy to clipboard operation
Yolo-FastestV2 copied to clipboard

FLOPS

Open sjfei opened this issue 3 years ago • 2 comments

大佬想问一下,FLOPS怎么知道的

sjfei avatar Aug 19 '21 08:08 sjfei

谷歌一下,网上都能查到,一个是自己计算,一个是所用的神经网络框架自己计算得到

Lebhoryi avatar Aug 22 '21 14:08 Lebhoryi

you can get the flops of you model as follows:

    from ptflops import get_model_complexity_info

    h, w = (192, 192)

    with torch.cuda.device(0):
        macs, params = get_model_complexity_info(
            model, (3, h, w),
            as_strings=True, print_per_layer_stat=True, verbose=True
        )
        flops = str(float(macs.split(' ')[0]) * 2) + " GFLOPs"
        print('{:<30}  {:<8}'.format('Computational complexity: ', macs))
        print('{:<30}  {:<8}'.format('FLOPs: ', flops))
        print('{:<30}  {:<8}'.format('Number of parameters: ', params))

noahzhy avatar May 25 '22 17:05 noahzhy