-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
Poor FPS Using yolov5n Custom Model? #11495
Comments
👋 Hello @MagicalPotato0001, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit. Introducing YOLOv8 🚀We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀! Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects. Check out our YOLOv8 Docs for details and get started with: pip install ultralytics |
@MagicalPotato0001 hi there! Your system specifications seem pretty good and they should provide you with good performance with YOLOv5. Since you are getting lower performance than expected, there might be a few things you could try. Firstly, I recommend you use a smaller model such as yolov5s, or with fewer anchor boxes, such as yolov5n. These models are faster and may give you the 30 fps you are looking for, especially if your primary use case is object detection. Another thing you could try is to resize the input images before feeding them into the model, as larger input images require more computations and thus decrease the FPS. Lastly, you should check that your GPU is being utilized during inference and that there's no other process that might be competing for its resources. You can use your system's task manager to check for this. I hope this helps! Let me know if you have any other questions. |
@glenn-jocher Hi, I am using yolov5n because I tried yolov7 first, I have tried reshaping the images before going into the model but it provided no noticeable differences. As for my GPU utilization while running the script it only uses 3% of my GPU, it seemingly uses my GPU memory but not its processing power. |
@MagicalPotato0001 hello there! It looks like your GPU is not being utilized properly during inference, which might be causing the lower than expected fps. I would suggest ensuring that PyTorch is properly installed with GPU support by running If that's not the case, please try reinstalling PyTorch following the instructions on the official PyTorch website. If PyTorch is installed properly, then you might want to update your NVIDIA drivers and ensure that CUDA and cuDNN versions match the requirements specified in the YOLOv5 repo requirements.txt file. Let me know if this helps or if you have any further questions! |
@glenn-jocher Do note when i used detect.py on a video i was getting 10-20ms inference times, so im guessing it may be a code error? |
@MagicalPotato0001 it looks like your PyTorch installation is properly set up with GPU support and your CUDA and cuDNN versions match the requirements. It's possible that the issue might be related to your code. One thing I notice in your while loop is that you are calling You could also experiment with different batch sizes when passing images through the model to see if that improves performance. Additionally, you could try using a profiler such as Nvidia's Nsight Systems to identify performance bottlenecks in your code. Lastly, I see that you are getting good results with I hope these suggestions help you improve the performance of your custom YOLOv5 model. Let me know if you have any further questions! |
@glenn-jocher I have installed Nvidia Nsight, as for how to use it I'm a bit lost. I changed the |
So taking a screenshot adds roughly 45ms of time, that may be the main issue? |
@MagicalPotato0001 thank you for the update! It's great to hear that you were able to pinpoint the overhead in your code when capturing screenshots, which was adding roughly 45ms of time. This was the likely cause of the lower than expected FPS. To improve performance, you could explore alternative methods to capture frames, such as using a dedicated camera or stream input. Additionally, you could consider optimizing your code to reduce the time it takes to capture and process each frame, especially if the frames are being processed in real-time. I hope this helps and please let us know if you have any further questions! |
@glenn-jocher Do you have any recommendations for modules that will take screenshots faster? |
I got it working perfectly, thanks for all your help :) |
@MagicalPotato0001 That's great to hear! I'm glad that you were able to improve the performance of your custom YOLOv5 model. If you have any further questions or run into any issues in the future, please don't hesitate to ask - we are always here to help. |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
Search before asking
Question
PC Specs:
CPU: Ryzen 5 3600 6 Core
GPU1: RTX 2070 8GB
GPU2: RTX 3060Ti 8GB
RAM: 32GB DDR4
CUDA: 11.7
CUDNN: 8.8.1.3
PYTORCH: 2.0
I have trained a custom model using yolov5n, I was hoping to get around at least 30 fps but I am getting closer to 10, so I'm sure its probably user error on my part. All my script should do is take a screenshot of my primary monitor, pass it through the model, and then display it using opencv. Here is my code and any help would be greatly appreciated :)
Additional
No response
The text was updated successfully, but these errors were encountered: