Skip to content
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

Feature Visualization: grayscale images #163

Merged
merged 16 commits into from
Sep 30, 2024
Merged

Feature Visualization: grayscale images #163

merged 16 commits into from
Sep 30, 2024

Conversation

Agustin-Picard
Copy link
Member

@Agustin-Picard Agustin-Picard commented Aug 27, 2024

Feature visualization for grayscale images

This PR adapts the code for generating feature visualizations (via Fourier, in pixel space, and using MaCo) for models trained on grayscale images.

In the case of grayscale images, no re-correlation is needed when optimizing in the Fourier domain (standard and MaCo). However, there is no standardized dataset that would generally work on any grayscale application (like ImageNet for natural images), so a dataset must be provided to compute the average magnitude for MaCo.

Disclaimer: Depending on the model under study, the optimization process can provide images that are really difficult to interpret. It seems to work much better on 1-Lipschitz models (trained using DEEL-LIP) and sometimes MaCo helps to generate better visualizations.

It responds to the feature requested in #148

Fix CI

The release of TF 2.16 integrates Keras 3.X, which seems to break some functionality. I've limited the installation of TF to <2.16.

Also, the release of NumPy 2.X breaks packages that were compiled using 1.X, and this includes TF. Thus, I've limited NumPy to 1.X.

@Agustin-Picard Agustin-Picard added enhancement New feature or request feature-visualization New feature or issue concerning Feature Viz labels Aug 27, 2024
@Agustin-Picard Agustin-Picard self-assigned this Aug 27, 2024
@Agustin-Picard
Copy link
Member Author

Agustin-Picard commented Aug 27, 2024

I had to limit tensorflow to versions <2.16 as the latest updates break a lot of things.

Edit: But I'm still getting what seems to be compatibility errors, so it's not due to the tf version...

Copy link
Collaborator

@AntoninPoche AntoninPoche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you very much Agus!

Copy link
Collaborator

@lucashervier lucashervier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I am merging :)

@lucashervier lucashervier merged commit b3192bb into master Sep 30, 2024
15 checks passed
@lucashervier lucashervier deleted the nd_feature_viz branch September 30, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature-visualization New feature or issue concerning Feature Viz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants