PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 30, 2022

[FIXED] Why ab of L*a*b is divided by 110 to normalize it between -1 and 1?

 July 30, 2022     deep-learning, image, python, pytorch     No comments   

Issue

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.


Solution

Theoriticaly a and b are not bounded but often clamped for practical reason.

from wikipedia

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.



Answered By - Lior Cohen
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing