Open bradezard131 opened 3 years ago
We'll need to have a further look on the API of the class to ensure we can commit to it but in general I see favourably providing necessary tools such as this within TorchVision.
Hi,
I believe this will be covered with the rewrite of datasets using DataPipes, in particular the GrouperIterDataPipe
function, so that you can just do `dataset.groupby(lambda x: ...).
The good thing about this implementation based on DataPipe is that it won't require knowing ahead of time the groups of all the elements in the dataset (it can be computed on-the-fly).
I believe once we provide new datasets based on datapipes (which should happen within the next few months), we will be able to close this.
Sounds good to me, thanks @fmassa for providing the context. I'll remove it from the Batteries Included list then.
Is this now supported by https://github.com/pytorch/pytorch/blob/master/torch/utils/data/datapipes/iter/grouping.py#L170 and how would you group by aspect ratio with DataPipes?
🚀 Feature
Move the
GroupedBatchSampler
into the core libraryMotivation
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
intotorchvision/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.