researchmm / AOT-GAN-for-Inpainting

[TVCG'2023] AOT-GAN for High-Resolution Image Inpainting (codebase for image inpainting)
https://arxiv.org/abs/2104.01431
Apache License 2.0
425 stars 68 forks source link

Do the traning masks need to be hand-crafted generated? #4

Closed lifengcs closed 3 years ago

lifengcs commented 3 years ago

Hi Yanhong, I have read your paper on arxive. An excellent work. I noticed that the traning masks are paired with input images mentioned in your manuscript. But in the source code option.py, I saw the dir_mask path pre-definition, which is also seen in the readme file. Do I need to generate the masks first for training?

praeclarumjj3 commented 3 years ago

In the paper, the authors mention that they use the masks from the Image Inpainting for Irregular Holes Using Partial Convolutions paper. So you can download those masks from here. @lifengshiwo

lifengcs commented 3 years ago

In the paper, the authors mention that they use the masks from the Image Inpainting for Irregular Holes Using Partial Convolutions paper. So you can download those masks from here. @lifengshiwo

Thanks! But in Sec. 3.4 Para. 2, I saw ''For the model training, eight images are randomly sampled and corresponding masks are randomly created as pairs in each mini-batch". So the question arises......

praeclarumjj3 commented 3 years ago

In the paper, the authors mention that they use the masks from the Image Inpainting for Irregular Holes Using Partial Convolutions paper. So you can download those masks from here. @lifengshiwo

Thanks! But in Sec. 3.4 Para. 2, I saw ''For the model training, eight images are randomly sampled and corresponding masks are randomly created as pairs in each mini-batch". So the question arises......

Maybe that refers to the else condition in the code block below:

if self.mask_type == 'pconv':
        index = np.random.randint(0, len(self.mask_path))
        mask = Image.open(self.mask_path[index])
        mask = mask.convert('L')
else:
        mask = np.zeros((self.h, self.w)).astype(np.uint8)
        mask[self.h//4:self.h//4*3, self.w//4:self.w//4*3] = 1
        mask = Image.fromarray(m).convert('L')

It could also be referring to the random walk technique there.

However, the following sentences at the start of Section 4.1 should provide enough motivation to use the masks provided by NVIDIA:

We use free-form masks provided by Liu et al. [44] for both training and testing following common
 settings [7, 22, 44, 8]. Because the free-form masks are more challenging, closer to real-world
 applications, and also widely adopted by a majority of inpainting approaches. 
lifengcs commented 3 years ago

In the paper, the authors mention that they use the masks from the Image Inpainting for Irregular Holes Using Partial Convolutions paper. So you can download those masks from here. @lifengshiwo

Thanks! But in Sec. 3.4 Para. 2, I saw ''For the model training, eight images are randomly sampled and corresponding masks are randomly created as pairs in each mini-batch". So the question arises......

Maybe that refers to the else condition in the code block below:

if self.mask_type == 'pconv':
        index = np.random.randint(0, len(self.mask_path))
        mask = Image.open(self.mask_path[index])
        mask = mask.convert('L')
else:
        mask = np.zeros((self.h, self.w)).astype(np.uint8)
        mask[self.h//4:self.h//4*3, self.w//4:self.w//4*3] = 1
        mask = Image.fromarray(m).convert('L')

It could also be referring to the random walk technique there.

However, the following sentences at the start of Section 4.1 should provide enough motivation to use the masks provided by NVIDIA:

We use free-form masks provided by Liu et al. [44] for both training and testing following common
 settings [7, 22, 44, 8]. Because the free-form masks are more challenging, closer to real-world
 applications, and also widely adopted by a majority of inpainting approaches. 

Thanks for your reminder. I get it. Excellent work!