myungsub / CAIN

Source code for AAAI 2020 paper "Channel Attention Is All You Need for Video Frame Interpolation"
MIT License
326 stars 43 forks source link

Question about InOutPaddings #9

Closed GreyZzzzzzXh closed 3 years ago

GreyZzzzzzXh commented 3 years ago

Hi, thanks for your nice work!

I have a question about the def InOutPaddings(x), why should the width and height be padded to a multiple of 128? I change this number to 32, and the PSNR on Vimeo90k can be improved to 34.76dB (since 256 and 448 are already multiples of 32, no padding is actually done).

def InOutPaddings(x):
    w, h = x.size(3), x.size(2)
    padding_width, padding_height = 0, 0
    if w != ((w >> 5) << 5):
        padding_width = (((w >> 5) + 1) << 5) - w
    if h != ((h >> 5) << 5):
        padding_height = (((h >> 5) + 1) << 5) - h
    paddingInput = nn.ReflectionPad2d(padding=[padding_width // 2, padding_width - padding_width // 2,
                                               padding_height // 2, padding_height - padding_height // 2])
    paddingOutput = nn.ReflectionPad2d(padding=[0 - padding_width // 2, padding_width // 2 - padding_width,
                                                0 - padding_height // 2, padding_height // 2 - padding_height])
    return paddingInput, paddingOutput
myungsub commented 3 years ago

Hi, @GreyZzzzzzXh , thanks for your interest in our work.

I think you are right.. it doesn't need to be padded to a multiple of 128. I've used the padding part from the SepConv repository and I guess I have just used the same default settings.

Using the model without padding (for Vimeo-Triplet) should be faster and better. Thanks for letting me know! (Also, for the other images that require padding, I've seen repetition padding showing better performance, but not perfectly validated; just to let you know) :)

GreyZzzzzzXh commented 3 years ago

Thanks for your reply! :)