-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from keisen/develop
Release v0.2.0
- Loading branch information
Showing
24 changed files
with
982 additions
and
549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
dist: xenial | ||
branches: | ||
except: | ||
- gh-pages | ||
language: python | ||
python: | ||
- "3.5" | ||
- "3.6" | ||
- "3.7" | ||
env: | ||
- TF_VERSION=2.0.0 TF_KERAS_VIS_MAX_STEPS=3 | ||
- TF_VERSION=2.0.1 TF_KERAS_VIS_MAX_STEPS=3 | ||
- TF_VERSION=2.1.0 TF_KERAS_VIS_MAX_STEPS=3 | ||
install: | ||
- pip install -U pip | ||
- pip install -U --force-reinstall -e .[development,examples] tensorflow==$TF_VERSION | ||
script: | ||
- PYTHONPATH=$PWD:$PYTHONPATH py.test | ||
- jupyter-nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute examples/attentions.ipynb | ||
- jupyter-nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute examples/visualize_dense_layer.ipynb | ||
- jupyter-nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute examples/visualize_conv_filters.ipynb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM tensorflow/tensorflow:2.1.0-py3 | ||
|
||
# Default ENV Settings | ||
ARG TF_KERAS_VIS_VERSION=0.2.0 | ||
|
||
# Setting for jupyter | ||
RUN export JUPYTER_HOME=/root/.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 = "0.0.0.0"' >> $JUPYTER_CONF && \ | ||
echo 'c.NotebookApp.token = ""' >> $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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM tensorflow/tensorflow:2.1.0-gpu-py3 | ||
|
||
# Default ENV Settings | ||
ARG TF_KERAS_VIS_VERSION=0.2.0 | ||
|
||
# Setting for jupyter | ||
RUN export JUPYTER_HOME=/root/.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 = "0.0.0.0"' >> $JUPYTER_CONF && \ | ||
echo 'c.NotebookApp.token = ""' >> $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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setup( | ||
name="tf-keras-vis", | ||
version="0.1.0", | ||
version="0.2.0", | ||
author="keisen", | ||
author_email="[email protected]", | ||
description="Neural network visualization toolkit for tf.keras", | ||
|
@@ -18,15 +18,11 @@ | |
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires='>=3.6', | ||
python_requires='>=3.5, <3.8', | ||
install_requires=['numpy', 'scipy', 'imageio', 'pillow'], | ||
extras_require={ | ||
'cpu': ['tensorflow >= 2.0'], | ||
'gpu': ['tensorflow-gpu >= 2.0'], | ||
'development': [ | ||
'flake8', 'isort==4.3.*', 'yapf==0.28.*', 'pytest', 'pytest-pep8', 'pytest-xdist', | ||
'pytest-cov' | ||
], | ||
'development': | ||
['flake8', 'isort', 'yapf', 'pytest', 'pytest-pep8', 'pytest-xdist', 'pytest-cov'], | ||
'examples': ['jupyterlab', 'matplotlib'], | ||
}, | ||
include_package_data=True, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import numpy as np | ||
import pytest | ||
import tensorflow as tf | ||
from tensorflow.keras.layers import Dense | ||
from tensorflow.keras.models import Sequential | ||
|
||
from tf_keras_vis import ModelVisualization | ||
|
||
|
||
@pytest.fixture(scope="function", autouse=True) | ||
def model(): | ||
return Sequential([Dense(5, input_shape=(3, )), Dense(2, activation='softmax')]) | ||
|
||
|
||
class MockVisualizer(ModelVisualization): | ||
def __call__(self): | ||
pass | ||
|
||
|
||
def change_activation(model): | ||
model.layers[-1].activation = tf.keras.activations.linear | ||
|
||
|
||
def test__init__(model): | ||
mock = MockVisualizer(model) | ||
assert mock.model != model | ||
assert np.array_equal(mock.model.get_weights()[0], model.get_weights()[0]) | ||
|
||
mock = MockVisualizer(model, clone=False) | ||
assert mock.model == model | ||
|
||
mock = MockVisualizer(model, change_activation) | ||
assert mock.model != model | ||
assert mock.model.layers[-1].activation == tf.keras.activations.linear | ||
assert model.layers[-1].activation == tf.keras.activations.softmax | ||
|
||
another_model = Sequential([Dense(5, input_shape=(3, ))]) | ||
mock = MockVisualizer(model, lambda m: another_model) | ||
assert mock.model != model | ||
assert mock.model == another_model |
Oops, something went wrong.