onnx
import onnx_tool
model_path = 'resnet50_224x224.onnx'
onnx_tool.model_profile(model_path)
模型
from torchprofile import profile_macs
from mirnet_v2_g3_conv13_noskff_arch import *
from thop import profile
if __name__ == '__main__':
model_temp = MIRNet_v2(
inp_channels=4,
out_channels=4,
n_feat=32,
n_RRG=4,
n_MRB=1
)
model_temp.eval()
inp_frames = torch.randn(1, 4, 2568//2, 1440//2)
inp_frames = torch.randn(1, 4, 128, 128)
macs = profile_macs(model_temp, (inp_frames))
print(macs // 1e9)
flops, params = profile(model_temp, inputs = (inp_frames, ))
print('MACs = ' + str(flops/1000**3) + 'G' + '(PMRID)')
print('Params = ' + str(params/1000**2) + 'M' )