Skip to content

fix: correct loss name from box_loss to cls_loss in TVPDetectLoss#23046

Merged
Laughing-q merged 1 commit into
ultralytics:mainfrom
ShuaiLYU:rename-boxloss-to-clsloss-in-TVPDetectLoss
Dec 25, 2025
Merged

fix: correct loss name from box_loss to cls_loss in TVPDetectLoss#23046
Laughing-q merged 1 commit into
ultralytics:mainfrom
ShuaiLYU:rename-boxloss-to-clsloss-in-TVPDetectLoss

Conversation

@ShuaiLYU

@ShuaiLYU ShuaiLYU commented Dec 25, 2025

Copy link
Copy Markdown
Contributor

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Fix a misnamed loss variable in TVPDetectLoss to correctly return cls_loss instead of box_loss. 🛠️

📊 Key Changes

  • Renamed the local variable from box_loss to cls_loss in TVPDetectLoss.__call__.
  • Updated the return value to reflect the correct classification loss naming for readability and correctness. ✅

🎯 Purpose & Impact

  • Prevents confusion when interpreting logs/outputs by aligning the variable name with the actual loss component returned. 🧾
  • Improves maintainability and reduces the chance of downstream misuse where callers assume a box regression loss is being returned. 🔧

@codecov

codecov Bot commented Dec 25, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultralytics/utils/loss.py 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working as intended in the official Ultralytics package. fixed Bug has been resolved python Pull requests that update python code labels Dec 25, 2025
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @ShuaiLYU, thank you for submitting a ultralytics/ultralytics 🚀 PR! This is an automated message—an Ultralytics engineer will assist soon. To ensure a seamless integration of your work, please review the following checklist:

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/ultralytics main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Clean, low-risk change: the local variable name and returned identifier are aligned with the loss component being returned (cls_loss), improving readability without altering behavior. No issues found in the shown diff.

@Laughing-q Laughing-q changed the title fix: correct loss name from box_loss to cls_loss in TVPDetectLoss fix: correct loss name from box_loss to cls_loss in TVPDetectLoss Dec 25, 2025
@Laughing-q Laughing-q merged commit eef35e4 into ultralytics:main Dec 25, 2025
18 checks passed
@sentry

sentry Bot commented Dec 26, 2025

Copy link
Copy Markdown

Issues attributed to commits in this pull request

This pull request was merged and Sentry observed the following issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as intended in the official Ultralytics package. fixed Bug has been resolved python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants