multigeom.pipeline.per_image#

Estimate G(x) and J(x) for each of the held-out test images (the former stage 4): for each image, compute

  - the top-k eigenpairs of the multi-scale Fisher metric G(x) via the
    **conditional-pair estimator** (Algorithm 1 of the paper, Eq. (eq:cc));
  - the top-k eigenpairs of the closed-form Fisher baseline J(x) =
    (1/σ²) J_{f_φ}ᵀ J_{f_φ} via PyTorch reverse-mode autograd (App. C.2).

Outputs one file per image: `<out_dir>/img{N:04d}.pt` with both eigendecompositions and
metadata. `multigeom.pipeline.alignment` reads these to produce the cross-encoder
figures.

Test images: the first `n_test_images` images of the TinyImageNet validation
split (held out from diffusion training), in sorted file order. The set is
deterministic and identical for every (encoder, area) configuration.

Seeding: image i uses its own generator seeded with `seed + i`, so its
estimate does not depend on how images are split across parallel runs
(--start/--end).

Usage:
    python -m multigeom.pipeline.per_image \
        --config estimator \
        --encoder-cfg inception \
        --encoder-ckpt runs/encoders/inception/V1/best_model.pt \
        --diffusion-ckpt runs/diffusion/inception/V1/final_model.pt \
        --area V1 \
        --out-dir runs/per_image/inception/V1

Functions

estimate_image(x, encoder, unet, ...)

G(x) and J(x) of one image x ([1, 1, 64, 64] in [-1, 1]): the conditional-pair estimator (Algorithm 1) for G(x), with its own generator seeded with seed (so the result does not depend on how images are split over runs), and the closed-form Fisher information J(x).

estimate_images(encoder, unet, ...[, ...])

Estimate G(x) and J(x) for images[i] (tensors [1, 64, 64] in [-1, 1]) for each i in indices and write one file <out_dir>/img{i:04d}.pt per image: the image, the top eigenvalues and eigenvectors of G(x) and J(x), the settings and the provenance.

main([argv])

Estimate G(x) and J(x) for the test images (command-line entry point).

parse_args([argv])

Command-line arguments of python -m multigeom.pipeline.per_image.