-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check FPS #12414
Comments
@AbhishekPSI7042 you can calculate FPS by adding the following code to your fps_text = f"FPS: {1 / dt[1].dt:.2f}"
cv2.putText(im0, fps_text, (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2, cv2.LINE_AA) Your implementation looks correct! This will display the FPS on the output image. Remember to import |
@glenn-jocher hey, thanks I have another question I wan to save my model into fp16 in pytorch format how can do that. And can we improve the fps on cpu currently I'm getting 27fps on my cpu with image size 360 is there any other way to increase fps? |
@AbhishekPSI7042 you can save the model in fp16 format using PyTorch's |
@glenn-jocher how can I save the model in pytorch because when I use export.py there is no way to save model in .pt format in fp16. |
@AbhishekPSI7042 To save the model in PyTorch's .pt format with fp16 precision, you can directly use PyTorch's model.half() # Convert model to half precision
torch.save(model.state_dict(), 'model_fp16.pt') # Save model with fp16 precision This will save the model with fp16 precision in .pt format. For more details, refer to the YOLOv5 documentation at https://docs.ultralytics.com/yolov5/. Keep exploring and feel free to reach out with any more questions! |
Search before asking
Question
I want check FPS also while running the detect.py. So, I have added this code in my detect.py is it right or not please tell me.
Stream results
im0 = annotator.result()
fps_text = f"FPS: {1 / dt[1].dt:.2f}"
cv2.putText(im0, fps_text, (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2, cv2.LINE_AA)
Additional
No response
The text was updated successfully, but these errors were encountered: