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:
After the modification is completed, run it val.py
and get the result, as shown below:
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.
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.py
press and hold the shortcut key Ctrl+F
Search Print speeds
to locate it, and then add the following code:
FPS = 1000 / sum(t)
LOGGER.info(f'FPS: {
round(FPS, 0)}')
As shown below: