LearningBasedSamplingMatting icon indicating copy to clipboard operation
LearningBasedSamplingMatting copied to clipboard

Load alpha question

Open sjf18 opened this issue 5 years ago • 2 comments

Hi, thanks for your great work. I have a question about alpha loading, why you set the value 0-10 to 0, and set 245-255 to 255? Is this a thick? And did you try to load the original alpha value for training, what's the diffenence of the two results? def load_alpha(self, alpha_path): alpha = cv2.imread(alpha_path, 0) alpha = np.where(alpha<10, 0, alpha) alpha = np.where(alpha>245, 255, alpha) return np.clip(np.float32(alpha/255.0), 0, 1.0)

sjf18 avatar Oct 28 '19 06:10 sjf18

The original DIM dataset provides training alpha matte as jpg so there are some compression artifacts.

I haven't done any experiments regarding this, but I don't think it will differ that much.

Those artifacts DO affect trimap generation though.

TomoshibiAkira avatar Oct 28 '19 08:10 TomoshibiAkira

Hi, thanks for your great work. I have a question about alpha loading, why you set the value 0-10 to 0, and set 245-255 to 255? Is this a thick? And did you try to load the original alpha value for training, what's the diffenence of the two results? def load_alpha(self, alpha_path): alpha = cv2.imread(alpha_path, 0) alpha = np.where(alpha<10, 0, alpha) alpha = np.where(alpha>245, 255, alpha) return np.clip(np.float32(alpha/255.0), 0, 1.0)

Because when we are actually calculating the alpha loss, we calculate the unknown region. The original alpha value is 0-255, but even if the pixel value is close to 255, we think it should belong to the foreground. In the end, if you use 245 for the loss calculation, the result is that there is a possibility of misleading loss. The adjustment here is to make the model prediction more confident.

kelisiya avatar Nov 20 '19 10:11 kelisiya