Skip to content
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

FRML-146 Migrate Preprocessing toward dataset for independent dataset processing #71

Merged
merged 4 commits into from
Jun 10, 2024

Conversation

Eve-ning
Copy link
Contributor

@Eve-ning Eve-ning commented Jun 10, 2024

Currently, the preprocessing step for our image and the label encoding are tightly coupled together, which causes large complicated workarounds. For example, leveraging the on_before_batch_transfer in our LightningModule inherited classes, then within that function, calling a 2-deep function preprocess, which made the complexity skyrocket.

We believe that the preprocessing should live within the dataset, specifically, the image processing.

However, we realized that if we preprocessed the tree labels in the dataset, results (as numbers) wouldn't make sense. Therefore, we're still opting to encode and decode that within the model, which makes sense in the long run as it can be then inferred standalone.

Major Changes

  • Preprocessing step for the input images (x) are now done in the dataset. Encoding/decoding of labels still remain in the model
  • The preprocessing step in on_before_batch_transfer is vastly simplified to just nan-mask out missing y labels
  • Construction of the StandardScaler and OrdinalEncoder are now done internally in the FRDCDataset and FRDCModule respectively
  • Introduced FRDCModule to reduce redundancy between MixMatch and FixMatch. This module handles:
    • Model Saving/Loading
    • X_step code signature consistency, due to our batch being an uncommon schematic
    • on_before_batch_transfer for nan-mask preprocessing of missing y labels
  • Explicitly use the same StandardScaler from training to be transfered to validation and test sets within the training scripts

@Eve-ning Eve-ning merged commit 0a4ef8a into 0.1.1 Jun 10, 2024
3 checks passed
@Eve-ning Eve-ning deleted the frml-146 branch June 10, 2024 09:44
@Eve-ning Eve-ning mentioned this pull request Jun 19, 2024
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.

1 participant