Update low-level functional transforms with value_range
See original GitHub issueFollowing https://github.com/pytorch/vision/pull/5500#discussion_r816599553 we may want to update low-level functional transforms with value_range
argument to avoid implicit hard-coded max range definition:
- 255 for uint8
- 1.0 for float
Today this is done for
-
all ops using
_blend
: https://github.com/pytorch/vision/blob/95d418970e6dbf2e4d928a204c4e620da7bccdc0/torchvision/transforms/functional_tensor.py#L259-L262
We can introduce new argument value_range
and use it explicitly for these ops.
In general we can think of value_range
as a tuple (min, max) which would cover majority of imagery where channels ranges are similar. There could be however other type of images (e.g. think of non-RGB color spaces or particular imagery) where value ranges could vary per channel, thus we may need to represent value_range
as a list of 2-tuples: [(min_1, max_1), (min_2, max_2), …]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
I think the reason is that torch script does not support global. We could do however something like:
@datumbox do you think it worth a change ?
EDIT: updated 256 -> 255
I think we should close this for now.