greentfrapp / lucent

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

get raw_activations #31

Closed 2nayk closed 3 years ago

2nayk commented 3 years ago

Hi, thanks for this great library! I'm trying to reproduce the Activation Atlas notebook using lucent, creating grid cells in the end.

In the notebook, "raw activation" is available in a numpy.ndarray format by "model.layers[7].activations" to utilise in the next Dimensionality reduction section. How can I get this raw activation using lucent?

I did create visualised images using lucent render_vis first, and then flattened them to use UMAP fit method, but I'm not sure this is correct. Any suggestion would be appreciated.

greentfrapp commented 3 years ago

Hi @2nayk! Thanks so much for checking out lucent! The activationsattribute seen in the Activation Atlas notebook is actually obtained by iterating over ImageNet samples (see the docstring in https://github.com/tensorflow/lucid/blob/master/lucid/modelzoo/aligned_activations.py). Unfortunately as of now, lucent has no support for this and I am busy at the moment so I probably won't have time to build this feature. But I'll be happy to merge any PRs that would help lucent support this!

2nayk commented 3 years ago

Hello @greentfrapp. Thank you so much for looking into this and sending me the relevant link. For the time being, I will follow the lucid code for my dataset :)