vision icon indicating copy to clipboard operation
vision copied to clipboard

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

Open hyperkai opened this issue 7 months ago • 2 comments

🐛 Describe the bug

The doc of AutoAugment() 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 AutoAugment, PILToTensor

origin_data = OxfordIIITPet(
    root="data"
)

def show_aaimagetensor(im, ip=None):
    aa = AutoAugment(interpolation=ip)
    ptt = PILToTensor()
    print(ptt(aa(im))[0][200])

show_aaimagetensor(im=origin_data[0][0], ip=InterpolationMode.NEAREST_EXACT)
# tensor([ 83,  74,  77,  80,  81,  76,  85,  88, 128, 143,
#         194, 215, 247, 225, 242, 255, 255, 238, 242, 242,
#         242, 247, 255, 238, 247, ..., 255, 255,   0], dtype=torch.uint8)

show_aaimagetensor(im=origin_data[0][0], ip=InterpolationMode.BICUBIC)
# tensor([ 32,  34,  34,  32,  30,  34,  36,  36,  36,  36,
#          36,  37,  28,  30,  30,  30,  34,  30,  30,  32,
#          34,  25,  30,  34,  32, ...,  34,  27,  27], 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