richzhang / colorization

Automatic colorization using deep neural networks. "Colorful Image Colorization." In ECCV, 2016.
http://richzhang.github.io/colorization/
BSD 2-Clause "Simplified" License
3.35k stars 928 forks source link

Need a clarification why exactly the number 313 #44

Closed preslavrachev closed 6 years ago

preslavrachev commented 6 years ago

Hi,

I know that this is not the place for asking questions about the theory behind your research, but just I wanted to clarify the derivation of the number 313. I am trying to do a similar experiment on my own (https://github.com/preslavrachev/nn-photo-colorization), but I am approaching it from the ground up, basically setting up my own model and everything. I ended up reading your paper, and I got really interested in integrating some of your findings into my experiment. I understand the logic behind the ab space classification, but I can't exactly figure out why 313. Is this a heuristic you came up with, or is it something trivial that I'm just missing on?

I have to say, I am very interested to ML, but pretty new to the field, so please, excuse my ignorance, in case I have missed something extremely trivial.

chuchienshu commented 6 years ago

hi@preslavrachev ,I try to give you my view.For RGB image,they get LAB image via color.rgb2lab() ,which L should be inside interval [0, 100], while A & B both inside [-127, 128].Then, they create gamut with 1010 bins based on condition that L=50.Consider convenience,assuming that A & B both start at -120 and end at 120,so each color channel has 25 discrete points,which are (-120,-110, ... , 0, ... , 110, 120).Now you see,313 actually is the result that 2525/2!! But why the number 313 but not others? I think 313 can fulfill the color needs while reduce compute cost. BTW, All guess! welcome to discuss.hah

richzhang commented 6 years ago

I divide the ab gamut into 10x10 bins. However, in Lab colorspace, not all (a,b) values are actually used (aka "in-gamut"). You can see that in Figure 2b in our paper: https://arxiv.org/pdf/1603.08511.pdf. I keep the bins which are in-gamut.

magicse commented 2 years ago

Sorry ... I want to clarify. You mean A_ch (- 110 .. 110)/10 B_ch(-110..110)/10 = 484. You get 22 bins for A and 22 bins for B channels with step 10. Or A_ch (- 110 .. 120)/10 B_ch(-110..120)/10 = 529 where 23 bins for A and 23 bins for B channels with step 10. And from 484 or 529 take 313 gamut included values. Am I right?