nagadomi / nunif

Misc; latest version of waifu2x; 2D video to stereo 3D video conversion
MIT License
1.58k stars 142 forks source link

warmup learning rate should be float? #127

Closed 3zhang closed 5 months ago

3zhang commented 5 months ago

Current:

    parser.add_argument("--warmup-learning-rate", type=int, default=1e-6,
                        help="learning rate for warmup")
nagadomi commented 5 months ago

You're right. Also warmup option has a problem that only applies the first 1 epoch.

I can't touch my pc now. I will check when I get home .(next week)

3zhang commented 5 months ago

You're right. Also warmup option has a problem that only applies the first 1 epoch.

I can't touch my pc now. I will check when I get home .(next week)

I read your code of Waifu2xDataset. For the __getitem__, at the end there's a line TF.pad(y, [-self.model_offset] * 4). Could you explain a little bit? What is model_offset?

nagadomi commented 5 months ago

What is model_offset?

model_offset is the unpad size of the model output.

Historically, waifu2x models do not use zero padding for conv2d. This is because of the problem of visible seams in tiled rendering. ( releated to https://github.com/nagadomi/waifu2x/issues/238 , The quoted comment was written by me. )

So the output size of the model will be smaller than 2x the input. For example, UpConv7.i2i_scale = 2, UpConv7.i2i_offset = 14 https://github.com/nagadomi/nunif/blob/299257628b71af1053b7e7f03953841c5d103024/waifu2x/models/upconv_7.py#L7-L11

input x = 256x256 https://github.com/nagadomi/nunif/blob/299257628b71af1053b7e7f03953841c5d103024/waifu2x/models/upconv_7.py#L41-L51

torch.Size([1, 3, 484, 484])

output size is 484x484.

output_size = input_size * scale - offset * 2 ( 484 = 256 * 2 - 14 * 2)

nagadomi commented 5 months ago

Fixed https://github.com/nagadomi/nunif/commit/5b30b03ab6557c64d85d4fdff07d2f9de08717c3

Also warmup option has a problem that only applies the first 1 epoch.

This problem has not yet fixed.