-
-
Notifications
You must be signed in to change notification settings - Fork 16.5k
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
How to compute loss using eval mode in val. py file for YOLOv5 #13469
Comments
👋 Hello @BIT-QiuYu, thank you for your interest in YOLOv5 🚀! For research use cases like yours, it’s great to see modifications aimed at customized loss calculations using If this is a 🐛 Bug Report, please provide a minimum reproducible example (MRE), including detailed steps that consistently reproduce the issue. This will help us debug the exact behaviors and assist you better. If this is a custom training ❓ Question, please ensure you share as much contextual information as possible, including the specific YOLOv5 version being used, the hyperparameters file (if modified), and any environment details such as Python and PyTorch versions. Verifying that you are following the best practices for custom modifications may also help avoid potential pitfalls. RequirementsEnsure you have the following:
EnvironmentsYOLOv5 supports various environments, such as Jupyter Notebooks with a GPU, cloud environments like Google Cloud and AWS, and running inside Docker containers. Testing across multiple environments may help isolate the issue. StatusYou can also confirm the functionality of your YOLOv5 installation by checking the status of the Continuous Integration (CI) tests, which verify training, validation, inference, export, and benchmarking processes. This is an automated response to guide you better on your query. An Ultralytics engineer will take a detailed look and assist you further shortly 😊. |
To compute the loss in evaluation mode using YOLOv5, you can adjust your approach as follows:
This method avoids directly modifying If you encounter further issues, ensure you are using the latest YOLOv5 version from the repository. Let us know if you need additional guidance! |
Search before asking
Question
Due to research requirements, I need to calculate the loss function value for each input image in the
eval mode
of the YOLO V5 modelI modified the
run
function in theval. py
fileThe
compute_loss
variable was specified asComputeLoss (model)
in itThe following error will occur:
When I imitate the training mode and adding the 'hyp' attribute to the YOLOv5 model using 'data/hyps/hyp.satch-low-yaml' will result in the following error:
I really need the loss value.I look forward to your reply. I would be extremely grateful
If it's not possible to directly modify
val. py
to achieve the goal, useor
and other methods can achieve the goal, I also look forward to your reply. I would greatly appreciate it
Additional
No response
The text was updated successfully, but these errors were encountered: