-
Notifications
You must be signed in to change notification settings - Fork 3
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
Updated code (contrastive learning) #130
Conversation
self.tracks = self._filter_tracks(tracks_tables) | ||
self.tracks = ( | ||
self._specific_cells(self.tracks) if self.predict_cells else self.tracks | ||
) | ||
|
||
def _filter_tracks(self, tracks_tables: list[pd.DataFrame]) -> pd.DataFrame: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ziw-liu please edit docstrings related to processing of tracking info for accuracy.
channel_wise=False, | ||
dtype=None, | ||
allow_missing_keys=False | ||
), | ||
] | ||
|
||
def main(hparams): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's clean up the predict.py in the next PR
features_output_path: str = "", | ||
projections_output_path: str = "", | ||
metadata_output_path: str = "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like these three paths are needed to save predictions. I suggest renaming these three to predict_output_path
and assign these three variables a consistent names, predict_output_path + features.npy
, projecttions.npy
, meta.csv
...
trainer.fit(model, datamodule=data_module) | ||
|
||
# # Validate the model | ||
trainer.validate(model, datamodule=data_module) | ||
|
||
# # Test the model | ||
# trainer.test(model, datamodule=data_module) | ||
|
||
# Argument parser for command-line options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alishbaimran In the next PR, this training script should be turned into a config for use with lightning CLI and then deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am merging this PR to unblock the rest of the improvements in model construction. Let's revisit comments in this PR to:
- delete applications/contrastive_phenotyping/training_script.py
- clean up predict.py.
- document key methods in viscy.data.triplet.py
- clean up excess input parameters to viscy.light.engine.ContrastiveModule
* updated prediction code to test specific cells * updated kernel and stride * updated kernel and stride * new training script and predict takes in output path as parameter * passing ci requirements * fixed error for output path * fixed error for output path * fixed formatting * format resolved * docstrings for methods that parse tracks --------- Co-authored-by: Shalin Mehta <[email protected]>
* updated prediction code to test specific cells * updated kernel and stride * updated kernel and stride * new training script and predict takes in output path as parameter * passing ci requirements * fixed error for output path * fixed error for output path * fixed formatting * format resolved * docstrings for methods that parse tracks --------- Co-authored-by: Shalin Mehta <[email protected]>
I made the following changes:
—> Updated triplet code such that during prediction evaluation can be done for specific pre-defined cells.
—> Changed stride to be the same as stem kernel size which was also changed to (5, 4, 4).
—> Output file name is configurable for the prediction.
—> Updated training_script.py and predict.py
To-do:
—> Should be merged before any other branches merged into main.