Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes semantic segmentation mask output to ensure proper alignment with original images and improved visualization quality. The changes address letterbox scaling issues where masks were not correctly resized to match input image dimensions.
- Adds post-processing to resize segmentation masks back to original image dimensions after correcting for letterbox scaling
- Improves visualization by ensuring mask and image size consistency and adjusting color conversion and blending ratios
- Adds bounds checking for class IDs to prevent invalid values
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| mmros/src/detector/semantic_segmenter2d.cpp | Implements proper mask resizing logic to handle letterbox scaling and restore original image dimensions |
| mmrviz/src/visualizer/segmentation2d_visualizer.cpp | Adds size validation and improves color conversion/blending for better visualization quality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
ebf47a5 to
30c9300
Compare
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.
Description
This PR tackles the issue #3.
This pull request improves the accuracy and visual quality of 2D semantic segmentation results by refining how segmentation masks are post-processed and visualized. The main changes ensure that segmentation masks are properly scaled and aligned with the original images, and that the visualization overlay is more consistent and visually clear.
Semantic segmentation mask post-processing:
opencv2/imgproc.hpp) was added to support the resizing operations.Visualization improvements:
How was this PR tested?
Screencast.from.09-28-2025.08.36.22.AM.webm
Notes for reviewers
None.
Effects on system behavior
None.