yizhezhang2000/SAMAug

Enhance inage is to light?

Closed this issue · 3 comments

train_1
after following your enhance code ,my image is to light ,why?

Hi, thanks for the interest. Directly adding the maps generated to the original images would make the pixels closer to 255; hence, the image would become brighter. Some pixels would have values over 255 (or 1 in the 0~1 scale), and saving the image would truncate any values higher than 255 back to 255 (which is not good, as some information would be lost during the truncation step). Saving the image is mostly for visualization.

I would suggest saving the maps in NPY files separately. During training and testing, load images and the corresponding NPY files simultaneously. Add the maps to the images and perform any necessary normalization steps. As long as the steps in the training and testing are consistent, it should be fine.

Thank for your reply,I have another question:the orignal image is a rgb image ,its first channel is red,after your provided enhance code ,the second and the third channel both changed, according to your paper ,its first channel should be to change to gray image ,but in your code ,I do not found any action for the first channel,should I add code to change its first :red channel to gray image?

Thanks for your reply. In the paper, it was stated that "We add the segmentation prior map to the
second channel of the raw image and the boundary prior map to the third channel of the raw image. If the raw image is in gray-scale, we create a 3-channel image with the first channel consisting of the gray-scale raw image, the second
channel consisting of its segmentation prior map (only), and the third channel
consisting of its boundary prior map (only)."

This code in [SAMAug_barebone.py] was for the RGB raw image case.

For the grayscale raw image case, place the grayscale image on the first channel and the prior maps on the second and third channels, as stated in the paper.