deep-high-resolution-net.pytorch
deep-high-resolution-net.pytorch copied to clipboard
Bugs in `get_model_summary' and flops calculation
Dear all,
Thanks for releasing the codes! I noticed some problems in model flops calculation.
- The classname
Conv2dandConvTranspose2dboth contain 'Conv', so their flops are counted inget_model_summary. https://github.com/leoxiaobin/deep-high-resolution-net.pytorch/blob/ba50a82dce412df97f088c572d86d7977753bf74/lib/utils/utils.py#L124
However, the flops-calculation for Conv2d and ConvTranspose2d should be different.
For Conv2d, it is
flops = (torch.prod(torch.LongTensor(list(module.weight.data.size()))) * torch.prod(torch.LongTensor(list(output.size())[2:]))).item()
But for ConvTranspose2d, it should be
flops = (torch.prod(torch.LongTensor(list(module.weight.data.size()))) * torch.prod(torch.LongTensor(list(input[0].size())[2:]))).item()
- Flops of many other ops (e.g. BN, ReLU) are not calculated.
Yes, indeed! @leoxiaobin @sunke123