tensorcv.callbacks package

Submodules

tensorcv.callbacks.base module

class tensorcv.callbacks.base.Callback[source]

Bases: object

base class for callbacks

after_epoch()[source]
after_run(rct, val)[source]
after_train()[source]
before_epoch()[source]
before_inference()[source]
before_run(rct)[source]
before_train()[source]
epochs_completed
global_step
setup_graph(trainer)[source]
trigger()[source]
trigger_epoch()[source]
trigger_step()[source]
class tensorcv.callbacks.base.ProxyCallback(cb)[source]

Bases: tensorcv.callbacks.base.Callback

tensorcv.callbacks.debug module

class tensorcv.callbacks.debug.CheckScalar(tensors, periodic=1)[source]

Bases: tensorcv.callbacks.base.Callback

print scalar tensor values during training .. attribute:: _tensors

_names
__init__(tensors, periodic=1)[source]

init CheckScalar object :param tensors: list[string] A tensor name or list of tensor names

tensorcv.callbacks.group module

class tensorcv.callbacks.group.Callbacks(cbs)[source]

Bases: tensorcv.callbacks.base.Callback

group all the callback

get_hooks()[source]

tensorcv.callbacks.hooks module

class tensorcv.callbacks.hooks.Callback2Hook(cb)[source]

Bases: tensorflow.python.training.session_run_hook.SessionRunHook

after_run(rct, val)[source]

Called after each call to run().

The run_values argument contains results of requested ops/tensors by before_run().

The run_context argument is the same one send to before_run call. run_context.request_stop() can be called to stop the iteration.

If session.run() raises any exceptions then after_run() is not called.

Parameters:
  • run_context – A SessionRunContext object.

  • run_values – A SessionRunValues object.

before_run(rct)[source]

Called before each call to run().

You can return from this call a SessionRunArgs object indicating ops or tensors to add to the upcoming run() call. These ops/tensors will be run together with the ops/tensors originally passed to the original run() call. The run args you return can also contain feeds to be added to the run() call.

The run_context argument is a SessionRunContext that provides information about the upcoming run() call: the originally requested op/tensors, the TensorFlow Session.

At this point graph is finalized and you can not add ops.

Parameters:run_context – A SessionRunContext object.
Returns:None or a SessionRunArgs object.
class tensorcv.callbacks.hooks.Infer2Hook(inferencer)[source]

Bases: tensorflow.python.training.session_run_hook.SessionRunHook

after_run(rct, val)[source]

Called after each call to run().

The run_values argument contains results of requested ops/tensors by before_run().

The run_context argument is the same one send to before_run call. run_context.request_stop() can be called to stop the iteration.

If session.run() raises any exceptions then after_run() is not called.

Parameters:
  • run_context – A SessionRunContext object.

  • run_values – A SessionRunValues object.

before_run(rct)[source]

Called before each call to run().

You can return from this call a SessionRunArgs object indicating ops or tensors to add to the upcoming run() call. These ops/tensors will be run together with the ops/tensors originally passed to the original run() call. The run args you return can also contain feeds to be added to the run() call.

The run_context argument is a SessionRunContext that provides information about the upcoming run() call: the originally requested op/tensors, the TensorFlow Session.

At this point graph is finalized and you can not add ops.

Parameters:run_context – A SessionRunContext object.
Returns:None or a SessionRunArgs object.
class tensorcv.callbacks.hooks.Prediction2Hook(prediction)[source]

Bases: tensorflow.python.training.session_run_hook.SessionRunHook

after_run(rct, val)[source]

Called after each call to run().

The run_values argument contains results of requested ops/tensors by before_run().

The run_context argument is the same one send to before_run call. run_context.request_stop() can be called to stop the iteration.

If session.run() raises any exceptions then after_run() is not called.

Parameters:
  • run_context – A SessionRunContext object.

  • run_values – A SessionRunValues object.

before_run(rct)[source]

Called before each call to run().

You can return from this call a SessionRunArgs object indicating ops or tensors to add to the upcoming run() call. These ops/tensors will be run together with the ops/tensors originally passed to the original run() call. The run args you return can also contain feeds to be added to the run() call.

The run_context argument is a SessionRunContext that provides information about the upcoming run() call: the originally requested op/tensors, the TensorFlow Session.

At this point graph is finalized and you can not add ops.

Parameters:run_context – A SessionRunContext object.
Returns:None or a SessionRunArgs object.

tensorcv.callbacks.inference module

class tensorcv.callbacks.inference.FeedInference(inputs, periodic=1, inferencers=[], extra_cbs=None, infer_batch_size=None)[source]

Bases: tensorcv.callbacks.inference.InferenceBase

default inferencer:
inference_list = InferImages(‘generator/gen_image’, prefix = ‘gen’)
class tensorcv.callbacks.inference.GANInference(inputs=None, periodic=1, inferencers=None, extra_cbs=None)[source]

Bases: tensorcv.callbacks.inference.InferenceBase

class tensorcv.callbacks.inference.FeedInferenceBatch(inputs, periodic=1, batch_count=10, inferencers=[], extra_cbs=None, infer_batch_size=None)[source]

Bases: tensorcv.callbacks.inference.FeedInference

do not use all validation data

tensorcv.callbacks.inferencer module

class tensorcv.callbacks.inferencer.InferencerBase[source]

Bases: tensorcv.callbacks.base.Callback

after_inference()[source]
before_inference()[source]

process before every inference

get_fetch(val)[source]
put_fetch()[source]
setup_inferencer()[source]
class tensorcv.callbacks.inferencer.InferImages(im_name, prefix=None, color=False, tanh=False)[source]

Bases: tensorcv.callbacks.inferencer.InferencerBase

class tensorcv.callbacks.inferencer.InferScalars(scaler_names, summary_names=None)[source]

Bases: tensorcv.callbacks.inferencer.InferencerBase

class tensorcv.callbacks.inferencer.InferOverlay(im_name, prefix=None, color=False, tanh=False)[source]

Bases: tensorcv.callbacks.inferencer.InferImages

class tensorcv.callbacks.inferencer.InferMat(infer_save_name, mat_name, prefix=None)[source]

Bases: tensorcv.callbacks.inferencer.InferImages

tensorcv.callbacks.inputs module

class tensorcv.callbacks.inputs.FeedInput(dataflow, placeholders)[source]

Bases: tensorcv.callbacks.base.Callback

input using feed

tensorcv.callbacks.monitors module

class tensorcv.callbacks.monitors.TrainingMonitor[source]

Bases: tensorcv.callbacks.base.Callback

process_summary(summary)[source]
class tensorcv.callbacks.monitors.Monitors(mons)[source]

Bases: tensorcv.callbacks.monitors.TrainingMonitor

group monitors

class tensorcv.callbacks.monitors.TFSummaryWriter[source]

Bases: tensorcv.callbacks.monitors.TrainingMonitor

process_summary(summary)[source]

tensorcv.callbacks.saver module

class tensorcv.callbacks.saver.ModelSaver(max_to_keep=5, keep_checkpoint_every_n_hours=0.5, periodic=1, checkpoint_dir=None, var_collections='variables')[source]

Bases: tensorcv.callbacks.base.Callback

tensorcv.callbacks.summary module

class tensorcv.callbacks.summary.TrainSummary(key=None, periodic=1)[source]

Bases: tensorcv.callbacks.base.Callback

tensorcv.callbacks.trigger module

class tensorcv.callbacks.trigger.PeriodicTrigger(trigger_cb, every_k_steps=None, every_k_epochs=None)[source]

Bases: tensorcv.callbacks.base.ProxyCallback

may not need

Module contents