代码拉取完成,页面将自动刷新
"""
Output model complexity
"""
import time
import torch
from torchstat import stat
from torchsummary import summary
from vision.ssd.mb_tiny_fd import create_mb_tiny_fd
from vision.ssd.mb_tiny_RFB_fd import create_Mb_Tiny_RFB_fd
device = "cpu" # default cpu
width = 320
height = 240
# fd = create_mb_tiny_fd(2)
fd = create_Mb_Tiny_RFB_fd(2)
print(fd)
fd.eval()
fd.to(device)
x = torch.randn(1, 3, width, height).to(device)
summary(fd.to("cuda"), (3, width, height))
from ptflops import get_model_complexity_info
flops, params = get_model_complexity_info(fd.to(device), (3, width, height), print_per_layer_stat=True, as_strings=True)
print("FLOPS:", flops)
print("PARAMS:", params)
for i in range(5):
time_time = time.time()
features = fd(x)
print("inference time :{} s".format(time.time() - time_time))
stat(fd, (3, width, height))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。