-
Notifications
You must be signed in to change notification settings - Fork 69
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
Unified, centralized and simplified code; added CPU option #6
base: master
Are you sure you want to change the base?
Conversation
better maintainability
better maintainability
notebooks do not have their own implementation of the code but rely on the centralized files
Check out this pull request on You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB. |
@fg91 sorry for the mess. I know it is hard to review, because it combines quite a lot of changes in one PR. Should I make several pull requests out of it? |
experiments/filtervisualizer.py
Outdated
opt_steps_ = int(opt_steps * 1.3) | ||
else: | ||
opt_steps_ = opt_steps | ||
train_tfms, val_tfms = tfms_from_model(self.model, sz) |
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.
This is done in the get_transformed
and most_activated
methods as well. How about making these instance attributes?
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.
Oh you are right. I overlooked that I'm afraid. I will change that!
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.
Thanks!
Hey, Would you be willing to change the following?
Thanks! Fabio |
experiments/filtervisualizer.py
Outdated
activations = SaveFeatures(layer) # register hook | ||
self.model(V(transformed)[None]) | ||
|
||
print(activations.features[0, 5].mean().data.cpu().numpy()) |
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.
Why print especially activations.features[0, 5]
? This was from the experiments folder, correct? :)
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.
Yep. Sorry for that. I will also change that!
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.
No need to apologize, I'm happy you put effort into improving the code, thanks for that!
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.
The
experiments
folder contains additional notebooks provided by a reader of the blog post, so I would like to keep theFilterVisualizer
separated from it. Could you please move thefiltervisualizer.py
out of theexperiments
folder? Theplot_reconstructions.py
can stay in the experiments folder as it is only used for the additional experiments...
I will move it to the root then!
Would you be willing to simplify the
Calculate_mean_activation_per_filter_in_specific_layer_given_an_image.ipynb
using themost_activated method? from
FiterVisualizer`?
Yes! I was thinking thinking about it already but decided not to, because
- the notebook would be basically empty then (perhaps I can combine the two then?) and
- I was not sure whether to include the
threshold
in the method or not.
IMHO it makes more sense to do thethreshold
outside of the method.
What do you think?
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.
- Yes, I agree to not include the threshold in the method.
- I would prefer to keep two separate notebooks even though there is not that much in the second one because I would have to go through the blog post and remove any hyperlinks to the 2nd notebook ahah
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.
Okay, that does make sense! I will apply the discussed changes and keep both notebooks separated then! 😃
adds parent dir to sys.path
train_tfms and val_tfms
prior to that it used its own implementation
I finally addressed your proposed changes 🎉 :
|
@fg91 If there is anything else you want me to change, just let me know. |
Here are some things I added/ changed:
filtervisualizer.py
fileplot_reconstructions.py
filefilter
functionThings I have not changed yet, but will do in the future:
Thus, it should be much easier to change things in the future/ migrate to new fastai version.