SlicedWassersteinDistance¶
Inheritance Diagram

-
class
ashpy.metrics.sliced_wasserstein_metric.SlicedWassersteinDistance(model_selection_operator=<built-in function lt>, logdir='/home/docs/checkouts/readthedocs.org/user_builds/ashpy/checkouts/v0.1.3/docs/source/log', resolution=128, resolution_min=16, patches_per_image=64, patch_size=7, random_sampling_count=1, random_projection_dim=147, use_svd=False)[source]¶ Bases:
ashpy.metrics.metric.MetricSliced Wasserstein Distance. Used as metric in Progressive Growing of GANs 1.
- 1
Progressive Growing of GANs https://arxiv.org/abs/1710.10196
Methods
__init__([model_selection_operator, logdir, …])Initialize the Metric.
log(step)Log the SWD mean and each sub-metric
model_selection(checkpoint, global_step)Perform model selection for each sub-metric
Reset the state of the metric and the state of each child metric.
update_state(context)Update the internal state of the metric, using the information from the context object.
Attributes
best_folderRetrieve the folder used to save the best model when doing model selection.
best_model_sel_fileRetrieve the path to JSON file containing the measured performance of the best model.
logdirRetrieve the log directory.
metricRetrieve the
tf.keras.metrics.Metricobject.model_selection_operatorRetrieve the operator used for model selection.
nameRetrieve the metric name.
-
__init__(model_selection_operator=<built-in function lt>, logdir='/home/docs/checkouts/readthedocs.org/user_builds/ashpy/checkouts/v0.1.3/docs/source/log', resolution=128, resolution_min=16, patches_per_image=64, patch_size=7, random_sampling_count=1, random_projection_dim=147, use_svd=False)[source]¶ Initialize the Metric.
- Parameters
model_selection_operator (
typing.Callable) –The operation that will be used when model_selection is triggered to compare the metrics, used by the update_state. Any
typing.Callablebehaving like anoperatoris accepted.Note
Model selection is done ONLY if an operator is specified here.
logdir (str) – Path to the log dir, defaults to a log folder in the current directory.
resolution (int) – Image Resolution, defaults to 128
resolution_min (int) – Min Resolution achieved by the metric
patches_per_image (int) – Number of patches to extract per image per Laplacian level.
patch_size (int) – Width of a square patch.
random_sampling_count (int) – Number of random projections to average.
random_projection_dim (int) – Dimension of the random projection space.
use_svd (bool) – experimental method to compute a more accurate distance.
- Return type
None
-
model_selection(checkpoint, global_step)[source]¶ Perform model selection for each sub-metric
- Return type
None