Dani
Dani

Reputation: 11

YoloV5 way too less FPS, how can I fix it?

Can you help me to improve my FPS with Yolov5s?

I am using yolov5s for Real-Time detection in a game, but I do have very less FPS (about 30-40) and sometimes only 0. I am using it with my custom dataset:

model = torch.hub.load('ultralytics/yolov5', 'custom', path=r'C:\Users\stefa\Downloads\best2.pt') # local repo

And with mss to screen capture:

with mss.mss() as sct:
    # Part of the screen to capture
    monitor = {"top": 40, "left": 0, "width": 800, "height": 640}

I hope someone can help me to improve my FPS.

Or should I use Yolov5n, if yes, how do I use / download it?

Thank you!

Upvotes: 1

Views: 6165

Answers (1)

Illustrati
Illustrati

Reputation: 321

There are several ways to improve your FPS rate:

  1. The easier, the better. Try with smaller models such as YOLOv5s or YOLOv5n
  2. What about using your GPU for inference? Add this line: --GPU. Example: $ python detect.py --source 0 --gpu #--source 0 = webcam, make sure you change it.
  3. Reduce your field vision to only a small bounding box (try with 480x480) close to your weapon. Maybe you will need to resize your training set to meet this requirement.
  4. Check this: https://www.youtube.com/watch?v=Yqwz4QGDNh0&ab_channel=SometimesRobots

Good luck!

PD. For further details about YOLOv5 usage, please visit the official website: https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data

Upvotes: 1

Related Questions