Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:tensorflow/lucid
Browse files Browse the repository at this point in the history
  • Loading branch information
ludwigschubert committed May 21, 2018
2 parents d80a1ce + 4819432 commit dd7ec8d
Show file tree
Hide file tree
Showing 7 changed files with 1,574 additions and 5 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ run in your browser.
<img src="https://storage.googleapis.com/lucid-static/common/stickers/colab-tutorial.png" width="500" alt=""></img>
</a>


## Feature Visualization
*Notebooks corresponding to the [Feature Visualization](https://distill.pub/2017/feature-visualization/) article*

<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/negative_neurons.ipynb">
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-neuron-negative.png" width="500" alt=""></img>
</a>

<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/neuron_diversity.ipynb">
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-neuron-diversity.png" width="500" alt=""></img>
</a>

<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/neuron_interaction.ipynb">
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-neuron-interaction.png" width="500" alt=""></img>
</a>

<a href="https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/feature-visualization/regularization.ipynb">
<img src="https://storage.googleapis.com/lucid-static/feature-visualization/stickers/colab-regularization.png" width="500" alt=""></img>
</a>

## Building Blocks
*Notebooks corresponding to the [Building Blocks of Interpretability](https://distill.pub/2018/building-blocks/) article*

Expand Down
9 changes: 5 additions & 4 deletions lucid/optvis/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ def __init__(self, style_layers, ema_decay=None,
outputs of 'style_func'.
"""
self.input_grams = [style_func(s) for s in style_layers]
self.ema = None
if ema_decay is not None:
ema = tf.train.ExponentialMovingAverage(decay=ema_decay)
update_ema_op = ema.apply(self.input_grams)
self.ema = tf.train.ExponentialMovingAverage(decay=ema_decay)
update_ema_op = self.ema.apply(self.input_grams)
with tf.control_dependencies([update_ema_op]):
self.effective_grams = [g + tf.stop_gradient(ema.average(g)-g)
for g in self.input_grams]
self.effective_grams = [g + tf.stop_gradient(self.ema.average(g)-g)
for g in self.input_grams]
else:
self.effective_grams = self.input_grams

Expand Down
3 changes: 2 additions & 1 deletion lucid/scratch/web/svelte.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def inner(data):
@register_cell_magic
def html_define_svelte(line, cell):
base_name = line.split()[0]
name_str = base_name + "_" + str(uuid.uuid4())
# name_str will become the name of a javascript variable, and can't contain dashes.
name_str = base_name + "_" + str(uuid.uuid4()).replace('-', '_')
html_fname = osp.join(_svelte_temp_dir, name_str + ".html")
with open(html_fname, "w") as f:
f.write(cell)
Expand Down
244 changes: 244 additions & 0 deletions notebooks/feature-visualization/negative_neurons.ipynb

Large diffs are not rendered by default.

251 changes: 251 additions & 0 deletions notebooks/feature-visualization/neuron_diversity.ipynb

Large diffs are not rendered by default.

496 changes: 496 additions & 0 deletions notebooks/feature-visualization/neuron_interaction.ipynb

Large diffs are not rendered by default.

556 changes: 556 additions & 0 deletions notebooks/feature-visualization/regularization.ipynb

Large diffs are not rendered by default.

0 comments on commit dd7ec8d

Please sign in to comment.