AIM 2020 Image Extreme Inpainting Challenge Track 1 Classic Inpainting Forum

Go back to competition Back to thread list Post in this thread

> Bug in the Mask Generation Script masks.py

Dear organizers,

Could you check the get_ca_mask method in the mask generation script masks.py please? probably there is something wrong with the codes from line 65 to line 75.

Thanks.

Posted by: BossGao @ May 26, 2020, 12:49 p.m.

Hello,

Could you share your error? The code works for us.

Best,
Evan

Posted by: vglsd @ May 26, 2020, 1:44 p.m.

Thanks for your attention.

65 if scale > 1:
66 struct = ndimage.generate_binary_structure(2, 1)
67 mask = ndimage.morphology.binary_dilation(mask, struct)
68 elif scale > 3:
69 struct = np.array([[ 0., 0., 1., 0., 0.],
70 [ 0., 1., 1., 1., 0.],
71 [ 1., 1., 1., 1., 1.],
72 [ 0., 1., 1., 1., 0.],
73 [ 0., 0., 1., 0., 0.]])
74
75 return mask

1) the "elif" section, i.e. line 68-73 will never be executed; what are these codes supposed to do?
2) when scale > 1, the get_ca_mask method returns boolean mask , when scale ==1 uint8 mask is returned. The returned datatype should be consistent I think.
I was worrying about that, if this get_ca_mask will generate masks the organizers expected.

Thanks.

Posted by: BossGao @ May 27, 2020, 3 a.m.

addition to 2), when scale > 1, the get_ca_mask method returns boolean mask,the data range is[0 ,1] ; when scale ==1 uint8 mask is returned and the data range is [0,255]. The returned datatype and data range should be consistent I think. The data range issue gets me "nan" while training my model.

Posted by: BossGao @ May 27, 2020, 3:21 a.m.

Hello BossGao,

1) The elif clause was supposed to provide some extra "smoothing" on the output mask. Thank you for pointing out that the code in this clause will not be executed. You are right. You can ignore this part of the code as it is not essential to the generation of the masks.
2) Indeed, the type of the output should be consistent. So, the return statement should be changed to:
>>> return (mask > 0).astype(np.float32)

Thanks for your input!

Best,
Evan

Posted by: vglsd @ May 27, 2020, 9:02 a.m.
Post in this thread