Cannot find `convert_color_space`

When I use to_grayscale, there’s a deprecation warning:

UserWarning: The function `to_grayscale(...)` is deprecated in will be removed in a future release. Instead, please use `convert_color_space(..., color_space=datapoints.ColorSpace.GRAY)`.

However, I can’t find this function in the current code base (commit: 5178a2e2b19f9c133e3304bdca1a4601a77e76bf).

That’s a bit weird as I also cannot find it via grep -r in the repository (besides the two replacement strings).
CC @pmeier in case this method is planned to be integrated or in case the replacement method shows a wrong function name.

Sorry for the late reply. I was OOO.

Thanks @function2 for the report. This is indeed a bug. I’ve opened an issue on the torchvision repository for this.

1 Like

The right thing to do is to use the rgb_to_grayscale function. I’ve just merged a patch to fix the warning. Starting with tomorrows nightly release, the warning will tell you the same.

Ultimately, this kicked off a discussion whether we want to deprecate to_grayscale at all. We decided that the deprecation was a mistake and took it back. Meaning, you can continue using it and don’t have to migrate.