transforms.ColorJitter() vs transforms.ColorJitter.getparams()

I am working on torchvision 0.3.0, and the following code produces error, requires a list.

(a) transforms.ColorJitter.get_params(brightness=32. / 255, contrast=0.5)

However, the following code is valid.

(b) transforms.ColorJitter(brightness=32. / 255, contrast=0.5)

Is there a particular reason behind this distinction?


.get_params(), from the source code, requires lower and upper bounds for each parameter (brightness, contrast, saturation and hue), as well as each parameter to be set, as they don’t have default values.

However, the ColorJitter.__init__() method accepts both int and listor tuple input arguments, which are then properly formatted with the private method _check_input().

Why do you want to use .get_params() instead of the more convenient form ColorJitter(...) ?

Thank you for the fast response!
I need to transform stereo single channel images, so I use it to feed parameters to transforms.functional ops. Well anyway, I will enter the boundaries manually but I think same input properties between get_params() and ColorJitter(…) would be nice :slight_smile:


Apparently there is no ColorJitter in functional transforms LOL:D I assumed that it would exist haha!