Repository navigation
feat: noise relative to the sample's own spread with RandomGaussianNoiseGPU(relative=True) - #147
Open
Hendrik-code wants to merge 1 commit into
Open
Hendrik-code wants to merge 1 commit into
Hendrik-code wants to merge 1 commit into
Conversation
…iseGPU(relative=True) The noise std is drawn from U(0, std) in absolute intensity units, so one config is a different augmentation on every intensity scale. With the paper config's std 1.0 a z-scored MR patch (std ~0.9) gets noise up to about its own spread, a CT patch under nnU-Net's CT normalisation (std ~0.17) up to six times its spread, and a [0, 1] SynthSeg synthesis (std ~0.18) likewise. `relative=True` reads `std` as a fraction of each sample's std in that channel, which makes the transform scale-equivariant. The scale is applied after both random draws, so the noise field is the absolute one rescaled per sample. `mean` stays absolute. Default False; the absolute path is arithmetically unchanged (the per-sample and batch stds now broadcast through the same reshape, which multiplies by the same value). Also corrects the docstring, which gave the default std as 0.1; it is 1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
RandomGaussianNoiseGPUtakesrelative(defaultFalse). When set,stdis read as a fraction of each sample's own std in that channel, not in absolute intensity units:Why
The std is drawn from
U(0, std)in absolute units, so one config is a different augmentation on every intensity scale. Measured on 128³ training patches, image std is about 0.9 on z-scored Dixon MR, 0.17 on CT under nnU-Net's CT normalisation, and 0.16-0.20 on a[0, 1]SynthSeg synthesis. The paper config'sstd: 1.0therefore means:For scale, nnU-Net's default noise std is at most 0.1 on z-scored data (from memory of batchgenerators'
noise_variance=(0, 0.1), which it uses as the std).Behaviour
meanstays absolute.Tests
unit_tests/test_gaussian_noise_relative.py:Full suite:
477 passed, 13 skipped.mypy smauglab/clean, pre-commit passes.🤖 Generated with Claude Code