-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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
Adjust legend labels for classes without instances #5174
Adjust legend labels for classes without instances #5174
Conversation
@glenn-jocher For future reference, how do you feel about incrementally introducing typing? Would make understanding the code more rapid and development easier. E.g. from typing import List, Dict def plot_pr_curve( px: np.ndarray, py: np.ndarray, ap: List[float], save_dir: str='pr_curve.png', names: Dict={} ): |
@NauchtanRobotics thanks for the PR! Would this simplified version also work? names = [v for k, v in names.items() if k in unique_classes] # list of unique names
names = {i: v for i, v in enumerate(names)} # to dict Yes, typing is one of the options we are considering for improving the codebase, but for consistency we'd probably want to apply formatting updates across the whole repo, so let's leave it off the plate for now. Thanks! |
Yes, that works a treat @glenn-jocher. See all 4 affected charts. |
@NauchtanRobotics PR is (squashed and) merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐ |
* legend-labels Adjust legend labels for classes without instances. * ultralytics#5158 Re-indexed series names: only classes containing data. * ultralytics#5158 Re-indexed series names: only classes containing data. * Cleanup Co-authored-by: Glenn Jocher <[email protected]>
See issue #5158
Before
PR Curve legend has labels for "D00" and "D10" but should have labels for "D40" and "EB".
D00 and D10 have no bounding box instances, and no predictions.
'stats' omits classes that have len = 0; therefore 'names' should also omit empty classes.
:
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Improved class naming handling in precision-recall and F1 score calculations and plots.
📊 Key Changes
🎯 Purpose & Impact