当前位置:网站首页>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))
边栏推荐
- Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();
- Swagger3 configuration
- Three updates to build applications for different types of devices | 2022 i/o key review
- win系统下安装redis以及windows扩展方法
- JMeter's own functions are not enough? Why don't you develop one yourself
- 基于ADAU1452的DSP及DAC音频失真分析
- 深度聚类:将深度表示学习和聚类联合优化
- Test the foundation of development, and teach you to prepare for a fully functional web platform environment
- Jstat pour la commande JVM: voir les statistiques JVM
- 可极大提升编程思想与能力的书有哪些?
猜你喜欢

JVM命令之 jstack:打印JVM中线程快照

基于FPGA的VGA协议实现

jvm命令之 jcmd:多功能命令行

Jstack of JVM command: print thread snapshots in JVM

Test the foundation of development, and teach you to prepare for a fully functional web platform environment

JVM monitoring and diagnostic tools - command line

Ideas of high concurrency and high traffic seckill scheme

关于STC单片机“假死”状态的判别

如果不知道这4种缓存模式,敢说懂缓存吗?

Financial risk control practice - decision tree rule mining template
随机推荐
980. Different path III DFS
Experience of Niuke SQL
【SQL实战】一条SQL统计全国各地疫情分布情况
A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]
MySQL performance_ Schema common performance diagnosis query
Bypass open_ basedir
You don't know the complete collection of recruitment slang of Internet companies
The solution of a simple algebraic problem
Solve pod install error: FFI is an incompatible architecture
如何在Touch Designer 2022版中设置解决Leap Motion不识别的问题?
693. Travel sequencing
JMeter function assistant - random value, random string, fixed value random extraction
[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
Vscode for code completion
改变ui组件原有样式
解决pod install报错:ffi is an incompatible architecture
Loss function and positive and negative sample allocation in target detection: retinanet and focal loss
为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾
Oracle迁移中关于大容量表使用数据泵(expdp、impdp)导出导入容易出现的问题和注意事项
JMeter's own functions are not enough? Why don't you develop one yourself