当前位置:网站首页>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))
边栏推荐
- Rk3399 platform development series explanation (WiFi) 5.52. Introduction to WiFi framework composition
- 计算模型 FPS
- SAP Spartacus checkout 流程的扩展(extend)实现介绍
- Red hat install kernel header file
- Ideas of high concurrency and high traffic seckill scheme
- Three updates to build applications for different types of devices | 2022 i/o key review
- Qt多线程的多种方法之一 QThread
- SQL Server 2008 各种DateTime的取值范围
- 10W word segmentation searches per second, the product manager raised another demand!!! (Collection)
- 谷歌 Chrome 浏览器发布 103.0.5060.114 补丁修复 0-day 漏洞
猜你喜欢

Jinfo of JVM command: view and modify JVM configuration parameters in real time

Vscode for code completion
![[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

rt-thread 中对 hardfault 的处理

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

tkinter窗口选择pcd文件并显示点云(open3d)

Introduction to the extension implementation of SAP Spartacus checkout process

Peripheral driver library development notes 43: GPIO simulation SPI driver
![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]](/img/fd/7223d78fff54c574260ec0da5f41d5.png)
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]

Introduction to yarn (one article is enough)
随机推荐
If you don't know these four caching modes, dare you say you understand caching?
Qtthread, one of many methods of QT multithreading
Say sqlyog deceived me!
Qt多线程的多种方法之一 QThread
Mac version PHP installed Xdebug environment (M1 version)
3531. Huffman tree
「解析」FocalLoss 解决数据不平衡问题
Check point: the core element for enterprises to deploy zero trust network (ztna)
Cf:c. column swapping [sort + simulate]
POI excel export, one of my template methods
Flask1.1.4 werkzeug1.0.1 source code analysis: start the process
软件测试知识储备:关于「登录安全」的基础知识,你了解多少?
牛客小白月赛52 E.分组求对数和(二分&容斥)
每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
Software testing knowledge reserve: how much do you know about the basic knowledge of "login security"?
话说SQLyog欺骗了我!
【FPGA教程案例14】基于vivado核的FIR滤波器设计与实现
On the discrimination of "fake death" state of STC single chip microcomputer
Career experience feedback to novice programmers
Financial risk control practice - decision tree rule mining template