-
Notifications
You must be signed in to change notification settings - Fork 6
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
refac: Move N2V masking in lightning module #365
base: main
Are you sure you want to change the base?
Conversation
There are missing docs in the torch N2V manipulate: https://results.pre-commit.ci/run/github/607105530/1737501613.FBC6iWDHTgWR3WhJeX4o9A |
if self.algorithm == "n2v": | ||
x_preprocessed, *aux = self.preprocess(x) | ||
else: | ||
x_preprocessed = x |
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.
In self.preprocess
, non-N2V algorithm returns Identity
. Why is it not used here?
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 agree, then can remove the "if self.algorithm == "n2v"
"
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.
Because in other cases input to the Identity can be a list, which won't work. This whole construction is quite ugly, and definitely needs revisiting.
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've just tested it and I get
>>> torch.nn.Identity()([torch.tensor([1,2,3])])
[tensor([1, 2, 3])]
This is the case where targets
are a list?
I've also noticed this function is typed incorrectly batch should have the type list[torch.Tensor]
I believe.
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.
Haven't looked at everything fully, left a few comments
if self.algorithm == "n2v": | ||
x_preprocessed, *aux = self.preprocess(x) | ||
else: | ||
x_preprocessed = x |
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 agree, then can remove the "if self.algorithm == "n2v"
"
@melisande-c @jdeschamps @veegalinova Thanks for the comments, I'll take a look. Another thing is there's probably some inconsistencies in the configuration factories. Like I'm not sure N2V transform should be defined there |
A summary of the latest changes since the reviews:
There are some stuff that will need refactoring or splitting into multiple functions, but better open issues and deal with them later at this point. |
Changes Made
Additional Notes and Examples
Please ensure your PR meets the following requirements: