Input Modifiers
- class tf_keras_vis.activation_maximization.input_modifiers.InputModifier[source]
Bases:
ABC
Abstract class for defining an input modifier.
- abstract __call__(seed_input)[source]
Implement modification to the input before processing gradient descent.
- Parameters:
seed_input – An
numpy.ndarray
or a tf.Tensor that indicates a value to input to model.- Returns:
An
numpy.ndarray
or a tf.Tensor.- Raises:
NotImplementedError – This method must be overwritten.
- Return type:
ndarray | Tensor
- class tf_keras_vis.activation_maximization.input_modifiers.Jitter(jitter=8)[source]
Bases:
InputModifier
An input modifier that introduces random jitter. Jitter has been shown to produce crisper activation maximization images.
- Parameters:
jitter – The amount of jitter to apply. Defaults to 8.
- class tf_keras_vis.activation_maximization.input_modifiers.Rotate(axes=(1, 2), degree=3.0)[source]
Bases:
InputModifier
An input modifier that introduces random rotation.
- Parameters:
axes – The two axes that define the plane of rotation. Defaults to (1, 2).
degree – The amount of rotation to apply. Defaults to 3.0.
- Raises:
ValueError – When axes is not a tuple of two ints.
- class tf_keras_vis.activation_maximization.input_modifiers.Rotate2D(degree=3.0)[source]
Bases:
Rotate
An input modifier for 2D that introduces random rotation.
- Parameters:
degree – The amount of rotation to apply. Defaults to 3.0.
- class tf_keras_vis.activation_maximization.input_modifiers.Scale(low=0.9, high=1.1)[source]
Bases:
InputModifier
An input modifier that introduces randam scaling.