pytorch / pytorch/vision

Move GroupedBatchSampler into torchvision

Open
#3,714 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs discussion topic: object detection
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🚀 Feature

Move the GroupedBatchSampler into the core library

Motivation

Grouping minibatch elements is often a useful feature for vision tasks, especially in object detection and segmentation problems where it is commonplace to use images with different shapes and aspect ratios. Torchvision already has an implementation of a sampler that can do this, however it isn't part of the library itself, only in the references. As such users either have to copy-paste it into their own code or import detectron2 to utilise it.

Pitch

Probably just copy the entire group_by_aspect_ratio.py into torchvision/datasets/samplers, perhaps split it out if necessary. I think this would all be useful for people working with detection or segmentation tasks that don't want to bring in all of d2.

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 with references/detection/group_by_aspect_ratio.py, especially the GroupedBatchSampler implementation, and compare it with the proposed torchvision/datasets/samplers location. Determine how the sampler should be exposed as part of the core library and preserve the referenced behavior; done means users can use it from torchvision without copying the reference code or importing detectron2.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.