-
Notifications
You must be signed in to change notification settings - Fork 459
added dinov2 #3186
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
base: master
Are you sure you want to change the base?
added dinov2 #3186
Conversation
for more information, see https://pre-commit.ci
I manage to refactor the new dinov2 feature extractor into the existing fid implementation keeping backwards compatibility |
Codecov Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (37%) is below the target coverage (95%). You can increase the head coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## master #3186 +/- ##
=========================================
- Coverage 99% 37% -62%
=========================================
Files 15 349 +334
Lines 195 19938 +19743
=========================================
+ Hits 194 7376 +7182
- Misses 1 12562 +12561 🚀 New features to boost your workflow:
|
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.
seems it is not compatible with python 3.9
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.
Pull Request Overview
This PR adds support for DinoV2 feature extractors to the FrechetInceptionDistance metric, expanding beyond the original InceptionV3-only implementation. The changes introduce string-based feature specification and deprecate integer inputs while maintaining backward compatibility.
- Adds
NoTrainDinoV2
class for DinoV2 feature extraction - Introduces string-based feature specification (e.g., "inception-2048", "dino-768")
- Updates API to use
feature_extractor
instead ofinception
attribute names
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/torchmetrics/image/fid.py | Core implementation adding DinoV2 support, feature mapping, and API updates |
tests/unittests/image/test_fid.py | Comprehensive test updates for new feature extractors and string-based configurations |
CHANGELOG.md | Documents the new DinoV2 feature extractor support |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
self.inception = NoTrainInceptionV3( | ||
name="inception-v3-compat", | ||
self.feature_extractor = NoTrainInceptionV3( | ||
name=f"inception-{feature}", |
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 name parameter should be 'inception-v3-compat' to maintain compatibility with the original implementation, not f'inception-{feature}'. This change could break existing functionality that depends on the specific model name.
name=f"inception-{feature}", | |
name="inception-v3-compat", |
Copilot uses AI. Check for mistakes.
], | ||
) | ||
def test_compare_fid(tmpdir, equal_size, feature_config): | ||
"""Check that the whole pipeline gives the same result as torch-fidelity.""" |
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.
Typo in comment: 'whole' should be 'hole' to maintain consistency with the original comment.
Copilot uses AI. Check for mistakes.
What does this PR do?
Fixes #3110
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃
📚 Documentation preview 📚: https://torchmetrics--3186.org.readthedocs.build/en/3186/