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

add: Migrate vit gradcam code + pytorch export format for classificat… #7

Merged
merged 22 commits into from
Jun 8, 2023

Conversation

AlessandroPolidori
Copy link
Contributor

@AlessandroPolidori AlessandroPolidori commented Jun 1, 2023

Summary

Features:

  • Gradcam for Visual Transformers in Classification and SklearnClassification tasks using Attention Gradient Rollout!
  • Now Classification and SklearnClassification tasks can export models also in pytorch format
  • This format is used by their respective evaluation/test tasks, so you can compute gradcams also when you test an already trained model. Other tasks currently export only in torchscript format and their respective eval. tasks can only import torchscript models.

Type of Change

  • New feature (non-breaking change that adds functionality)

Checklist

Please confirm that the following tasks have been completed:

  • I have tested my changes locally and they work as expected. (Please describe the tests you performed.)
  • I have added unit tests for my changes, or updated existing tests if necessary.
  • I have updated the documentation, if applicable.
  • I have installed pre-commit and run locally for my code changes.

@lorenzomammana lorenzomammana added the enhancement New feature or request label Jun 2, 2023
@lorenzomammana lorenzomammana changed the base branch from main to dev June 5, 2023 07:07
@lorenzomammana lorenzomammana requested review from lorenzomammana and removed request for lorenzomammana June 5, 2023 07:33
Copy link
Contributor

@lorenzomammana lorenzomammana left a comment

Choose a reason for hiding this comment

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

There are still some points I would review

quadra/modules/classification/base.py Show resolved Hide resolved
quadra/modules/classification/base.py Outdated Show resolved Hide resolved
quadra/tasks/classification.py Outdated Show resolved Hide resolved
quadra/tasks/classification.py Show resolved Hide resolved
quadra/tasks/classification.py Outdated Show resolved Hide resolved
quadra/utils/export.py Show resolved Hide resolved
quadra/utils/vit_explainability.py Show resolved Hide resolved
quadra/utils/vit_explainability.py Show resolved Hide resolved
quadra/utils/vit_explainability.py Outdated Show resolved Hide resolved
quadra/utils/vit_explainability.py Outdated Show resolved Hide resolved
@AlessandroPolidori AlessandroPolidori marked this pull request as draft June 5, 2023 13:59
Copy link
Contributor

@lorenzomammana lorenzomammana left a comment

Choose a reason for hiding this comment

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

Almost there 🔜

@lorenzomammana lorenzomammana marked this pull request as ready for review June 7, 2023 15:04
Copy link
Contributor

@lorenzomammana lorenzomammana left a comment

Choose a reason for hiding this comment

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

LGTM

quadra/utils/vit_explainability.py Outdated Show resolved Hide resolved
@lorenzomammana lorenzomammana merged commit 6e646f1 into dev Jun 8, 2023
@lorenzomammana lorenzomammana deleted the feature/gradcam_for_vits branch June 8, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants