YuxinWenRick/tree-ring-watermark

errors in image_distortion?

Georgefwt opened this issue · 3 comments

img1 = Image.fromarray(np.clip(np.array(img1) + g_noise, 0, 255))

type of g_noise and np.array(img1) is already np.uint8, so np.clip won't have any effect.

Hi! Nice catch, I think you are right.

Actually, another potential issue could be that because np.array(img1) is np.uint8, it might cause overflow/underflow when adding noise, so I think it might be better to convert it to np.int16 first and cast it back like: img1 = Image.fromarray(np.clip(np.array(img1, dtype=np.int16) + g_noise, 0, 255).astype(np.uint8)).

What do you think?

Exactly, that's what I'm talking about. Maybe the result in the paper should be updated? I think the score will be better.

Agree! We will update the number in the next arXiv version. Thank you once again!