deepfillv2-pytorch icon indicating copy to clipboard operation
deepfillv2-pytorch copied to clipboard

Why do I train my dataset, the output picture is just masked and not fixed, and 300,000 epochs are trained like this?

Open R1ckLou opened this issue 3 years ago • 1 comments

iter_500 just like this?

R1ckLou avatar Sep 01 '22 07:09 R1ckLou

Hello, I think the binary images cause some difficulties. Firstly, I would extend the output range of the generator so that it can more easily output the -1/1 values. You can multiply the tanh activation in CoarseGenerator and FineGenerator with some value >1 for that.

x = 1.5*self.tanh(x)

Also, I think that the L2 loss is more suitable here. In train.py you can replace the torch.abs with torch.square.

# G training steps:
losses['ae_loss1'] = config.l1_loss_alpha * \
    torch.mean((torch.square(batch_real - x1)))
losses['ae_loss2'] = config.l1_loss_alpha * \
    torch.mean((torch.square(batch_real - x2)))

The LS gan loss can also stabilize training. (in 'configs/train.yaml')

gan_loss: 'ls' # options: 'hinge', 'ls'

You should see some results quickly. I trained on a similar dataset for ~5k iterations with these changes and that's what I got. Hopefully, the results will still improve with more training :) iter_5500

nipponjo avatar Sep 01 '22 22:09 nipponjo