LION.reconstructors.ForwardReconstructor¶
- class LION.reconstructors.ForwardReconstructor(operator, model=None, parameters=None)[source]¶
Bases:
LIONReconstructorReconstruct 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’sinitial_reconstruction), sinogram-domain models (e.g. LPD) the measurements; with the model’s normalisation (itsset_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).x0is 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
sourcedescribes: 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 filesavewrote) 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, assource(as ininstantiate) 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, whateververbose).reconstruct_sample(y[, x0, verbose])The reconstruction of one sample
y(the operator's range shape): the batch of one throughreconstruct.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).