This article tries to explain image colorizing strategy of pix2pix research. This question references this article only.
In the dataset 'Making Dataset and DataLoaders' section, inside __getitem__ method, after converting the image to L*a*b, they divide L part of the tensor by 50 and subtract 1. This will surely bring the L values between -1 and 1 as L ranges from 0 to 100.
But ab values are divided by 110, which is strange, as ab values range from -128 to 128. As of my understanding, ab should be divided by 128 to bring its values between -1 and 1.
If anyone understands the logic behind this, please take the time to tell me.
CodePudding user response:
Theoriticaly a and b are not bounded but often clamped for practical reason.
The a* and b* axes are unbounded, and depending on the reference white they can easily exceed ±150 to cover the human gamut. Nevertheless, software implementations often clamp these values for practical reasons. For instance, if integer math is being used it is common to clamp a* and b* in the range of −128 to 127.
I think that the source of the 110 is this Matlab implementation
However, I assume that this DOESN'T hold for the skimage.color implemneation so it may be a mistake.
2: http://ai.stanford.edu/~ruzon/software/rgblab.html scikit.