Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for a MaskPair input format that enables loading instance segmentation data from separate folders of images and corresponding mask files. The masks are processed to extract connected components and converted to either polygon or RLE segmentation formats.
Key changes:
- Implements MaskPair format with flexible image-to-mask pairing strategies (stem matching, regex ID extraction, sorted index)
- Adds comprehensive mask processing utilities including binarization, morphological operations, and connected component analysis
- Integrates the new format into the CLI with full argument support
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/labelformat/mask_utils.py |
Core mask processing utilities for binarization, connected components, and polygon tracing |
src/labelformat/formats/maskpair.py |
Main MaskPair format implementation with CLI integration |
src/labelformat/formats/__init__.py |
Export registration for the new MaskPair format |
src/labelformat/cli/cli.py |
CLI registry fix for output format choices |
tests/unit/test_mask_utils.py |
Comprehensive unit tests for mask utilities |
tests/integration/test_maskpair_integration.py |
Integration tests for MaskPair to COCO conversion |
tests/integration/test_maskpair_cli.py |
CLI integration tests for MaskPair format |
pyproject.toml |
Development dependency addition for OpenCV |
README.md |
Documentation updates with usage examples |
IgorSusmelj
commented
Sep 4, 2025
IgorSusmelj
commented
Sep 4, 2025
IgorSusmelj
commented
Sep 4, 2025
MalteEbner
reviewed
Sep 4, 2025
Contributor
MalteEbner
left a comment
There was a problem hiding this comment.
Can you clarify whether this supports multi-class or only single-class segmentation masks? Also add this information to docstrings or similar. I assume that it only support single-class segmentation masks.
MalteEbner
approved these changes
Sep 15, 2025
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.
Changes