pytorch / pytorch/vision

Public _RandomApplyTransform class

Open
#7,799 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: transforms needs discussion
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🚀 The feature

Make _RandomApplyTransform public for custom random apply transforms.

https://github.com/pytorch/vision/blob/9ebf10af02aeb882bd8d7782149e21b48528d562/torchvision/transforms/v2/_transform.py#L139

The main change is to refactor _RandomApplyTransform to RandomApplyTransform, add it to the available classes in torchvision.transforms.v2.

https://github.com/pytorch/vision/blob/9ebf10af02aeb882bd8d7782149e21b48528d562/torchvision/transforms/v2/__init__.py#L5

Motivation, pitch

This class might be beneficial for custom transformations that should have Random behaviour. We are currently playing with non-standard augmentation pipelines that needs this.

I will submit a PR with this refactoring.

Alternatives

No response

Additional context

No response

cc @vfdev-5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in torchvision/transforms/v2/_transform.py at the referenced _RandomApplyTransform definition, then inspect torchvision/transforms/v2/init.py where available classes are listed. Rename the class for public use, expose it through the v2 module, and verify that custom random apply transforms can import it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.