当前位置:网站首页>Calculation model FPS
Calculation model FPS
2022-07-07 06:18:00 【ViatorSun】
Whether it is image classification or , object detection / Instance segmentation , Detection speed is an important indicator .
Calculation model FPS The process :
Just add one before and after the model runs time Just record the time , Then calculate the model through the time difference FPS
start = time.time()
with torch.no_grad():
seg_result = model.forward(img, target)
img_show = show_result_ins(imgpath, seg_result)
end = time.time()
t_all = end - start
# print("spend time: ", t_all ,"s")
print('average time:{:.02f} s'.format(np.mean(t_all) / 1))
print('average FPS :{:.02f} fps'.format(1 / np.mean(t_all)))
The complete code can be referred to as follows
import time
import torch
import numpy as np
net = build_model
net.eval()
# x Is the size of the input picture
x = torch.zeros((1,3,H,W)).cuda()
t_all = []
for i in range(100):
t1 = time.time()
y = net(x)
t2 = time.time()
t_all.append(t2 - t1)
print('average time:', np.mean(t_all) / 1)
print('average fps:',1 / np.mean(t_all))
print('fastest time:', min(t_all) / 1)
print('fastest fps:',1 / min(t_all))
print('slowest time:', max(t_all) / 1)
print('slowest fps:',1 / max(t_all))
边栏推荐
- 生活中的开销,怎么记账合适
- PTA ladder game exercise set l2-002 linked list de duplication
- Find duplicate email addresses
- 你不知道的互联网公司招聘黑话大全
- Talking about reading excel with POI
- DC-7靶机
- 谷歌 Chrome 浏览器发布 103.0.5060.114 补丁修复 0-day 漏洞
- Experience of Niuke SQL
- From "running distractor" to data platform, Master Lu started the road of evolution
- Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();
猜你喜欢
![[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core](/img/fc/5162bbb0746f8af2d6c7d63ade571a.png)
[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core

软件测试知识储备:关于「登录安全」的基础知识,你了解多少?

10W word segmentation searches per second, the product manager raised another demand!!! (Collection)

Understand the deserialization principle of fastjson for generics

Dc-7 target

JVM命令之 jinfo:实时查看和修改JVM配置参数
![[InstallShield] Introduction](/img/df/4522d06510ff918d00659b8358368f.jpg)
[InstallShield] Introduction

Jcmd of JVM command: multifunctional command line
![Cf:c. column swapping [sort + simulate]](/img/0e/64d17980d3ec0051cdfb5fdb34e119.png)
Cf:c. column swapping [sort + simulate]

CloudCompare-点对选取
随机推荐
深度聚类:将深度表示学习和聚类联合优化
3531. 哈夫曼树
[InstallShield] Introduction
Database notes 04
基于FPGA的VGA协议实现
Jcmd of JVM command: multifunctional command line
SAP Spartacus checkout 流程的扩展(extend)实现介绍
测试开发基础,教你做一个完整功能的Web平台之环境准备
JVM monitoring and diagnostic tools - command line
SubGHz, LoRaWAN, NB-IoT, 物联网
Red hat install kernel header file
Detailed explanation of platform device driver architecture in driver development
yarn入门(一篇就够了)
693. Travel sequencing
为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾
Experience of Niuke SQL
SQL Server 2008 各种DateTime的取值范围
每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
骑士战胜魔王(背包&dp)
Check point: the core element for enterprises to deploy zero trust network (ztna)