Skip to content

Conversation

@onuralpszr
Copy link
Member

@onuralpszr onuralpszr commented Jan 6, 2026

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Adds a --max-det CLI option and standardizes the config/API naming from max_detections to max_det for consistent detection limits 🧰✅

📊 Key Changes

  • Renamed InferenceConfig field and builder method:
    • max_detectionsmax_det
    • with_max_detections(...)with_max_det(...) 🔁
  • Added CLI flag --max-det (default 300) to control the maximum number of detections returned per image 🖥️🎛️
  • Wired --max-det into prediction config creation so it affects runtime outputs ⚙️
  • Updated docs/examples (README.md, crate docs) and all unit/integration tests to match the new naming 📚🧪
  • Updated postprocessing paths (detect/segment/pose/OBB) to use config.max_det when limiting kept detections 🧩

🎯 Purpose & Impact

  • Improves consistency with common YOLO parameter naming (max_det), reducing confusion and aligning CLI + Rust API 🧠✨
  • Gives users an easy way to cap detections from the command line (useful for crowded scenes, speed, and output size control) 🚀📉
  • Breaking change for Rust users: code using with_max_detections or max_detections must be updated to the new names ⚠️🛠️
  • Keeps behavior the same by default (still 300), so most users won’t see changes unless they rely on the old API name 🔒✅

@onuralpszr onuralpszr self-assigned this Jan 6, 2026
@UltralyticsAssistant UltralyticsAssistant added the enhancement New feature or request label Jan 6, 2026
@UltralyticsAssistant
Copy link
Member

👋 Hello @onuralpszr, thank you for submitting a ultralytics/inference 🚀 PR! This is an automated message to help streamline review—an Ultralytics engineer will assist shortly. 😊

-✅ 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/inference 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! 🚀

Copy link
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

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

PR looks clean: the max_detectionsmax_det rename is applied consistently across README, crate docs, config defaults/builders, CLI wiring, postprocessing truncation points, and tests. No obvious logic bugs, missing wiring, or likely failure cases introduced in the shown diff.

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/postprocessing.rs 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@onuralpszr onuralpszr merged commit c5a349f into main Jan 6, 2026
9 checks passed
@onuralpszr onuralpszr deleted the feat/max-detection branch January 6, 2026 13:29
@UltralyticsAssistant
Copy link
Member

Merged! Huge thanks @onuralpszr for this thoughtful improvement to ultralytics/inference 🙌

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry

This PR is a great example of that mindset: standardizing max_detectionsmax_det and adding --max-det makes the CLI and Rust API cleaner, more consistent with YOLO conventions, and easier for users to control detection limits in real workloads—without changing default behavior. Also appreciate the thorough sweep across docs, tests, and postprocessing paths to keep everything aligned.

Thanks again for the polish and the care you put into the breaking-change migration path—this kind of consistency work compounds over time.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants