Skip to content

Configuration ​

The complete config schema for run_pipeline. Every unspecified key gets a documented default; this page mirrors PARAMETER_REFERENCE.md in the repository.

Schema ​

python
config = {
    'input_data': '<stack.tif>',      # REQUIRED
    ... top-level keys ...,
    'mask':    { 'source': ..., 'extractor': {...} },
    'recipes': { 'n2v': {...}, 'structn2v': {...} },
}

Top Level ​

KeyDefaultNotes
input_data—REQUIRED; multi-page TIFF stack (N, H, W)
clean_dataNoneoptional GT stack; enables the auxiliary PSNR diagnostic only
output_dir'./results'
experiment_name'autoStructN2V_experiment'
random_seed42seeds python/numpy/torch/cuda; cuDNN deterministic
device'cuda''cpu' fallback is automatic when CUDA is absent
split_ratio(0.7, 0.15, 0.15)train/val/test z-slice split
num_epochs100publication value (a 400-epoch probe bought ~0 dB)
early_stoppingTruepublication runs set False
early_stopping_patience10
normalize_method'unit'publication value: 'zscore' (training on [0,1] cost ~3 dB)
use_aux_psnr_for_schedulingFalsemasked val loss drives scheduling (publication-faithful)
mode'2d'only '2d' supported
verboseFalse

mask: The Routing Source ​

KeyDefaultNotes
source'extractor''extractor' = the method · 'center' = plain-N2V baseline · 'file' = manual/frozen kernel
center_size1odd; kernel side for source='center'
file_pathNone.npy bool kernel for source='file'

mask.extractor: AutoMaskExtractor Knobs ​

Pipeline-level:

KeyDefaultNotes
extractor_input'raw''raw' (method) · 'denoised' · 'compare' (review halt)
denoised_stack_pathNonerequired for 'denoised'/'compare'

Phase 1 — background selection and ACF measurement:

KeyDefaultNotes
bg_side—REQUIRED: 'light' (dense EM) · 'dark' (fluorescence) · 'off' (flatness-only)
bg_boxNonemanual background rectangle (y0, y1, x0, x1); overrides side selection
sigma'auto'structure/detrend scale; estimated from the noise ACF half-width, clipped to [4, 12]
struct_keep'otsu'flatness threshold: Otsu on log structure map, or a fixed percentile
acf_crop10half-size of the ACF crop (21×21)
tile_sizes[64, 48, 32, 24]purity-first tiling: candidate tile sizes
purities[0.95, 0.85, 0.75, 0.6]highest purity that yields min_tiles wins
min_tiles4
detrendTrueper-tile Gaussian high-pass at sigma
bg_erode1erosion on the background mask (keeps tiles off structure edges)

Phase 2/3 — mask style:

KeyDefaultNotes
mask_style'spine''spine' (the method) · 'region' (legacy positive-only; ablation arm)
spine_thresh8.0two-sided |z| significance cut
rho_floor0.05effect-size floor: drop mask lags with |ρ| below it (the shipped operating point)
max_pixelsNoneoptional budget; topology-safe symmetric-pair pruning
tighten_output_maskTruecrop the kernel to its center-symmetric bounding rect

Region-style-only knobs (ablation arm): enhance_kw, thresh (8.0), robust, close_gaps, bridge, thin_n (3), value_k (3.0), value_ref ('zmap'), protect_extent.

Router thresholds: the Dmax gate (0.012) and the disabled coherence gate are module constants. They are documented in the parameter reference, but run_pipeline does not forward overrides — only direct AutoMaskExtractor(...) use can change them.

recipes.n2v / recipes.structn2v: The Branch Recipes ​

Package defaults, with the publication recipe (known_good_config.py) in the third column:

KeyPackage default (n2v / structn2v)Publication (n2v / structn2v)
features64 / 6432 / 32
num_layers2 / 22 / 2
patch_size32 / 6464 / 256 (auto-shrunk per volume)
batch_size4 / 2128 / 24
learning_rate1e-4 / 1e-51e-3 / 1e-3
patches_per_image100 / 2004 / 4
mask_percentage15.0 / 10.01.5 / 15.0 (% of prediction centers)
masking_strategy3 / 33 / 3 (UPS 5×5)
use_augmentationTrue / TrueTrue / False
use_resize_convTrueTrue
upsampling_mode'bilinear''bilinear'
remove_top_skipFalseTrue (N2V2)
use_blurpoolFalseTrue (N2V2)
activation'elu''relu'
norm_type'batch' / 'batch''batch' / 'group' (asymmetric on purpose)
num_groups88
overlap_tile_pad016
init_scale1.01.0
num_workers44

Masking-strategy codes: 0 = local mean · 1 = zeros · 2 = random from patch (legacy) · 3 = UPS, uniform sample from the 5×5 neighborhood excluding masked positions (publication) · 4 = UPS centers + uniform-random struct neighbors (CAREamics-style; reverted for publication).

The norm asymmetry is deliberate. The N2V branch uses BatchNorm (GroupNorm there cost up to −13 dB); the StructN2V branch uses GroupNorm (structured masks mis-calibrate BatchNorm's running statistics — Pearson ≈0.60 → ≈0.94 after the switch). Do not set both branches to the same norm. See Architecture & Training Recipe.

Using the Publication Recipe ​

python
from known_good_config import CONFIG    # in the repository root
CONFIG["input_data"] = "/path/to/noisy_stack.tif"
run_pipeline(CONFIG)

known_good_config.py is the resolved, frozen recipe behind the paper's results (legacy two-stage form; auto-translated on load).

Part of DFG Priority Programme SPP2332 "Physics of Parasitism"