Hello, I’m trying to compare how inference time getting faster by reducing FLOPs through changing input sizes.
However, torchvision resnet 50 does not seems to get faster by size reduction.
So I test on github (address below) resnet 50 that gets faster by smaller input.
What makes the difference?
(Besides time takes almost 4 times bigger in github code on same 300x300 size)
x-axis showing the length of the input, test by Tensor shape (1, 3, x , x)
y-axis showing inference time
The line with orange means a theoretical possible reduction by FLOPs change.
The blue line is experimental num.



github code (with no Fully connected layer and avgpool layer)
torchvsion code (with changing Fully connected layer and avgpool layer to Idenetity layer)


  
      github.com
  
  
    kuangliu/pytorch-cifar/blob/master/models/resnet.py 1
'''ResNet in PyTorch.

For Pre-activation ResNet, see 'preact_resnet.py'.

Reference:
[1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
    Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import torch.nn as nn
import torch.nn.functional as F


class BasicBlock(nn.Module):
    expansion = 1

    def __init__(self, in_planes, planes, stride=1):
        super(BasicBlock, self).__init__()
        self.conv1 = nn.Conv2d(
            in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)


  This file has been truncated. show original