Skip to content

Releases: keisen/tf-keras-vis

Release v0.7.0

26 Jun 05:57
8bc4c8f
Compare
Choose a tag to compare

Fixes critical bugs

ActivationMaximization

We've fixed a problem of unstable gradient calculation in ActivationMaximization. In addition, because the related implementation has a bad effect on the process with the mixed-precision model, as a result, the problems related to mixed-precision with ActivationMaximization below were also fixed.

  • Fixed issues related to mixed-precision
    • The results of fully-precision and mixed-precision models are different.
    • When the model has a layer which is set explicitly as float32 dtype, ActivationMaximization might raise an error.
    • Regularization values calculated by ActivationMaximization might be NaN or inf easily.

Because the results of the gradients calculation are now different compared to the past versions, to keep compatibility, we newly provide the module tf_keras_vis.activation_maximization.legacy. If you have the code adjusted by yourself in the past versions, you could also use legacy implementation as follows:

# from tf_keras_vis.activation_maximization import ActivationMaximization
from tf_keras_vis.activation_maximization.legacy import ActivationMaximization

Please notice that the tf_keras_vis.activation_maximization.legacy module above still has the problem of unstable gradient calculation. So we strongly recommend, if you don't have any code adjusted by yourself in the past versions, using the tf_keras_vis.activation_maximization module.

Regularization for ActivationMaximization

We also found and fixed some bugs of Regularizers below.

  • Fixed issues related to Regularizers
    • The TotalVariation2D has a problem that the more the number of samples of seed_input, the smaller the regularization value of it.
    • The Norm has a problem that the larger the spatial size of seed_input, the smaller the regularization value of it.

In addition to above, we've changed the signature of Regularizer#__call__(). The method now accepts only one seed_input (the legacy one accepts whole seed_inputs). With this change, the regularizers argument of ActivationMaximization#__call__() now accepts a dictionary object that contains the Regularizer instances for each model input.

To keep compatibility, we've newly provided the tf_keras_vis.activation_maximization.regularizers module that includes the regularizers improved, instead of updating the tf_keras_vis.utils.regularizers module. If you have the code implemented or adjusted by yourself in the past versions, you could also use legacy implementation as follows:

# from tf_keras_vis.activation_maximization.regularizers import Norm, TotalVariation2D 
from tf_keras_vis.utils.regularizers import Norm, TotalVariation2D

Please notice that the tf_keras_vis.utils.regularizers module still has the bugs and a lot of warnings will be printed. So we strongly recommend, if you do NOT have any code adjusted by yourself in the past versions, using the tf_keras_vis.utils.regularizers module.

If you face any problem related to this release, please feel free to ask us in Issues page.

Add features and Improvements

  • Add tf_keras_vis.utils.model_modifiers module.
    • To fix issues / #49
    • This module includes ModelModifier, ReplaceToLinear, ExtractIntermediateLayer and GuidedBackpropagation.
    • As a result, model_modifier argument of tf_keras_vis.ModelVisualization#__init__() now also accepts a tf_keras_vis.utils.model_modifiers.ModelModifier instance, a list of Callable objects or ModelModifier instances.
  • Add tf_keras_vis.gradcam_plus_plus module.
    • This module includes GradcamPlusPlus.
  • Add tf_keras_vis.activation_maximization.legacy module.
    • This module includes ActivationMaximization that still has the problem of unstable gradient calculation.
  • Add tf_keras_vis.activation_maximization.input_modifiers module.
    • This module includes Jitter, Rotate and Scale.
  • Add tf_keras_vis.activation_maximization.regularizers module.
    • This module includes TotalVariation2D and Norm that fixed some bugs.
  • Add Scale, that is the new InputModifier class, to the tf_keras_vis.activation_maximization.input_modifiers module.
  • Add Progress, that is the new Callback class, to the tf_keras_vis.activation_maximization.callbacks module.
  • Add activation_modifiers argument to ActivationMaximization#__call__().
  • Add a github actions recipe to publish tf-keras-vis to Anaconda.org
    • To fix issues / #54
  • Improve Scorecam
    • Fixes the incorrect weight calculation. (Reducing noise)
    • Change cubic interpolation to linear one. (10x faster)
    • Change to apply softmax function to scores. (More stable)
    • Add validation to check invalid scores.

Breaking Changes

  • In all visualization, the score argument now must be a list of tf_keras_vis.utils.scores.Score instances or Callable objects when the model has multiple outputs.
  • Change the default parameters of ActivationMaximization#__call__().
    • Because of fixing critical bugs in ActivationMaximization that the calculation of gradient descent is unstable.
  • Deprecates tf_keras_vis.utils.regularizers module, Use tf_keras_vis.activation_maximization.regularizers module instead.
    • For now, both current and legacy regularizers can be used in ActivationMaximization, but please notice that they can't be mixed to use.
  • Deprecates tf_keras_vis.utils.input_modifiers, Use tf_keras_vis.activation_maximization.input_modifiers module instead.
  • Deprecates tf_keras_vis.activation_maximization.callbacks.PrintLogger, use Progress instead.
  • Add **arguments argument to Callback#on_begin().
    • **arguments is the values passed to ActivationMaximization#__call__() as arguments.
  • Deprecates tf_keras_vis.gradcam.GradcamPlusPlus, Use tf_keras_vis.gradcam_plus_plus.GradcamPlusPlus  module instead.

Bugfixes and Other Changes

  • Fixes a bug that Scorecam didn't work correctly with multi-inputs model.
  • Fixes some bugs when loading input modifiers.
  • Fixes a bug that Callback#on_end() might NOT be called when an error occurs.
  • Improve an error message when max_N is invalid in Scorecam.
  • Improve the input_range argument of ActivationMaximization#__call__() to raise an error when it's invalid.
  • Change docstring style to google.
  • Replace str#format() to f-string

Release v0.6.2

03 Jun 15:10
a96f632
Compare
Choose a tag to compare

Improvements

  • tf_keras_vis.utils.input_modifiers.Jitter raises ValueError with proper message when the dimension of seed_input is 2.

Breaking Changes

  • Deprecates tf_keras_vis.utils.input_modifiers.Rotate. Use tf_keras_vis.utils.input_modifiers.Rotate2D instead.

Other Changes

  • Update classifiers in setup.py

Release 0.6.1

26 May 13:55
79c097e
Compare
Choose a tag to compare

BugFix and Other Changes

  • Remove import a class that does NOT exist.
  • Improve performance to check mixed-precision models.

Release 0.6.0

22 May 06:11
380dacb
Compare
Choose a tag to compare

Change a terminology

  • The Loss is changed to Score. Because visualizations does NOT need to calculate any loss between labels and the model outputs, and the calculated values is used as just scores, we thought that the former is proper than latter.

Add Features and Improvements

  • Support Python 3.9
  • Support Tensorflow 2.4 and 2.5
  • Support mixed-precision
    • Issues / #43 , #45 and #47
    • only tensorflow 2.4.0+
  • Add unconnected_gradients option to __call__() of ActivationMaximization, Saliency, GradCAM, GradCAM++.
  • Add standardize_cam option to __call__() of GradCAM, GradCAM++ and ScoreCAM.
  • Add normalize_saliency option to __call__() of Saliency.

Breaking Changes

  • In all visualization class constructor, the model passed as a argument is NOT cloned when model_modifier is None.
  • Deprecates and Disable normalize_gradient option in ActivationMaximizaion and GradCAM.
  • Deprecates tf_keras_vis.utils.callback module. Use tf_keras_vis.activation_maximization.callbacks module instead.
    • Deprecates and Rename Print to PrintLogger.
    • Deprecates and Rename GifGenerator to GifGenerator2D.
  • Deprecates tf_keras_vis.utils.regularizers.TotalVariation. Use tf_keras_vis.utils.regularizers.TotalVariation2D instead.
  • Deprecates tf_keras_vis.utils.regularizers.L2Norm. Use tf_keras_vis.utils.regularizers.Norm instead.
  • Deprecates and Rename tf_keras_vis.utils.normalize to tf_keras_vis.utils.standardize.
  • Don't need to use tf_keras_vis.utils.normalize to visualize CAM or Saliency. Use standardize_cam and standardize_saliency option instead respectively.
  • Don't need to cast activations maximized by ActivationMaximization to visualize.

BugFix and Other Changes

  • Fixes a problem in Rotate input-modifier that it can't work correctly when input tensors is not 2D images.
  • Add a test utility and testcases.
  • Update dockerfiles and example notebooks.

Known Issues

  • With a mixed-precision model, Regurarization values that is calculated by ActivationMaximization may be NaN.
  • With a mixed-precision model that has a layer which are set float32 dtype exlicitly, ActivationMaximization may raise a error.

Release 0.5.5

15 Dec 11:21
ddd9513
Compare
Choose a tag to compare

Bugfix

  • Fix a problem that GradCAM and GradCAM++ were NOT working correctly with mixed precision . (See issues / #41 for details).

Other Changes

  • Support tensorflow 2.4.0.
  • Python 3.5 is no longer supported (but it can be used if tensorflow<2.4.0).

Release 0.5.4

04 Dec 03:45
00f3515
Compare
Choose a tag to compare

Bugfix

  • Fix a problem that normalize_gradient option of ActivationMaximization and GradCAM was not working correctly. (See issues / #38 for details).

Release 0.5.3

11 Aug 11:27
5554ddb
Compare
Choose a tag to compare

Bugfix

  • Fix a problem that model's training-mode can NOT turn off (See issues / #26 for details).

Release 0.5.2

14 Jul 03:32
1d7f5df
Compare
Choose a tag to compare

Bugfix

  • Fix a problem that a Error occurs when max_N is None or under 0 in ScoreCAM

Release 0.5.0

12 Jul 05:12
72d965c
Compare
Choose a tag to compare

Major Feature

  • Add new methods (ScoreCAM and Faster-ScoreCAM)

Breaking Changes

  • tf_keras_vis.utils.print_gpus() was deleted.
  • tf_keras_vis.utils.losses.SmoothedLoss was deleted.

BugFix and Other Changes

  • Fixes a problem that ActivationMaximization couldn't calculate and normalize losses correctly when multiple samples.
  • Fixes a problem that the output of ActivationMaximization was restricted when input_ranges contain None.
  • Improve to raise ValueError when input shape doesn't have channels dimension in GradCAM.
  • Fixes a problem that GradCAM++ couldn't calculate scores correctly when multiple samples.
  • Add tf_keras_vis.utils. num_of_gpus() instead of tf_keras_vis.utils. print_gpus().

Release 0.4.0

26 Jun 12:54
03cce2a
Compare
Choose a tag to compare

Major Feature

  • Add GradCAM++ algorism implemented as GradcamPlusPlus class

Bugfixes

  • The noise of SmoothGrad is too strong.
  • Rotation in InputModifier across channles-dim.