-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add blur, gradient clipping, and regularization to ClassSpecificImageGenerator #72
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
Add blur, gradient clipping, and regularization to ClassSpecificImageGenerator #72
Conversation
…e 'class_{target_class}'
Thanks for the PR @alexstoken! I'm currently on a very tight schedule due to some conference deadlines, I will try to have a look at these changes as soon as I can! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be too much if I ask you to move the changes to a self-contained separate file (including the blurring without modifying misc_functions.py)? I would like to keep the bare-bone example as it is to allow people who recently started learning pytorch a gentle introduction.
I'll make the adjustments in the next few days and I'll let you know when I push them. What would you like the new file and class called? Maybe something along the lines of |
Both are fine by me. Can you just use snake case instead of camel? Also, please do include a header similar to what is below. """ |
Create new file with regularized class specific image generator in it
Thanks for the changes! I will try to have a look at it as soon as I have free time at my hands! |
Thanks! Is it possible on your end to just accept the changes to the new file, or should I undo my commits to |
Preprocess function, which now contains blur and has been renamed preprocess_and_blur_image(), has been moved from misc_functios to this file
I would appreciate if you could undo changes on other two files, if you are too busy I can fix it as well. |
…lass_specific_samples
Add cuda capabilities. Move model and processed_image to cuda, and final images to cpu, as required. This adds large speed improvements to the process.
PIL image verification left in
…te_class_specific_samples Changes to file paths and an interation parameter remain
I've now undone the regularization changes in the previous files, but I've left a few others for your consideration. The primary remaining changes in The primary change in Finally, the new Let me know what you think! |
Hey @alexstoken, thanks for the changes. I will accept the PR and go over the changes the moment I have some free time. |
Huh, finally able to merge the PR. Thanks a lot for it! |
Thanks for a great visualization suite. I was having trouble getting a quality image from the class specific image generator so I implemented some of the techniques you suggested in the README and that are originally from Understanding Neural Networks Through Deep Visualization. These techniques greatly improved my visualizations.
Tested with torchvision 0.5.0 with model and image on cpu. To use GPU, will likely have to add logic to transfer image to cpu for PIL and then back to GPU for optimization, but I haven't looked in to this much.