dival.reconstructors.tvadam_ct_reconstructor module

class dival.reconstructors.tvadam_ct_reconstructor.TVAdamCTReconstructor(ray_trafo, callback_func=None, callback_func_interval=100, show_pbar=True, **kwargs)[source]

Bases: IterativeReconstructor

CT reconstructor minimizing a TV-functional with the Adam optimizer.

HYPER_PARAMS = {'gamma': {'default': 0.0001, 'grid_search_options': {'num_samples': 20}, 'range': [1e-07, 1.0]}, 'init_filter_type': {'default': 'Hann'}, 'init_frequency_scaling': {'default': 0.1}, 'iterations': {'default': 5000, 'range': [1, 50000]}, 'loss_function': {'choices': ['mse', 'poisson'], 'default': 'mse'}, 'lr': {'default': 0.001, 'range': [1e-05, 0.1]}, 'mu_max': {'default': 81.35858}, 'photons_per_pixel': {'default': 4096}}

Specification of hyper parameters.

This class attribute is a dict that lists the hyper parameter of the reconstructor. It should not be hidden by an instance attribute of the same name (i.e. by assigning a value to self.HYPER_PARAMS in an instance of a subtype).

Note: in order to inherit HYPER_PARAMS from a super class, the subclass should create a deep copy of it, i.e. execute HYPER_PARAMS = copy.deepcopy(SuperReconstructorClass.HYPER_PARAMS) in the class body.

The keys of this dict are the names of the hyper parameters, and each value is a dict with the following fields.

Standard fields:

'default'

Default value.

'retrain'bool, optional

Whether training depends on the parameter. Default: False. Any custom subclass of LearnedReconstructor must set this field to True if training depends on the parameter value.

Hyper parameter search fields:

'range'(float, float), optional

Interval of valid values. If this field is set, the parameter is taken to be real-valued. Either 'range' or 'choices' has to be set.

'choices'sequence, optional

Sequence of valid values of any type. If this field is set, 'range' is ignored. Can be used to perform manual grid search. Either 'range' or 'choices' has to be set.

'method'{‘grid_search’, ‘hyperopt’}, optional

Optimization method for the parameter. Default: 'grid_search'. Options are:

'grid_search'

Grid search over a sequence of fixed values. Can be configured by the dict 'grid_search_options'.

'hyperopt'

Random search using the hyperopt package. Can be configured by the dict 'hyperopt_options'.

'grid_search_options'dict

Option dict for grid search.

The following fields determine how 'range' is sampled (in case it is specified and no 'choices' are specified):

'num_samples'int, optional

Number of values. Default: 10.

'type'{‘linear’, ‘logarithmic’}, optional

Type of grid, i.e. distribution of the values. Default: 'linear'. Options are:

'linear'

Equidistant values in the 'range'.

'logarithmic'

Values in the 'range' that are equidistant in the log scale.

'log_base'int, optional

Log-base that is used if 'type' is 'logarithmic'. Default: 10..

'hyperopt_options'dict

Option dict for 'hyperopt' method with the fields:

'space'hyperopt space, optional

Custom hyperopt search space. If this field is set, 'range' and 'type' are ignored.

'type'{‘uniform’}, optional

Type of the space for sampling. Default: 'uniform'. Options are:

'uniform'

Uniform distribution over the 'range'.

__init__(ray_trafo, callback_func=None, callback_func_interval=100, show_pbar=True, **kwargs)[source]
Parameters:
  • ray_trafo (odl.tomo.operators.RayTransform) – The forward operator

  • callback_func (callable, optional) – Callable with signature callback_func(iteration, reconstruction, loss) that is called after every callback_func_interval iterations, starting after the first iteration. It is additionally called after the last iteration. Note that it differs from the inherited IterativeReconstructor.callback (which is also supported) in that the latter is of type odl.solvers.util.callback.Callback, which only receives the reconstruction, such that the loss would have to be recomputed.

  • callback_func_interval (int, optional) – Number of iterations between calls to callback_func. Default: 100.

  • show_pbar (bool, optional) – Whether to show a tqdm progress bar during reconstruction.

property gamma
property init_filter_type
property init_frequency_scaling
property iterations
property loss_function
property lr
property mu_max
property photons_per_pixel