Better normalization supporting different normalization transforms for input/target and different normalization per channel#34
Open
wli51 wants to merge 2 commits into
Conversation
…eDataset and CropImageDataset for training with input and target that can take different value ranges
d33bs
approved these changes
Jul 13, 2026
| self, | ||
| transforms: Optional[Sequence[LoggableTransform]], | ||
| name: str, | ||
| ) -> Sequence[LoggableTransform]: |
Member
There was a problem hiding this comment.
Consider adding docstrings to help describe this and other parts of this work.
Comment on lines
+162
to
+176
| def _apply_input_transforms( | ||
| self, | ||
| image: np.ndarray, | ||
| ) -> np.ndarray: | ||
| for transform in self.input_transforms: | ||
| image = transform.apply(img=image) | ||
| return image | ||
|
|
||
| def _apply_target_transforms( | ||
| self, | ||
| image: np.ndarray, | ||
| ) -> np.ndarray: | ||
| for transform in self.target_transforms: | ||
| image = transform.apply(img=image) | ||
| return image |
Member
There was a problem hiding this comment.
These feel mostly duplicative. Is there an abstraction you could use for both cases?
| ## Overview | ||
|
|
||
| This subpackage consists of three modules: | ||
| This subpackage consists of four modules: |
Member
There was a problem hiding this comment.
Consider avoiding specific numeric documentation to help reduce the diff over time.
| ) | ||
|
|
||
| channelwise_transform = ChannelwiseTransform( | ||
| transforms=[ |
Member
There was a problem hiding this comment.
I'm liking how the transforms are listed in this PR, nice!
|
|
||
| class ChannelwiseTransform(LoggableTransform): | ||
| """ | ||
| Apply a list of transforms to a channel-first image, one transform per channel. |
Member
There was a problem hiding this comment.
Consider providing a simple example of an image set and transforms along with how they'd be transformed.
| f"channels={len(self._transforms)}, p={self.p})" | ||
| ) | ||
|
|
||
| def to_config(self) -> dict: |
Member
There was a problem hiding this comment.
Consider being more descriptive with this function name - for ex. what kind of config?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Useful for training models whose input and target takes different ranges and experimenting with input engineering combining multiple channels of different value ranges