feat: adjust visualization to scale with image size#482
Merged
tybulewicz merged 2 commits intomasterfrom Feb 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automatic scaling of visualization primitives so annotations remain readable on high-resolution images, using centralized default constants and propagating a computed scale factor through scenes/primitives.
Changes:
- Introduces
auto_scaletoVisualizerand computes a scale factor from image size. - Propagates
scalethrough scenes and applies it to font sizes, outline widths, keypoint sizes, and overlay labels. - Centralizes visualization defaults (font size, opacity, outline width, baseline) in
defaults.pyand adds unit tests.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/visualizer/test_auto_scale.py | Adds unit tests for scale-factor computation and scale propagation/rendering behavior. |
| src/model_api/visualizer/visualizer.py | Adds auto_scale and scale-factor computation; passes scale into scenes. |
| src/model_api/visualizer/scene/segmentation/segmentation.py | Scales overlay label font sizes in segmentation overlays. |
| src/model_api/visualizer/scene/segmentation/instance_segmentation.py | Scales label, polygon outline, bbox outline, and overlay label font sizes. |
| src/model_api/visualizer/scene/keypoint.py | Scales keypoint radius and score font size. |
| src/model_api/visualizer/scene/detection.py | Scales bbox outline/font and overlay label font sizes. |
| src/model_api/visualizer/scene/classification.py | Scales classification label sizes. |
| src/model_api/visualizer/scene/anomaly.py | Scales anomaly overlays, bbox outline/font, label size, and polygon outline width. |
| src/model_api/visualizer/primitive/polygon.py | Uses centralized default opacity/outline width constants. |
| src/model_api/visualizer/primitive/overlay.py | Adds font_size and scales overlay label rendering parameters. |
| src/model_api/visualizer/primitive/label.py | Uses centralized default font size constant. |
| src/model_api/visualizer/primitive/keypoints.py | Adds configurable font size and uses centralized defaults. |
| src/model_api/visualizer/primitive/bounding_box.py | Adds configurable outline width/font size for bbox rendering. |
| src/model_api/visualizer/layout/hstack.py | Passes overlay font size into Overlay.overlay_labels(). |
| src/model_api/visualizer/defaults.py | Introduces centralized visualization default constants and baseline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
tybulewicz
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Add auto_scale parameter to Visualizer that automatically scales drawing primitives (font sizes, line widths, keypoint radius) relative to a 1280px baseline for large images, with centralized default constants in defaults.py.
Fixes #480
Before
After