Repository navigation
Add line_width, show_labels, show_conf and show_boxes drawing options - #632
Conversation
…and labels like Ultralytics Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
|
👋 Hello @onuralpszr, thank you for submitting a
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
left a comment
There was a problem hiding this comment.
🔍 PR Review
Made with ❤️ by Ultralytics Actions
Reviewed the annotation rendering changes and their CLI wiring. The new controls are connected, but pose joints can be overwritten by skeleton lines and thick-label rendering adds a quadratic cost at common high-resolution image sizes.
💬 Posted 2 inline comments
- 💡 MEDIUM
src/annotate.rs:642This rasterizes and composites the entire label once for every(dx, dy)pair, making label drawing quadratic in line width. For a 4K image, the default width is about 12, so every label takes 36 full text-render passes; frames with many detections can spend substantially more time annotating than before. Render the thickened glyphs in one pass or otherwise avoid repeating the full text draw for each offset. - 📝 LOW
src/annotate.rs:852This draws each keypoint circle before its skeleton limbs, so the limb is painted over the joint center and can replace the keypoint’s distinct palette color. The previous implementation drew limbs first; draw the limbs before the circles (or redraw the circles afterward).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…pass Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 2
Made with ❤️ by Ultralytics Actions
The label thickening change addresses the prior performance finding. The pose draw order issue remains: skeleton lines can overwrite keypoint centers. Reviewed the annotation rendering and CLI wiring; no other concrete issues found.
💬 Posted 1 inline comment
- 📝 LOW
src/annotate.rs:902Withkpt_lineenabled, the skeleton limbs are drawn after these circles, so each limb can overwrite the joint-center pixels with its limb color (and thicker limbs overwrite a strip of the joint). This loses the distinct keypoint palette colors; draw limbs first or redraw the circles afterward.
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 3
Made with ❤️ by Ultralytics Actions
Since review 2, the label-thickening performance issue is addressed; the pose draw order was explained as intentional parity and is not repeated. The annotation options and CLI wiring look sound, with one remaining OBB label-anchor regression noted above.
💬 Posted 1 inline comment
- 📝 LOW
src/annotate.rs:761For OBBs, independently taking the minimum x and y can anchor the label at a different vertex frompoints[0](at angle 0, it moves to the opposite corner). The previous OBB renderer anchored labels at corner 0, so rotated-box labels can now appear detached from their prior anchor. Use corner 0 for OBB labels and the minima for axis-aligned boxes.
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 4
Made with ❤️ by Ultralytics Actions
Since the last review, the thick-label performance issue is addressed; the pose draw order and OBB label anchor were explained as intentional Python parity and are not repeated. The new clipping guard drops partially visible pose limbs when a keypoint is off-frame. The remaining drawing-option and CLI wiring looks sound.
💬 Posted 1 inline comment
- 📝 LOW
src/annotate.rs:915If either keypoint has a negative x or y coordinate, this skips the entire limb—even when part of it crosses the image and should be visible.draw_linealready clips to the image bounds, so let it draw the segment rather than rejecting it here.
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 5
Made with ❤️ by Ultralytics Actions
Since review 4, the earlier rendering findings are addressed or settled by the stated Python-parity behavior; the new drawing options and CLI wiring introduce no additional concrete issues. LGTM.
|
🎉 This PR has been merged! Thank you, @onuralpszr, for adding configurable annotation styling to the API and CLI and aligning rendering across annotation types.
These options give users more control over how prediction results are displayed. |
Adds line_width, show_labels, show_conf and show_boxes to the drawing options and the CLI, and draws boxes, labels, masks, pose and classification text the same way Python does. Checked side by side with Python for detect, segment, classify, pose and obb.
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Added configurable box, label, confidence, and line-width drawing options to the annotation API and prediction CLI, with rendering updated to follow Ultralytics plot styling.
📊 Key Changes
line_width,show_boxes,show_labels, andshow_conftoAnnotateOptions; defaults keep boxes, class names, and confidence visible, while line width is derived from image size unless set.🎯 Purpose & Impact
show_boxesto false skips box outlines and their labels, while segmentation masks are still drawn.