Skip to content

Setting the greater 1st value than the 2nd value to brightness, contrast, saturation and hue argument of ColorJitter() gets unreasonable error messages #8833

@hyperkai

Description

@hyperkai

🐛 Describe the bug

Setting the greater 1st value than the 2nd value to brightness, contrast, saturation and hue argument of ColorJitter() gets the unreasonable error messages as shown below:

from torchvision.transforms.v2 import ColorJitter

ColorJitter(brightness=(3.0, 2.0)) # Error

ColorJitter(contrast=(3.0, 2.0)) # Error

ColorJitter(saturation=(3.0, 2.0)) # Error

ColorJitter(hue=(0.3, 0.2)) # Error

ValueError: brightness values should be between (0, inf), but got [3.0, 2.0].

ValueError: contrast values should be between (0, inf), but got [3.0, 2.0].

ValueError: saturation values should be between (0, inf), but got [3.0, 2.0].

ValueError: hue values should be between (-0.5, 0.5), but got [0.3, 0.2].

So, they should be something reasonable like below:

ValueError: brightness's 1st value must be greater than or equal to the 2nd value, but got [3.0, 2.0].

ValueError: contrast's 1st value must be greater than or equal to the 2nd value, but got [3.0, 2.0].

ValueError: saturation's 1st value must be greater than or equal to the 2nd value, but got [3.0, 2.0].

ValueError: hue's 1st value must be greater than or equal to the 2nd value, but got [0.3, 0.2].

Versions

import torchvision

torchvision.__version__ # '0.20.1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions