Skip to content

feat: multiple class support#9

Open
thomas-mattsson wants to merge 11 commits intoterrastackai:mainfrom
thomas-mattsson:main
Open

feat: multiple class support#9
thomas-mattsson wants to merge 11 commits intoterrastackai:mainfrom
thomas-mattsson:main

Conversation

@thomas-mattsson
Copy link
Copy Markdown

@thomas-mattsson thomas-mattsson commented Dec 18, 2025


Status

READY

Description

Adds possibility to name label files with a _CLASS_1_ part to indicate the class index of the label.

Which issue(s) does this pull-request fix?

Closes: #8


Checklist

  • Automated tests exist
  • Local unit tests performed
  • Documentation exists link
  • Local git lint performed
  • Desired commit message set as PR title and description set above
  • Link to relevant GitHub issue provided

@rosielickorish
Copy link
Copy Markdown
Collaborator

Thanks Thomas! Is there an example notebook that we could also include to demonstration how to use the multiple class functionality?

@romeokienzler
Copy link
Copy Markdown
Collaborator

@rosielickorish mind reviewing?

@rosielickorish
Copy link
Copy Markdown
Collaborator

@thomas-mattsson Have you had a chance to review the comments above. Please let me know if I can help so we can get this merged in!

Copy link
Copy Markdown
Collaborator

@rosielickorish rosielickorish left a comment

Choose a reason for hiding this comment

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

A few updates needed before approving:

  1. Remove data in place of dummy data.
  2. Add comments to documentation describing how to use this multi-class feature
  3. Separate out tests for processing multi-class labels and for downloading data from multi-class labels.
  4. Ensure tests run offline, i.e. using dummy data or mocking the data download

@thomas-mattsson
Copy link
Copy Markdown
Author

@rosielickorish, sorry for the delay, was ooo for a couple of weeks.
Made several changes:

  • several changes to plotting methods to properly show multiple classes
  • labels_do_data notebook updated with additional examples and with new plotting
  • replaced the dataset in examples/tests with the existing wildfire dataset, just using two different geometries for separate classes
  • added mock data for tests
  • added documentation on set_no_data and _CLASS_*_ pattern

Copy link
Copy Markdown
Collaborator

@rosielickorish rosielickorish left a comment

Choose a reason for hiding this comment

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

Hi Thomas, Changes look great, especially the new plots. I have a change set prepare to pick up on some on the points made in this review. I hope that is ok to include here. My only outstanding comment is for ensuring that we have two working negative tests for processing class labels and downloading data from class labels. If you could let me know your thoughts in this, that would be great, thank you.

@rosielickorish
Copy link
Copy Markdown
Collaborator

I have pushed some changes to https://github.com/thomas-mattsson/terrakit/commits/main/ to be included in this PR.

Copy link
Copy Markdown
Collaborator

@rosielickorish rosielickorish left a comment

Choose a reason for hiding this comment

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

Looks good. Just need to update test_process_labels__with_class_zero to check that process_labels fails as expected when given incorrect or badly formatted class labels.

Copy link
Copy Markdown
Collaborator

@rosielickorish rosielickorish left a comment

Choose a reason for hiding this comment

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

Also just need to move test_download_data__class_zero_conflict_raises_error to test_download_data_invalid_params.py since it is testing invalid parameters!

Signed-off-by: Thomas Mattsson <thomas.mattsson@se.ibm.com>
@thomas-mattsson
Copy link
Copy Markdown
Author

@rosielickorish, pushed the updates to the tests according to the latest review comments. Had to clean up a bad rebase but looks good now.

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.

Support for multiple classes for segmentation use cases

3 participants