How to calculate FPS (frame rate)

FPS (Frames Per Second), how many frames per second

In val.py, parameters need to be modifiedbatch-size=1

At the same time, don’t forget to modify the yaml file of your own data set and the trained pt file, as shown below:

Insert image description here

After the modification is completed, run it val.pyand get the result, as shown below:

Insert image description here

The three times (ms) shown in the above figure - pre-process: image preprocessing, inference: inference, NMS: non-maximum suppression, the sum of these three times is the time required for the model to process an image.

Insert image description here

Round the result to the nearest integer, which is the final FPS

In addition, if you want to print FPS on the console, you can val.pypress and hold the shortcut key Ctrl+FSearch Print speedsto locate it, and then add the following code:

FPS = 1000 / sum(t)
LOGGER.info(f'FPS: {
      
      round(FPS, 0)}')

As shown below:

Insert image description here

Guess you like

Origin blog.csdn.net/hu_wei123/article/details/131879071