Skip to content

Commit

Permalink
Merge pull request #39 from keisen/release/v0.6.0
Browse files Browse the repository at this point in the history
Release v0.6.0
  • Loading branch information
keisen authored May 22, 2021
2 parents ddd9513 + c100c9a commit 380dacb
Show file tree
Hide file tree
Showing 46 changed files with 2,371 additions and 2,715 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ jobs:
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
tensorflow: [2.0.3, 2.1.2, 2.2.1, 2.3.1, 2.4.0]
tensorflow: [2.0.4, 2.1.3, 2.2.2, 2.3.2, 2.4.1, 2.5.0]
include:
- python-version: 3.9
tensorflow: 2.5.0
exclude:
- python-version: 3.8
tensorflow: 2.0.3
tensorflow: 2.0.4
- python-version: 3.8
tensorflow: 2.1.2

tensorflow: 2.1.3
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --no-cache-dir --upgrade pip
python -m pip install --no-cache-dir setuptools wheel twine
python -m pip install --no-cache-dir --upgrade setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ venv.bak/

# Add by keisen
*.swp
examples/core*
examples/sandbox.ipynb
examples/workspace.ipynb
/examples/core*
/examples/sandbox.ipynb
/examples/workspace.ipynb
/*.ipynb
.node-version
*.nbconvert.ipynb
Untitled.ipynb
/temp/
.DS_Store
/dockerfiles/docker-compose.yml
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Currently supported methods for visualization include:
* Class Activation Maps
- [GradCAM](https://arxiv.org/pdf/1610.02391v1.pdf)
- [GradCAM++](https://arxiv.org/pdf/1710.11063.pdf)
- [ScoreCAM](https://arxiv.org/pdf/1910.01279.pdf) :new::zap:
- [Faster-ScoreCAM](https://github.com/tabayashi0117/Score-CAM/blob/master/README.md#faster-score-cam) :new::zap:
- [ScoreCAM](https://arxiv.org/pdf/1910.01279.pdf)
- [Faster-ScoreCAM](https://github.com/tabayashi0117/Score-CAM/blob/master/README.md#faster-score-cam)
* Saliency Maps
- [Vanilla Saliency](https://arxiv.org/pdf/1312.6034.pdf)
- [SmoothGrad](https://arxiv.org/pdf/1706.03825.pdf)
Expand All @@ -28,11 +28,11 @@ All visualizations have the features as follows:

## Visualizations

### Visualize Dense Layer
### Visualizing Dense Layer

<img src='https://github.com/keisen/tf-keras-vis/raw/master/examples/images/visualize-dense-layer.png' width='600px' />

### Visualize Convolutional Filer
### Visualizing Convolutional Filer

<img src='https://github.com/keisen/tf-keras-vis/raw/master/examples/images/visualize-filters.png' width='600px' />

Expand All @@ -51,7 +51,7 @@ The images above are generated by `SmoothGrad`.

## Requirements

* Python 3.6-3.8
* Python 3.6-3.9
* tensorflow>=2.0.2


Expand All @@ -66,13 +66,15 @@ $ pip install tf-keras-vis tensorflow
* Docker (container that run Jupyter Notebook)

```bash
$ docker run -itd -p 8888:8888 keisen/tf-keras-vis:0.5.0
$ cd tf-keras-vis
$ docker build -t <TAG> -f dockerfiles/gpu.Dockerfile .
$ docker run --gpus all --privileged -itd -p 8888:8888 <TAG>
```

If you have GPU processors,
Or

```bash
$ docker run -itd --runtime=nvidia -p 8888:8888 keisen/tf-keras-vis:0.5.0-gpu
$ docker run --gpus all --privileged -itd -p 8888:8888 keisen/tf-keras-vis:0.5.0-gpu
```

> You can find other images at [Docker Hub](https://hub.docker.com/repository/docker/keisen/tf-keras-vis/tags).
Expand All @@ -96,15 +98,16 @@ But please note that tf-keras-vis APIs does NOT have compatibility with keras-vi
### Guides (ToDo)

* Visualizing multiple attention or activation images at once utilizing batch-system of model
* Define various loss functions
* Define various score functions
* Visualizing attentions with multiple inputs models
* Visualizing attentions with multiple outputs models
* Advanced loss functions
* Advanced score functions
* Tuning Activation Maximization
* Visualizing attentions for N-dim image inputs


## ToDo

* Guide documentations
* API documentations
* We're going to add some methods such as below.
Expand All @@ -117,4 +120,11 @@ But please note that tf-keras-vis APIs does NOT have compatibility with keras-vi
* With InceptionV3, ActivationMaximization doesn't work well, that's, it might generate meaninglessly blur image.
* With cascading model, Gradcam and Gradcam++ don't work well, that's, it might occur some error. So we recommend, in this case, to use FasterScoreCAM.
* `channels-first` models and data is unsupported.
* With a `mixed-precision` model that has a layer which are set float32 dtype exlicitly, ActivationMaximization may raise a error.
* With a `mixed-precision` model, Regurarization values that is calculated by ActivationMaximization may be NaN.


## Use Cases

* [chitra](https://github.com/aniketmaurya/chitra)
* A Deep Learning Computer Vision library for easy data loading, model building and model interpretation with GradCAM/GradCAM++.
18 changes: 9 additions & 9 deletions dockerfiles/cpu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
FROM tensorflow/tensorflow:2.2.0
FROM tensorflow/tensorflow:2.4.1

# Default ENV Settings
ARG TF_KERAS_VIS_VERSION=0.5.0
ARG TF_KERAS_VIS_VERSION=0.6.0
ARG JUPYTER_ALLOW_IP="0.0.0.0"
ARG JUPYTER_TOKEN=""

# Setting for jupyter
RUN export JUPYTER_HOME=/root/.jupyter && \
RUN export JUPYTER_HOME=/etc/jupyter && \
export JUPYTER_CONF=$JUPYTER_HOME/jupyter_notebook_config.py && \
mkdir -p $JUPYTER_HOME && \
touch $JUPYTER_CONF && \
echo 'c.NotebookApp.allow_root = True' >> $JUPYTER_CONF && \
echo "c.NotebookApp.ip = '$JUPYTER_ALLOW_IP'" >> $JUPYTER_CONF && \
echo "c.NotebookApp.token = '$JUPYTER_TOKEN'" >> $JUPYTER_CONF
echo "c.NotebookApp.token = '$JUPYTER_TOKEN'" >> $JUPYTER_CONF && \
echo "c.NotebookApp.terminado_settings = \
{'shell_command': ['/bin/bash']}" >> $JUPYTER_CONF

# Install essential python libraries
RUN pip install --no-cache-dir \
tf-keras-vis==$TF_KERAS_VIS_VERSION \
numpy scipy imageio pillow \
jupyterlab matplotlib
RUN pip install --no-cache-dir \
tf-keras-vis[develop,examples]==$TF_KERAS_VIS_VERSION

CMD [ "jupyter", "lab" ]
CMD jupyter lab
19 changes: 9 additions & 10 deletions dockerfiles/gpu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
FROM tensorflow/tensorflow:2.2.0-gpu
FROM tensorflow/tensorflow:2.4.1-gpu

# Default ENV Settings
ARG TF_KERAS_VIS_VERSION=0.5.0
ARG TF_KERAS_VIS_VERSION=0.6.0
ARG JUPYTER_ALLOW_IP="0.0.0.0"
ARG JUPYTER_TOKEN=""

# Setting for jupyter
RUN export JUPYTER_HOME=/root/.jupyter && \
RUN export JUPYTER_HOME=/etc/jupyter && \
export JUPYTER_CONF=$JUPYTER_HOME/jupyter_notebook_config.py && \
mkdir -p $JUPYTER_HOME && \
touch $JUPYTER_CONF && \
echo 'c.NotebookApp.allow_root = True' >> $JUPYTER_CONF && \
echo "c.NotebookApp.ip = '$JUPYTER_ALLOW_IP'" >> $JUPYTER_CONF && \
echo "c.NotebookApp.token = '$JUPYTER_TOKEN'" >> $JUPYTER_CONF
echo "c.NotebookApp.token = '$JUPYTER_TOKEN'" >> $JUPYTER_CONF && \
echo "c.NotebookApp.terminado_settings = \
{'shell_command': ['/bin/bash']}" >> $JUPYTER_CONF

# Install essential python libraries
RUN pip install --no-cache-dir \
tf-keras-vis==$TF_KERAS_VIS_VERSION \
numpy scipy imageio pillow \
jupyterlab matplotlib
RUN pip install --no-cache-dir \
tf-keras-vis[develop,examples]==$TF_KERAS_VIS_VERSION

CMD [ "jupyter", "lab" ]
CMD jupyter lab
655 changes: 1 addition & 654 deletions examples/attentions.ipynb

Large diffs are not rendered by default.

Binary file modified examples/images/gradcam_plus_plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/images/smoothgrad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/images/visualize-dense-layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/images/visualize-filters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 380dacb

Please sign in to comment.