vision icon indicating copy to clipboard operation
vision copied to clipboard

`NEAREST_EXACT` and `BICUBIC` work against the doc of `TrivialAugmentWide()`

Open hyperkai opened this issue 8 months ago • 2 comments

🐛 Describe the bug

The doc of TrivialAugmentWide() says that only NEAREST and BILINEAR are supported:

Parameters: ...

  • interpolation (InterpolationMode, optional) – ... If input is Tensor, only InterpolationMode.NEAREST, InterpolationMode.BILINEAR are supported.

But NEAREST_EXACT and BICUBIC work against the doc as shown below:

from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import TrivialAugmentWide, PILToTensor

origin_data = OxfordIIITPet(
    root="data"
)

def show_tawimagetensor(im, ip=None):
    taw = TrivialAugmentWide(interpolation=ip)
    ptt = PILToTensor()
    print(ptt(taw(im))[0][200])

show_tawimagetensor(im=origin_data[0][0], ip=InterpolationMode.NEAREST_EXACT)
# tensor([ 96,  99,  97, 101, 106, 114, 115, 116, 120, 117,
#         110, 108, 107, 101, 100,  96,  90,  87,  80,  77,
#          65,  67,  62,  55,  49, ..., 169,  170, 177], dtype=torch.uint8)

show_tawimagetensor(im=origin_data[0][0], ip=InterpolationMode.BICUBIC)
# tensor([ 18,  19,  19,  18,  17,  19,  20,  20,  20,  20,
#          20,  21,  16,  17,  17,  17,  19,  17,  17,  18,
#          19,  14,  17,  19,  18, ...,  19,  15,  15], dtype=torch.uint8)

Versions

import torchvision

torchvision.__version__ # '0.20.1'

hyperkai avatar May 16 '25 13:05 hyperkai

Hey @hyperkai, thank you for opening this issue. After reviewing the details, I suggest we consolidate the discussion with #9065, as it appears to be closely related.

AntoineSimoulin avatar May 21 '25 13:05 AntoineSimoulin

Feel free to submit a PR to clarify the docs @hyperkai .

NicolasHug avatar May 29 '25 12:05 NicolasHug