Research Article

Research into an Image Inpainting Algorithm via Multilevel Attention Progression Mechanism

Algorithm 1

Image inpainting algorithm via multilevel attention progression mechanism.
Input: Damaged Image , Random Mask .
Step 1: Batch sample images from the training dataset, generate random mask for each image in each batch, and obtain damaged images;
Step 2: if stage = = 1
Step 3: Training Generator = True; Training Discriminator = False
Step 4: The epochs is 30, and every 5000 iterations, the generator network is updated under the loss function of feature matching loss and reconstruction loss, and the repairing image is obtained
Step 5: elseif stage = = 2
Step 6: Training Generator = False; Training Discriminator = True
Step 7: The epochs is 5, and every 2000 iterations, the discriminator network is updated under the loss function of adversarial loss
Step 8: elseif stage = = 3
Step 9: Training Generator = True; Training Discriminator = True
Step 10: The epochs is 5, and every 2000 iterations, the generator network and discriminator network are updated under the loss function of adversarial loss, feature matching loss and reconstruction loss.