计算模型计算量MAC

onnx

python 复制代码
import onnx_tool

model_path = 'resnet50_224x224.onnx' #本地模型

onnx_tool.model_profile(model_path)

模型

python 复制代码
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, 1920//2, 1080//2)
    inp_frames = torch.randn(1, 4, 128, 128)
    macs = profile_macs(model_temp, (inp_frames))
    print(macs // 1e9) # 计算量在 587 G 左右

    flops, params = profile(model_temp, inputs = (inp_frames, ))
    print('MACs = ' + str(flops/1000**3) + 'G' + '(PMRID)')
    print('Params = ' + str(params/1000**2) + 'M' )
相关推荐
共享家95271 天前
linux-数据链路层
linux·网络·macos
CZIDC1 天前
MacOS字体看起来比在 Windows 上更好?
macos
Cosmoshhhyyy2 天前
linux远程部署dify和mac本地部署dify
linux·运维·macos
行星0082 天前
mac 通过homebrew 安装和使用nvm
macos·npm·node.js
2501_928094652 天前
Mac电脑录屏工具 Omi录屏专家(Mac中文)
macos·mac·录屏工具·omi
森之鸟2 天前
Mac chrome浏览器下载DevEco Studio 6.0.0 Beta2失败
前端·chrome·macos
FairGuard手游加固3 天前
版本更新!FairGuard-Mac加固工具已上线!
macos
金玉满堂@bj3 天前
OS设备UDID查看方法
macos·objective-c·cocoa
庸懒3 天前
Electron自定义菜单栏及Mac最大化无效的问题解决
前端·macos·electron