Skip to content

Add support for mask pair#41

Merged
IgorSusmelj merged 13 commits intomainfrom
add-support-for-mask-pair-is
Sep 27, 2025
Merged

Add support for mask pair#41
IgorSusmelj merged 13 commits intomainfrom
add-support-for-mask-pair-is

Conversation

@IgorSusmelj
Copy link
Copy Markdown
Contributor

Changes

  • adds support for a data format where we have a folder of images and a folder with masks. We load the masks and turn them into polygon or RLE masks.
  • add loader in CLI and code
  • adds new tests

@IgorSusmelj IgorSusmelj requested a review from Copilot September 3, 2025 20:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/labelformat/cli/cli.py Outdated
Comment thread tests/unit/test_mask_utils.py Outdated
Comment thread tests/integration/test_maskpair_integration.py
Comment thread tests/integration/test_maskpair_integration.py
Comment thread src/labelformat/mask_utils.py Outdated
Comment thread src/labelformat/mask_utils.py Outdated
Comment thread src/labelformat/mask_utils.py Outdated
Comment thread src/labelformat/mask_utils.py
Comment thread src/labelformat/cli/cli.py
Comment thread src/labelformat/formats/maskpair.py
Comment thread src/labelformat/mask_utils.py
Copy link
Copy Markdown
Contributor

@MalteEbner MalteEbner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/labelformat/cli/cli.py
Comment thread src/labelformat/formats/labelformat.py
Comment thread src/labelformat/formats/maskpair.py Outdated
Comment thread src/labelformat/formats/maskpair.py Outdated
Comment thread src/labelformat/formats/maskpair.py Outdated
Comment thread pyproject.toml
Comment thread src/labelformat/mask_utils.py
Comment thread src/labelformat/mask_utils.py Outdated
Comment thread src/labelformat/model/binary_mask_segmentation.py Outdated
Comment thread src/labelformat/mask_utils.py
@IgorSusmelj IgorSusmelj merged commit 1d3c8f2 into main Sep 27, 2025
2 checks passed
@IgorSusmelj IgorSusmelj deleted the add-support-for-mask-pair-is branch September 27, 2025 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants