LION.reconstructors.ForwardReconstructor

class LION.reconstructors.ForwardReconstructor(operator, model=None, parameters=None)[source]

Bases: LIONReconstructor

Reconstruct with a model’s forward pass, as its solvers train it (LION.optimizers.LIONsolver.model_forward): image-domain models (e.g. FBPConvNet) get a reconstruction first (the operator’s default, FDK for CT, or the model’s initial_reconstruction), sinogram-domain models (e.g. LPD) the measurements; with the model’s normalisation (its set_normalisation(), saved with it), the input is normalised and the output mapped back.

ForwardReconstructor(operator, model); it has no parameters. A batch is reconstructed in one pass, without gradients (torch.no_grad). x0 is not used.

__init__(operator, model=None, parameters=None)

Methods

__init__(operator[, model, parameters])

cite([cite_format])

Where the reconstructor comes from: its paper's citation, BibTeX ("bib") or "MLA" (LION.utils.citation); None if it has none.

default_parameters()

None to set: an empty LIONParameter.

initial_guess(y)

Where the algorithm starts for measurements y: the parameters' initial_reconstruction(y, op).

instantiate(source[, model, allow])

The reconstructor source describes: its file (save), its spec, or a test record (LION.evaluation) of it, or that record's file.

load(fname, *[, allow])

The reconstructor fname (a file save wrote) describes, with its model loaded from the recorded file (a warning if its weights changed since).

parameters_from_file(source, *[, allow])

What default_parameters() gives, as source (as in instantiate) recorded it: the algorithm's settings, to change and make the reconstructor with (PnP(operator, model, parameters)).

reconstruct(y[, x0, verbose])

Reconstruct measurements y: one sample (the operator's range shape) or a batch of them, in one forward pass (so nothing to show, whatever verbose).

reconstruct_sample(y[, x0, verbose])

The reconstruction of one sample y (the operator's range shape): the batch of one through reconstruct.

save(fname)

Write this reconstructor's record to fname (.json): its spec (operator and parameters), its model by the file it was loaded from and its weights hash (a model made in the script: only the hash; a function: its spec), and the environment.

spec_kwargs()

The spec's arguments: the operator and the parameters, not the model (a model's spec would make it with new weights; see the module docstring).

static default_parameters()[source]

None to set: an empty LIONParameter.

reconstruct(y, x0=None, verbose=1)[source]

Reconstruct measurements y: one sample (the operator’s range shape) or a batch of them, in one forward pass (so nothing to show, whatever verbose).

reconstruct_sample(y, x0=None, verbose=0)[source]

The reconstruction of one sample y (the operator’s range shape): the batch of one through reconstruct. x0, verbose: unused.