Regularizers

class tf_keras_vis.activation_maximization.regularizers.Norm(weight=10., p=2, name='Norm')[source]

Bases: Regularizer

A regularizer that introduces Norm.

Parameters:
  • weight – This weight will be apply to TotalVariation values. Defaults to 10.

  • p – Order of the norm. Defaults to 2.

  • name – Instance name. Defaults to ‘Norm’. Defaults to ‘Norm’.

class tf_keras_vis.activation_maximization.regularizers.Regularizer(name)[source]

Bases: ABC

Abstract class for defining a regularizer.

Parameters:

name – Instance name.

abstract __call__(input_value)[source]

Implement regularization.

Parameters:

input_value – A tf.Tensor that indicates the value to input to the model.

Returns:

Regularization value with respect to the input value.

Return type:

tf.Tensor

Raises:

NotImplementedError – This method must be overwritten.

class tf_keras_vis.activation_maximization.regularizers.TotalVariation2D(weight=10.0, name='TotalVariation2D')[source]

Bases: Regularizer

A regularizer that introduces Total Variation.

Parameters:
  • weight – This value will be apply to TotalVariation values. Defaults to 10.0.

  • name – Instance name. Defaults to ‘TotalVariation2D’.