niftynet.engine.application_iteration module

Message stores status info of the current iteration.

class IterationMessage[source]

Bases: object

This class consists of network variables and operations at each iteration. It is generated by the application engine but can be modified by the application as well.

current_iter

Current iteration index can be used to create complex schedule for the iterative training/validation/inference procedure.

Returns:integer of iteration
ops_to_run

operations (tf graph elements) to be fed into session.run(...). This is currently mainly used for passing network gradient updates ops to session.run.

To modify the operations, assigns self.ops_to_run

Returns:a copy of the operation dictionary
data_feed_dict

A dictionary that maps graph elements to values to be fed into session.run(...) as feed_dict parameter

Returns:dictionary of operations
current_iter_output

This property stores graph output received by running session.run().

Returns:
should_stop

Engine check this property after each iteration

This could be modified in by application application.set_iteration_update() to create training schedules such as early stopping.

Returns:None or a handler that requested to stop the loop
phase

A string indicating the phase in train/validation/inference

Returns:
is_training

boolean value indicating if the phase is training

Type:return
is_validation

boolean value indicating if the phase is validation

Type:return
is_inference

boolean value indicating if the phase is inference

Type:return
iter_duration

measuring time used from setting self.current_iter to setting self.current_iter_output

Returns:time duration of an iteration
to_console_string()[source]

converting current_iter_output to string, for console displaying

Returns:summary string
to_tf_summary(writer=None)[source]

converting current_iter_output to tf summary and write to writer

Parameters:writer – writer instance for summary output
Returns:
class IterationMessageGenerator(initial_iter=0, final_iter=0, validation_every_n=0, validation_max_iter=0, is_training_action=True, **_unused)[source]

Bases: object

Classes provides an iteration message generator function. The generator should yield IterationMessage instances.