-
Notifications
You must be signed in to change notification settings - Fork 533
DO NOT MERGE - Optimization module for Feature Visualization #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WIP optim module
Hey @ludwig, happy to be able to help! Just looked through the code and here are some comments, feel free to disagree!
I think this is fine. I was thinking we might wanna:
I was also thinking if there was a better way to identify targets. I imagine it will be tedious for larger networks with many more nested modules.
The first 2 issues are probably separate from the actual optimization step. For that last thing, I'm not sure what I feel about writing
|
Thank you again for the PR @ludwigschubert and thank you for the feedback comments @greentfrapp. I looked into the packaging structure on the high level and here are couple ideas. I'd be happy to discuss and hear your thoughts about it as well. captum.optim.tech package -> It looks like here we have specific examples, visualizations, dependency to kornia, clarity.pytorch, lucid. I'd suggest to move this to a tutorial notebook. Some of the functionally can be moved to captum.optim.param.transform -> This is great to support different types of input transformations. In order to not depend on a specific library 'kornia' we can make captum.optim.optim.objectives and captum.optim.optimize -> In captum we put core logic under captum.optim.models package -> It looks like here we have some custom code related to inception model and reference to tensorflow. We might think of using torchvision if possible, if not, then we can see how we can reduce the dependency on external packages such as tensorflow. Since some of it is specifically related to inception model we can also think of moving some of it to tutorials section. captum.optim.io package -> It looks like here as well we have reference to lucid and image specific implementation. I agree with @greentfrapp. If we can move some of it to ImageTensor - that would be great. captum.optim.optim/output_hooks.py -> As mentioned above, it would be great to move this to Test cases: To be consistent with captum tests we can move the test cases to Thank you everyone for contributing :) Let me know what do you think. |
Hey @NarineK I'm reviving this thread since we are kickstarting this again. Also to refresh myself on this PR. Re. your comments: captum.optim.techs -> Yup I think moving these to a tutorial notebook sounds good, probably to https://github.com/pytorch/captum/tree/master/tutorials? We can make it more self-contained, like my previous work on Lucent. captum.optim.param.transform -> I've received some related feedback from @ProGamerGov that helps to remove dependencies on Kornia for differentiable transformations, if that's what we are looking for. captum.optim.optim.(objectives/optimize/output_hook) -> I don't mind moving these to captum.optim.models -> In our previous work on Lucent, we used a PyTorch version of the GoogLeNet/InceptionV1 model (with the same weights) that was converted by @ProGamerGov. So Lucent does not require any tf imports to load the model. We can probably do the same here. Alternatively, we can use a torchvision-supported model for tests, demos and tutorials instead. captum.optim.io -> Agree re. implementing an ImageTensor class that includes io functions. We can definitely work on this. Tests -> Yup! Moving to the test folder sounds good. Summary/Discussion/Next Steps:
Happy to have a meeting about this! |
captum.optim.models -> If the default model that @greentfrapp is using is a bit too confusing in terms of layer names, I also have a converted version of the model and others that more closely resemble PyTorch's GoogleNet model class format. This version also uses adaptive pooling so that any size input is supported. This may make it easier for PyTorch users to use and understand the model. |
Thank you for the collaboration on this PR: @ProGamerGov, @greentfrapp and @ludwigschubert ! Closing this PR since we have merged it into |
This is an early-stage PR for a WIP implementation of feature visualization and other techniques from papers I co-authored in PyTorch. The current code was created together with Gabriel Goh and is based on earlier Tensorflow implementations of these techniques by Chris Olah, Alex Mordvintsev, and me—while the commit structure doesn't reflect this, one aspect we should consider is some form of attribution to those original authors.
I'm posting it so SK and maybe others can collaborate on it in the next weeks! :-) It is not yet ready for merging, and there may still be major module reorganizations.
Roadmap