Releases: keisen/tf-keras-vis
Release v0.7.0
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
orinf
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 ofseed_input
, the smaller the regularization value of it. - The
Norm
has a problem that the larger the spatial size ofseed_input
, the smaller the regularization value of it.
- The
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
andGuidedBackpropagation
. - As a result,
model_modifier
argument oftf_keras_vis.ModelVisualization#__init__()
now also accepts atf_keras_vis.utils.model_modifiers.ModelModifier
instance, a list ofCallable
objects orModelModifier
instances.
- Add
tf_keras_vis.gradcam_plus_plus
module.- This module includes
GradcamPlusPlus
.
- This module includes
- Add
tf_keras_vis.activation_maximization.legacy
module.- This module includes
ActivationMaximization
that still has the problem of unstable gradient calculation.
- This module includes
- Add
tf_keras_vis.activation_maximization.input_modifiers
module.- This module includes
Jitter
,Rotate
andScale
.
- This module includes
- Add
tf_keras_vis.activation_maximization.regularizers
module.- This module includes
TotalVariation2D
andNorm
that fixed some bugs.
- This module includes
- Add
Scale
, that is the new InputModifier class, to thetf_keras_vis.activation_maximization.input_modifiers
module. - Add
Progress
, that is the new Callback class, to thetf_keras_vis.activation_maximization.callbacks
module. - Add
activation_modifiers
argument toActivationMaximization#__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 oftf_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.
- Because of fixing critical bugs in
- Deprecates
tf_keras_vis.utils.regularizers
module, Usetf_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
, Usetf_keras_vis.activation_maximization.input_modifiers
module instead. - Deprecates
tf_keras_vis.activation_maximization.callbacks.PrintLogger
, useProgress
instead. - Add
**arguments
argument toCallback#on_begin()
.**arguments
is the values passed toActivationMaximization#__call__()
as arguments.
- Deprecates
tf_keras_vis.gradcam.GradcamPlusPlus
, Usetf_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 inScorecam
. - Improve the
input_range
argument ofActivationMaximization#__call__()
to raise an error when it's invalid. - Change docstring style to
google
. - Replace
str#format()
tof-string
Release v0.6.2
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
. Usetf_keras_vis.utils.input_modifiers.Rotate2D
instead.
Other Changes
- Update
classifiers
in setup.py
Release 0.6.1
BugFix and Other Changes
- Remove
import
a class that does NOT exist. - Improve performance to check mixed-precision models.
Release 0.6.0
Change a terminology
- The
Loss
is changed toScore
. Because visualizations does NOT need to calculate anyloss
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
- 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 whenmodel_modifier
is None.- issues / #51
- Deprecates and Disable
normalize_gradient
option in ActivationMaximizaion and GradCAM. - Deprecates
tf_keras_vis.utils.callback
module. Usetf_keras_vis.activation_maximization.callbacks
module instead.- Deprecates and Rename
Print
toPrintLogger
. - Deprecates and Rename
GifGenerator
toGifGenerator2D
.
- Deprecates and Rename
- Deprecates
tf_keras_vis.utils.regularizers.TotalVariation
. Usetf_keras_vis.utils.regularizers.TotalVariation2D
instead. - Deprecates
tf_keras_vis.utils.regularizers.L2Norm
. Usetf_keras_vis.utils.regularizers.Norm
instead. - Deprecates and Rename
tf_keras_vis.utils.normalize
totf_keras_vis.utils.standardize
. - Don't need to use
tf_keras_vis.utils.normalize
to visualize CAM or Saliency. Usestandardize_cam
andstandardize_saliency
option instead respectively. - Don't need to cast activations maximized by ActivationMaximization to visualize.
- See the example of ActivationMaximization for details.
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
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
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
Bugfix
- Fix a problem that model's training-mode can NOT turn off (See issues / #26 for details).
Release 0.5.2
Bugfix
- Fix a problem that a Error occurs when
max_N
is None or under 0 in ScoreCAM
Release 0.5.0
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 oftf_keras_vis.utils. print_gpus()
.
Release 0.4.0
Major Feature
- Add GradCAM++ algorism implemented as GradcamPlusPlus class
Bugfixes
- The noise of SmoothGrad is too strong.
- Rotation in InputModifier across channles-dim.