edflow.hooks.metric_hooks.tf_metric_hook module¶
Reference¶
-
class
edflow.hooks.metric_hooks.tf_metric_hook.
MetricHook
(metrics, save_root, consider_only_first=None)[source]¶ Bases:
edflow.hooks.hook.Hook
Applies a set of given metrics to the calculated data.
-
__init__
(metrics, save_root, consider_only_first=None)[source]¶ - Parameters
metrics (list) –
List of
MetricTuple``s of the form ``: input names, output names, metric, name)
.input names
are the keys corresponding to the feeds ofinterest, e.g. an original image.output names
are the keys corresponding to the valuesin the results dict.metric
is aCallable
that accepts all inputs andoutputs keys as keyword argumentsname
is a
If nested feeds or results are expected the names can be passed as “path” like
'key1_key2'
returningdict[key1][key2]
.save_root (str) – Path to where the results are stored.
consider_only_first (int) – Metric is only evaluated on the first consider_only_first examples.
-
before_epoch
(epoch)[source]¶ Called before each epoch.
- Parameters
epoch (int) – Index of epoch that just started.
-
before_step
(step, fetches, feeds, batch)[source]¶ Called before each step. Can update any feeds and fetches.
- Parameters
step (int) – Current training step.
fetches (list or dict) – Fetches for the next session.run call.
feeds (dict) – Data used at this step.
batch (list or dict) – All data available at this step.
-