当前位置:网站首页>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))
边栏推荐
- 980. Different path III DFS
- @Detailed differences between pathvariable and @requestparam
- Understand the deserialization principle of fastjson for generics
- Personal imitation SSM framework
- 可极大提升编程思想与能力的书有哪些?
- 当我们谈论不可变基础设施时,我们在谈论什么
- window下面如何安装swoole
- 解决pod install报错:ffi is an incompatible architecture
- 苹果cms V10模板/MXone Pro自适应影视电影网站模板
- k8s运行oracle
猜你喜欢
Deep clustering: joint optimization of depth representation learning and clustering
【SQL实战】一条SQL统计全国各地疫情分布情况
Loss function and positive and negative sample allocation in target detection: retinanet and focal loss
Jmeter自带函数不够用?不如自己动手开发一个
Subghz, lorawan, Nb IOT, Internet of things
Bbox regression loss function in target detection -l2, smooth L1, IOU, giou, Diou, ciou, focal eiou, alpha IOU, Siou
测试开发基础,教你做一个完整功能的Web平台之环境准备
开发者别错过!飞桨黑客马拉松第三期链桨赛道报名开启
高并发大流量秒杀方案思路
693. Travel sequencing
随机推荐
Vscode for code completion
Peripheral driver library development notes 43: GPIO simulation SPI driver
Oracle迁移中关于大容量表使用数据泵(expdp、impdp)导出导入容易出现的问题和注意事项
安装mongodb数据库
Jinfo of JVM command: view and modify JVM configuration parameters in real time
Ctfshow-- common posture
JMeter function assistant - random value, random string, fixed value random extraction
JVM monitoring and diagnostic tools - command line
Markdown 并排显示图片
一个简单的代数问题的求解
[cloud native] what is the microservice architecture?
@pathvariable 和 @Requestparam的详细区别
MFC BMP sets the resolution of bitmap, DPI is 600 points, and gdiplus generates labels
VScode进行代码补全
改变ui组件原有样式
谷歌 Chrome 浏览器发布 103.0.5060.114 补丁修复 0-day 漏洞
SubGHz, LoRaWAN, NB-IoT, 物联网
Jstack of JVM command: print thread snapshots in JVM
C note 13
JVM命令之 jinfo:实时查看和修改JVM配置参数