API

Feature Visualization

Attentions

Class Activation Map

Utilities

Model Visualization Class

class tf_keras_vis.ModelVisualization(model, model_modifier=None, clone=True)[source]

Bases: ABC

Visualization class that analyze the model for debugging.

Parameters:
  • model – A tf.keras.Model instance. When model_modifier is NOT None, this model will be cloned with tf.keras.models.clone_model function and then will be modified by model_modifier according to needs.

  • model_modifier – A tf_keras_vis.utils.model_modifiers.ModelModifier instance, a function or a list of them. We recommend to apply tf_keras_vis.utils.model_modifiers.ReplaceToLinear to all visualizations (except tf_keras_vis.scorecam.Scorecam) when the model output is softmax. Defaults to None.

  • clone – A bool that indicates whether or not it clones the model. When False, the model won’t be cloned. Note that, although when True, the model won’t be clone if model_modifier is None. Defaults to True.

abstract __call__()[source]

Analyze the model.

Raises:

NotImplementedError – This method must be overwritten.

Returns:

Visualized image(s) or something(s).

Return type:

ndarray | list