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

Bug: non squared input images break SklearnClassification task #15

Merged
merged 3 commits into from
Jun 23, 2023

Conversation

AlessandroPolidori
Copy link
Contributor

@AlessandroPolidori AlessandroPolidori commented Jun 15, 2023

Summary

Describe the purpose of the pull request, including:

  • What problem does it solve?
    Non squared input images currently brake sklearn classification task in two ways:
    1- torchscript export fails
    2- gradcam fails
  • How does it solve the problem?
    1-?
    2- Now mask is reconstructed correctly even when width and height are different.
  • Remaining issues
    1- I have not tried to solve this problem yet.
    2- The mask adjustment is not a trivial task. The reshape() function needs integers, so you need to find two values, height and width, such that w*h = total_size of the mask. But there is no way to know a priori how to truncate height and width values. The solution that satisfied me the most (based on output gradcams) implies a reduction of mask values. I did different tests and the resulting gradcams seem good.

Type of Change

Please select the one relevant option below:

  • Bug fix (non-breaking change that solves an issue)

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.

Screenshots or Visuals (Optional)

If applicable, please provide screenshots, diagrams, graphs, or videos of the changes, features or the error.

@AlessandroPolidori AlessandroPolidori changed the title fix: Now vit gradcam supports also non squared images Bug: non squared input images break SklearnClassification task Jun 15, 2023
quadra/utils/vit_explainability.py Outdated Show resolved Hide resolved
quadra/utils/vit_explainability.py Outdated Show resolved Hide resolved
@lorenzomammana
Copy link
Contributor

pytorch/pytorch#82068

Related to torchscript fail, we can't do anything about it right now as it is dino code

@lorenzomammana lorenzomammana merged commit 770de09 into dev Jun 23, 2023
@lorenzomammana lorenzomammana deleted the fix/non-squared-sklclss-inputs branch June 23, 2023 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants