tint_map has negative values resulting in NaN in uvl conversion
Closed this issue · 1 comments
Hello,
In dataloader_v4.py:
if self.random_color and self.split=='train':
augment_chroma = self.random_color(illum_count)
ret_dict["illum_chroma"] *= augment_chroma
tint_map = mix_chroma(uncalculable_masked_mixmap,augment_chroma,illum_count)
input_rgb = input_rgb * tint_map # apply augmentation to input image
random augmentation to input image is applied here. However, when tint_map has negative values, input_rgb image would have also negative values and then:
def rgb2uvl(img_rgb):
"""
convert 3 channel rgb image into uvl
"""
epsilon = 1e-8
img_uvl = np.zeros_like(img_rgb, dtype='float32')
img_uvl[:,:,2] = np.log(img_rgb[:,:,1] + epsilon)
img_uvl[:,:,0] = np.log(img_rgb[:,:,0] + epsilon) - img_uvl[:,:,2]
img_uvl[:,:,1] = np.log(img_rgb[:,:,2] + epsilon) - img_uvl[:,:,2]
return img_uvl
image_rgb
goes into this function and logarithm gets negative values. Therefore, img_uvl
got NaN values.
How would you rain and obtain your results with using augmentation without having NaN issue mentioned here?
A workaround might be limiting tint_map
matrix to have 0 for negative elements of itself but this might affect the reproducing your results badly.
Looking forward to hearing from you and thank you!
Cem
Hi, @CemEntok.
Thank you for your interest about our work.
tint_map is a kind of illumination map, which is a combination of illumination chromaticity and mixture map (⍺ in the paper).
Illumination chromaticity is a G=1 normalized vector, and it's R,B component is also positive.
Mixture map, which is a kind of ratio map of intensity channel (we approximate this with G channel) also has only 0 or positive values.
So under normal circumstances, tint_map cannot have negative numbers as values.