Repository navigation
feat: z-score the SynthSeg synthesis on request with zscore_output - #146
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
With SynthSeg's default `normalise=True` the synthesis is min-max scaled to [0, 1]. The real training patches it is mixed with are z-scored, so the synthetic samples reach every later transform at about a fifth of the spread of a real one: measured 0.16-0.20 against 0.86-0.91 on two Dixon datasets. Transforms that work in absolute units then act on them at several times their strength on real samples. RandomGaussianNoiseGPU draws its std from U(0, std), and with the paper config's std 1.0 the synthesis was buried under noise in 16 of 20 firings in a measured sample (label boundaries no longer stood out from the background gradient). `zscore_output=True` standardises each synthesised sample over its patch before it replaces the image. It draws no random numbers, so the same seed gives the same synthesis up to that rescale. Default False keeps the [0, 1] output and every shipped config's seeded result. 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
RandomSynthSegGPUtakeszscore_output(defaultFalse). When set, each synthesised sample is standardised over its patch before it replaces the image:Why
With SynthSeg's default
normalise=Truethe synthesis is min-max scaled to[0, 1], while the real patches beside it are z-scored. Measured on the 128³ training patches of four SpineGAN datasets (two cases each, five draws): the image std after SynthSeg is 0.16-0.20, against 0.86-0.91 for the Dixon in-phase and fat inputs.Every later transform that works in absolute units then acts on the synthetic samples at several times its strength on the real ones. The visible case is
RandomGaussianNoiseGPU, whose std is drawn fromU(0, std): at the paper config'sstd: 1.0, the noise std exceeds the image's in about 80% of firings on a SynthSeg sample. In the measured sample, 16 of 20 noise firings after SynthSeg left the label boundaries indistinguishable from the background gradient (mean |∇I| on label boundaries ÷ mean |∇I| over the slice fell from 1.8-2.8 to 1.0-1.3). That affects the publishedSynthSeg (post)configuration (transform_params_paper-synthseg.json), where noise is on atp: 0.1and SynthSeg atp: 1.0.Behaviour
False: shipped configs and their seeded outputs are unchanged.all_augmentations.jsonregenerated (smauglab matrix --write).Tests
unit_tests/test_synthseg_zscore_output.py:[0, 1];Full suite:
477 passed, 13 skipped.mypy smauglab/clean, pre-commit passes.🤖 Generated with Claude Code