greentfrapp / lucent

Lucid library adapted for PyTorch
Apache License 2.0
597 stars 89 forks source link

Add activation grids notebook #4

Closed mehdidc closed 4 years ago

mehdidc commented 4 years ago

Issue #3, reproducing activation grids (https://github.com/tensorflow/lucid/blob/master/notebooks/building-blocks/ActivationGrid.ipynb)

It's possible to try it here: https://colab.research.google.com/drive/1pEe-KmXeDJcWQYLOHwcMubS69wVVCHLe#scrollTo=xidm-QrXvL2X

Here are the results so far with inceptionv1 and layer mixed4d:

Some remarks and a question:

greentfrapp commented 4 years ago

@mehdidc Thanks so much for the PR! Sample results look good! I'm a little occupied with a paper submission at the moment, but I will definitely take a look at this over the weekend.

greentfrapp commented 4 years ago

@mehdidc sorry for the late reply!

Re. the issue on smaller images: for Lucid, I believe because Tensorflow 1.x allows you to just retrieve a specific layer via sess.run, so there is no issue as long as the layer you want is computed. But in our case, we run the entire model, so torch raises an error when you hit the later layers. I think I'm okay with raising an exception for now, so your modification is probably alright!

Two small changes:

Should be good once those are done, I'll take care of adding it to the main README.

Thanks again for the help!!!

mehdidc commented 4 years ago

Hi @greentfrapp thanks for the remarks, I added some tests + updated notebook quotes + other minor modifications

greentfrapp commented 4 years ago

Thanks @mehdidc for the help! I think this looks good to merge and I'll add the title card for the notebook soon!

greentfrapp commented 4 years ago

Closes #3