From 2c44113218e7484993edb9de81857303747235f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hendrik=20M=C3=B6ller?= Date: Mon, 26 Oct 2026 16:57:41 +0000 Subject: [PATCH] configs: ship PALETTE arms against the current setup, and build-test the paper configs `RandomPaletteGPU` has been on main since the palette restack, but no shipped config runs it, so there was no way to train the published PALETTE arms from this repo. The only configs that did live on the `palette` branch, 274 commits back and written against the pre-rename `auglab` schema (`probability`, `mix_in_out`, `ImageContrastV26_6_2GPUTransform`). Two configs, both translations of arms from that branch: * `transform_params_paper-palette.json` -- PALETTE at p=1.0 in the frame `transform_params_paper-synthseg.json` defines, with SynthSeg removed and every other key untouched. The two therefore differ in one augmentation, which makes PALETTE and SynthSeg comparable as synthesis methods rather than as two differently-tuned pipelines. * `transform_params_paper-palette-ours.json` -- the paper `Ours` config plus PALETTE at p=0.5, which is the `train050` arm. Every PALETTE parameter the `train050` arm set -- c_choices, s_choices, blur_sigmas, dark_threshold, n_kmeans_subsample, skip_parcellation_prob, skip_sub_parc_prob, alpha_magnitude_range, label_remap_prob, min_label_voxels, label_classes -- is byte-for-byte the registry default here, so both configs carry `p` and nothing else rather than restating values that would then be free to drift. `gpu_config_paths` now also covers `transform_params_paper-*`. Those configs were checked for JSON validity and nothing else, so neither the new ones nor `transform_params_paper-synthseg.json` -- the config the published `SynthSeg (post)` arm trained on -- was ever built or run by the suite. All five build and push a volume through. Co-Authored-By: Claude Opus 5 --- .gitignore | 4 + .../transform_params_paper-palette-ours.json | 233 ++++++++++++++++++ .../transform_params_paper-palette.json | 233 ++++++++++++++++++ unit_tests/helpers.py | 9 +- 4 files changed, 478 insertions(+), 1 deletion(-) create mode 100644 smauglab/configs/transform_params_paper-palette-ours.json create mode 100644 smauglab/configs/transform_params_paper-palette.json diff --git a/.gitignore b/.gitignore index 794750d..cc809a6 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,10 @@ MANIFEST # configs beside it are tracked only because they predate the blanket rule above; # a new one has to say so. !smauglab/configs/transform_params_paper-synthseg.json +# PALETTE, alone and on top of the paper `Ours` config. Same status as the +# SynthSeg arm beside them: a method the tables compare against, not a sweep. +!smauglab/configs/transform_params_paper-palette.json +!smauglab/configs/transform_params_paper-palette-ours.json *.yaml *.nii *.nii.gz diff --git a/smauglab/configs/transform_params_paper-palette-ours.json b/smauglab/configs/transform_params_paper-palette-ours.json new file mode 100644 index 0000000..4fd123d --- /dev/null +++ b/smauglab/configs/transform_params_paper-palette-ours.json @@ -0,0 +1,233 @@ +{ + "GPU": { + "RandomFlipTransformGPU": { + "flip_axis": [ + 0 + ], + "same_on_batch": false, + "keepdim": true, + "p": 0.5 + }, + "RandomAffineGPU": { + "degrees": 5, + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "scale": [ + 0.7, + 1.4 + ], + "shears": [ + -5, + 5, + -5, + 5, + -5, + 5 + ], + "resample": "bilinear", + "p": 0.0 + }, + "RandomInverseGPU": { + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "mix_prob": 0.0, + "p": 0.25 + }, + "RandomHistogramEqualizationGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": true, + "mix_prob": 0.6, + "p": 0.25 + }, + "RandomRedistributeSegGPU": { + "in_seg": 0.25, + "retain_stats": true, + "p": 0.4 + }, + "RandomScharrGPU": { + "absolute": true, + "retain_stats": true, + "mix_prob": 0.5, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.25 + }, + "RandomUnsharpMaskGPU": { + "sigma": 1.0, + "unsharp_amount": 1.5, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "mix_prob": 0.5, + "p": 0.25 + }, + "RandomRandConvGPU": { + "kernel_sizes": [ + 3, + 5, + 7 + ], + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "mix_prob": 0.5, + "p": 0.2 + }, + "RandomClampGPU": { + "max_clamp_amount": 0.2, + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.0 + }, + "RandomGaussianNoiseGPU": { + "mean": 0.0, + "std": 1.0, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.1 + }, + "RandomGaussianBlurGPU": { + "sigma": 1.0, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.2 + }, + "RandomBrightnessGPU": { + "brightness_range": [ + 0.75, + 1.25 + ], + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.15 + }, + "RandomGammaGPU": { + "gamma_range": [ + 0.7, + 1.5 + ], + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.3 + }, + "RandomInvGammaGPU": { + "gamma_range": [ + 0.7, + 1.5 + ], + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.1 + }, + "RandomContrastGPU": { + "contrast_range": [ + 0.75, + 1.25 + ], + "retain_stats": false, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.15 + }, + "RandomLog1pGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomSqrtGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomSinGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomExpGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomSigmoidGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomLowResTransformGPU": { + "scale": [ + 0.5, + 1.0 + ], + "same_on_batch": false, + "p": 0.25 + }, + "RandomAcqTransformGPU": { + "scale": [ + 0.6, + 1.0 + ], + "same_on_batch": false, + "p": 0.0 + }, + "RandomBiasFieldGPU": { + "retain_stats": true, + "coefficients": 0.2, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.15 + }, + "ZscoreNormalizationGPU": { + "p": 0.0 + }, + "RandomPaletteGPU": { + "p": 0.5 + } + }, + "CPU": { + "SpatialTransform": { + "patch_center_dist_from_border": 80, + "random_crop": false, + "p_elastic_deform": 0.0, + "p_rotation": 0.2, + "p_scaling": 0.2, + "scaling": [ + 0.7, + 1.4 + ], + "p_synchronize_scaling_across_axes": 1, + "bg_style_seg_sampling": false, + "mode_seg": "nearest" + } + } +} diff --git a/smauglab/configs/transform_params_paper-palette.json b/smauglab/configs/transform_params_paper-palette.json new file mode 100644 index 0000000..6fb08f6 --- /dev/null +++ b/smauglab/configs/transform_params_paper-palette.json @@ -0,0 +1,233 @@ +{ + "GPU": { + "RandomFlipTransformGPU": { + "flip_axis": [ + 0 + ], + "same_on_batch": false, + "keepdim": true, + "p": 0.5 + }, + "RandomAffineGPU": { + "degrees": 5, + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "scale": [ + 0.7, + 1.4 + ], + "shears": [ + -5, + 5, + -5, + 5, + -5, + 5 + ], + "resample": "bilinear", + "p": 0.0 + }, + "RandomInverseGPU": { + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "mix_prob": 0.0, + "p": 0.0 + }, + "RandomHistogramEqualizationGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": true, + "mix_prob": 0.6, + "p": 0.0 + }, + "RandomRedistributeSegGPU": { + "in_seg": 0.25, + "retain_stats": true, + "p": 0.0 + }, + "RandomScharrGPU": { + "absolute": true, + "retain_stats": true, + "mix_prob": 0.5, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.0 + }, + "RandomUnsharpMaskGPU": { + "sigma": 1.0, + "unsharp_amount": 1.5, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "mix_prob": 0.5, + "p": 0.0 + }, + "RandomRandConvGPU": { + "kernel_sizes": [ + 3, + 5, + 7 + ], + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "mix_prob": 0.5, + "p": 0.0 + }, + "RandomClampGPU": { + "max_clamp_amount": 0.2, + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.0 + }, + "RandomGaussianNoiseGPU": { + "mean": 0.0, + "std": 1.0, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.1 + }, + "RandomGaussianBlurGPU": { + "sigma": 1.0, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.2 + }, + "RandomBrightnessGPU": { + "brightness_range": [ + 0.75, + 1.25 + ], + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.15 + }, + "RandomGammaGPU": { + "gamma_range": [ + 0.7, + 1.5 + ], + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.3 + }, + "RandomInvGammaGPU": { + "gamma_range": [ + 0.7, + 1.5 + ], + "retain_stats": true, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.1 + }, + "RandomContrastGPU": { + "contrast_range": [ + 0.75, + 1.25 + ], + "retain_stats": false, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.15 + }, + "RandomLog1pGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomSqrtGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomSinGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomExpGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomSigmoidGPU": { + "retain_stats": true, + "in_seg": 0, + "out_seg": 0, + "mix_in_out": false, + "p": 0.1 + }, + "RandomLowResTransformGPU": { + "scale": [ + 0.5, + 1.0 + ], + "same_on_batch": false, + "p": 0.25 + }, + "RandomAcqTransformGPU": { + "scale": [ + 0.6, + 1.0 + ], + "same_on_batch": false, + "p": 0.0 + }, + "RandomBiasFieldGPU": { + "retain_stats": true, + "coefficients": 0.2, + "in_seg": 0.0, + "out_seg": 0.0, + "mix_in_out": true, + "p": 0.15 + }, + "ZscoreNormalizationGPU": { + "p": 0.0 + }, + "RandomPaletteGPU": { + "p": 1.0 + } + }, + "CPU": { + "SpatialTransform": { + "patch_center_dist_from_border": 80, + "random_crop": false, + "p_elastic_deform": 0.0, + "p_rotation": 0.2, + "p_scaling": 0.2, + "scaling": [ + 0.7, + 1.4 + ], + "p_synchronize_scaling_across_axes": 1, + "bg_style_seg_sampling": false, + "mode_seg": "nearest" + } + } +} diff --git a/unit_tests/helpers.py b/unit_tests/helpers.py index 8c12622..d5c6578 100644 --- a/unit_tests/helpers.py +++ b/unit_tests/helpers.py @@ -99,9 +99,16 @@ def all_config_paths() -> list[Path]: return sorted(p for p in configs_dir().glob("*.json")) +#: Prefixes of the configs that drive the GPU pipeline. `transform_params_paper-` is +#: here because the published method arms use it and were covered only by the +#: JSON-validity check: `transform_params_paper-synthseg.json` is the config the +#: `SynthSeg (post)` benchmark arm trained on and nothing built it. +GPU_CONFIG_PREFIXES = ("transform_params_gpu", "transform_params_paper-") + + def gpu_config_paths() -> list[Path]: """Configs that drive the GPU augmentation pipeline.""" - paths = [p for p in all_config_paths() if p.name.startswith("transform_params_gpu")] + paths = [p for p in all_config_paths() if p.name.startswith(GPU_CONFIG_PREFIXES)] extra = configs_dir() / "transform_params_one-sequence-to-segment-them-all.json" if extra.is_file(): paths.append(extra)