tensorflow / lucid

A collection of infrastructure and tools for research in neural network interpretability.
Apache License 2.0
4.65k stars 655 forks source link

[Question] DeepDream without VGG ? #226

Closed Uiuran closed 4 years ago

Uiuran commented 4 years ago

Hi all, it is indeed a question about Deep Dream, since i cant find a better place to put it (maybe you can indicate me ?), i will ask it here, after all Lucid is the heir of Deep Dream afaik.

Is it possible to do the same you do with deep dream (i.e. objective maximization of hidden channels), without using VGG ? I tried it with InceptionV4 but still without any success. Iam getting a lot of dimensionality errors in the gradients, but when i try with VGG it works fine, so the bug is not in the code ... Any example on how it is possible to work ? Thanks.

colah commented 4 years ago

DeepDream works fine with inception -- just take the tutorial notebook on the front page and use objectives.deepdream("mixed4d").

Unfortunately, we're unable to help you debug your own implementation.

Uiuran commented 4 years ago

Yes i know that, but my question is, there is a reason why it should not work for networks like InceptionV4_slim ? (for example) My implementation is the same as: https://github.com/tensorflow/examples/blob/master/community/en/r1/deepdream.ipynb

In other words, what is the criteria to choose networks such that we dont find dimensionality problems ? there is an easy way to find it ? thank you again, sorry for the insistence if it is not convenient for you.

On Sun, Feb 2, 2020 at 3:45 AM Christopher Olah notifications@github.com wrote:

Closed #226 https://github.com/tensorflow/lucid/issues/226.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/lucid/issues/226?email_source=notifications&email_token=AAOOCX4TX27RP3XAHKE6LHTRAZTWZA5CNFSM4KOXD4A2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOWLG3QXY#event-2999826527, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOOCX4JJZ7FNWANZYWM34DRAZTWZANCNFSM4KOXD4AQ .

ludwigschubert commented 4 years ago

Iam getting a lot of dimensionality errors in the gradients, but when i try with VGG it works fine, so the bug is not in the code ...

This means there is a bug in the code, no? It fails to generalize to sth specific in InceptionV4's architecture. Here's a notebook containing colah's suggestion, to show that the issue is not with the InceptionV4_slim architecture or lucid's implementation of the Deepdream objective.

If debugging the dimensionality errors you encounter doesn't work out, you might find it helpful to follow the implementation in this repository as a starting point? (It's admittedly a bit more "distributed" and complex than the notebook you linked.)

Uiuran commented 4 years ago

@ludwigschubert yes i can realize Colah implementation, and with time grasp it, since i have a little (but enough) of software engineering. But i realize one point of this simple implementation gave as example:

You can only use Conv2D hidden channels (seems pretty obvious, but i dont see why not use ANY hidden channel to produce results, such a sequential hidden channels from say RNN or use Variational Hidden channels from VAE).

If you use diverse Conv2D in the same objective, to maximize very diverse coarse grained features, this implementation also Bugs.

I would like to stick with Chris Colah's implementation, but i will need time to Hack it, since i wanna put virtually any model in place to do more pervasive Image Edition, rather than the mere demonstrative lisergical deep dream (its quite fine, but we can do better, isnt that the purpose of lucid ?).

Thank you again, i appreciate your attention very much.