Skip to content

background mask option for pseudo labeler - unsupervised training #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

stmartineau99
Copy link
Contributor

@stmartineau99 stmartineau99 commented Jul 22, 2025

  • added new class NewPseudoLabeler to subtract background from the pseudo labels if a background mask is given
  • updated get_unsupervised_loader to handle 4 cases:
  1. both sample mask and background mask are given, this will be be used by the train loader
  2. sample mask only, this will be used by the validation loader
  3. background mask only, not implemented error
  4. neither mask given, use the default behavior
  • created new classes to ensure that get_unsupervised_loader handles each case correctly: DropChannel, ChannelWiseRawTransform, ChannelWiseAugmentations
  • updated mean_teacher_adaptation to use the NewPseudoLabeler if the background mask is given
  • added subclass NewMeanTeacherTrainer, which drops the background mask from the teacher input after computing pseudo labels. it also drops the background mask from the student input since this is not used. This behavior only occurs when it recieves training data, and not for validation.
  • fixed the NewPseudoLabeler so that it behaves correctly when it recieves training and validation data, since in the case of validation there is no background mask channel.

Copy link
Contributor

@constantinpape constantinpape left a comment

Choose a reason for hiding this comment

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

This looks very good now! The only things to address:

  • You are not actually using the new class for the mean teacher trainer.
  • Some cosmetics.

See details in the comments.

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.

2 participants