Closed melisande-c closed 3 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 87.09%. Comparing base (
427fa26
) to head (d357239
). Report is 6 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Yes, the N2VManipulate is annoying. We could pack some of the return arrays into one... Dirty and not clear...
Another way would be to inspect again the loss. If I remember it there is a reason to return the three arguments, but maybe we can rewrite it to only need mask * original_patch
. (Unfortunately it probably needs the original patch for something).
For the sake of the LVAE submission, let's merge it as it. But we should open issues about the following:
target
be folded in the additional arrays? Would require an additional PR.patch
and mask
, but just patch * mask
.
Description
XYFilp
andXYRandomRotate90
to transform additional arrays identically to the patch and target. Include the ability to compose these transforms. Also fixed some type hint issues, but some remain.Albumentations
library. Original motivation came from this comment chain https://github.com/CAREamics/careamics/pull/223#discussion_r1733656634.__call__
function as kwargs, and they will be returned as a dict after the augmented patch and target. Composition of transforms with additional arrays has been kept as a separate method,Compose.transform_with_additional_arrays
, mostly to not have to change too much of the code base, this can be revised and integrated withCompose.__call__
later if desired.Changes Made
_chain_transforms_additional_arrays
andtransform_with_additional_arrays
methods toCompose
.**additional_arrays: NDArray
argument to the__call__
method of some transforms.Breaking changes
Code calling transforms directly, the output is now a tuple of 3 rather than 2.
Additional Notes and Examples
Note
One of the biggest pain points that hasn't been fully resolved is that the
N2VManipulate
transform doesn't have the same function signature in the__call__
method as the other transforms, it returns 3 arrays rather than 2. We know it gets applied last in the algorithm but we could make it more explicit somehow, this would resolve some annoying type hinting.Converting LVAE transform code
https://github.com/CAREamics/careamics/blob/b008187292f269455272c92c9009d45a330e7ca0/src/careamics/lvae_training/dataset/vae_dataset.py#L867-L881
To convert the code snippet above, I think (not tested) the following can be done, assuming
self.rotation_transform
is created using the CAREamicsCompose
instead of that from Albumentations:Please ensure your PR meets the following requirements: