Shape2Force / experiments /README.md
kaveh's picture
S2F v1.2.0
d2a9154
|
Raw History Blame Contribute Delete
3.16 kB

Baselines and ablations

Code for the evaluation of the released checkpoints and for the baseline and ablation models. Run every command from the repository root; a GPU is used when available.

experiments/
  layout.py           paths and split-manifest helpers
  manifest_data.py    data loader driven by a split manifest
  ablation_models.py  U-Net and S2F generator variants
  losses.py           reconstruction losses
  configs.py          training protocol and variants
  train.py            train one variant
  evaluate.py         evaluate checkpoints and trained runs on all manifests
  run_all.py          run the steps in order
  splits/             split manifests
  results/eval/       evaluation tables

Data

The image pairs are available on Zenodo (doi: 10.5281/zenodo.18457879). Place them in dataset/ or set S2F_DATASET_ROOT. Each manifest in splits/ lists one sample per row (folder relative to the dataset root, condition, Young's modulus, pixel-size setting, colour-scale limit and substrate setting):

  • alltune_train (280) and alltune_val (81): single-cell training and validation sets;
  • test_fibro_*: independent single-cell test sets;
  • spheroid_train (129) and spheroid_val (28).

Usage

python -m experiments.run_all --steps eval_released
python -m experiments.run_all --steps train,eval_runs --variants s2f_no_substrate,unet_no_substrate --seeds 0,1
python -m experiments.train --variant unet --seed 0

Runs are written to experiments/runs/<variant>_seed<seed>/ and resume when restarted. Add --epochs 1 --max-batches 2 for a quick test.

Training protocol

All variants use the training and validation sets above, batch size 2, 1024 × 1024 px, the augmentations of data/augmentations.py and Adam (β1 = 0.5, β2 = 0.999) with a cosine schedule and 10 % warm-up per phase.

phase epochs reconstruction loss other terms lr
1 100 100 × weighted MSE + soft Dice 1 × adversarial 1e-4
2 40 10 × RME 1 × adversarial, 100 × traction-stress consistency 1e-5

Phase 2 starts from the best phase-1 generator. In each phase the checkpoint with the lowest validation loss is kept; the final model is the best phase-2 checkpoint.

Variants reported in the paper

model variant
U-Net unet_no_substrate
pix2pix unet_gan_no_substrate
S2F s2f_no_substrate
S2F (+ substrate) s2f_staged
without multi-scale input module s2f_no_substrate_no_multiscale
without bottleneck context and attention modules s2f_no_substrate_bridge_plain
without attention gates s2f_no_substrate_no_attention_gates
without discriminator s2f_no_substrate_no_gan
without traction-stress consistency loss s2f_staged_no_force

The input-free baseline (average training map) is evaluated with python -m experiments.evaluate --meanmap. Other variants are listed in configs.py.

Outputs

evaluate.py computes per-image MSE, MS-SSIM, pixel-wise Pearson r, RME and mean traction stress (Pa), and writes results/eval/per_image.csv, summary.csv and model_params.csv.