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 --use-v2 support to classification references #7724

Merged
merged 9 commits into from
Jul 7, 2023

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Jul 6, 2023

I didn't add the --backend datapoint option here. It will be needed for detection, but for classif we don't have to. If we want it, I'll add it at the same time as the detection references (it'll be easier to tackle both at the same time).

Note that using --use-v2 adds our deprecation warnings (as expected). I feel like it's best to leave them, instead of suppressing them - after all, those references are meant to be copy/pasted/adapted.

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 6, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7724

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures

As of commit bb4608c:

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

):
transforms, _ = get_modules(use_v2)
Copy link
Member Author

Choose a reason for hiding this comment

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

Not from this PR but we have

  • transforms the module
  • trans the list
  • self.transforms the Compose attribute

Maybe we should do a bit of clean-up. I'm leaving it out for now but can do it in this PR if that's OK

Copy link
Member Author

Choose a reason for hiding this comment

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

I ended up making the cleanup in this PR:

transforms the module -> renamed to module
trans the list -> renamed to transforms
self.transforms the Compose attribute -> kept as self.transforms

also removed autoaugment as you suggested below, it's now just module

import torchvision.transforms
import torchvision.transforms.autoaugment

return torchvision.transforms, torchvision.transforms.autoaugment
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also falls into the cleanup category, but maybe we can do that here: v1 also exposes all AA transforms under torchvision.transforms

from .autoaugment import *

Meaning, there is no need for two modules here.

Comment on lines 6 to 7
# We need lazy import to avoid the V2 warning in case just V1 is used
import torchvision
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just importing the top namespace shouldn't emit warning, or does it? Plus, since we are not using torchvision directly below, but rather import other namespaces, do we need this line at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll move it out and check if we actually need it

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

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

Stamping, since none of my previous comments is blocking.

@NicolasHug
Copy link
Member Author

Thanks Philip, I addressed the comments and I'll merge now and move on to the detection part. I'll still nee to properly handle the case of the presets for classification (the ones used by --test-only i.e. the weights.transforms() stuff). I'll take care of that later.

@NicolasHug NicolasHug merged commit 08c9938 into pytorch:main Jul 7, 2023
@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Hey @NicolasHug!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

facebook-github-bot pushed a commit that referenced this pull request Aug 25, 2023
Reviewed By: matteobettini

Differential Revision: D48642323

fbshipit-source-id: 649230cd31a4c30eb2e483d5c75b8a0f94f66680
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants