Skip to content
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

val.py --weights and --data compatibility check #7292

Merged
merged 1 commit into from
Apr 5, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Apr 5, 2022

Improved error messages for understanding of user error with val.py. May help #7291

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced model-dataset compatibility verification in validation script.

πŸ“Š Key Changes

  • Added a check to ensure the number of classes (nc) matches between the loaded weights (--weights) and the dataset configuration (--data) during non-training runs.

🎯 Purpose & Impact

  • πŸ›  Purpose: Prevents potential mismatch errors by verifying that the model weights correspond to the expected number of classes defined in the dataset being used for validation.
  • πŸ” Impact: Increases user confidence that the model is being evaluated correctly, ensuring that validation results are reliable and consistent with the training setup.

Improved error messages for understanding of user error with val.py. May help #7291
@glenn-jocher glenn-jocher self-assigned this Apr 5, 2022
@glenn-jocher
Copy link
Member Author

Example result:

$ python val.py --weights yolov5s.pt --data voc.yaml
...
AssertionError: yolov5s.pt (80 classes) trained on different --data than what you passed (20 classes). Pass correct combination of --weights and --data that are trained together.

@glenn-jocher glenn-jocher merged commit d2e7ba2 into master Apr 5, 2022
@glenn-jocher glenn-jocher deleted the update/val_check branch April 5, 2022 12:23
@glenn-jocher glenn-jocher linked an issue Apr 5, 2022 that may be closed by this pull request
2 tasks
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
Improved error messages for understanding of user error with val.py. May help ultralytics#7291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

validation with val.py fails with a indexing error
1 participant