anchen1011 / toflow

TOFlow: Video Enhancement with Task-Oriented Flow

Home Page:http://toflow.csail.mit.edu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resolution mismatch for interp

stubborn-dwarf opened this issue · comments

thank you for sharing your code as well as your dataset.

i would like to evaluate your interp implementation. however, given an input of size 960x540 the output will be of size 960x528 instead. my intermediate solution is to rescale the output using bicubic interpolation such that it matches the input again. what is your suggestion in this regard, such that the evaluation is being done fairly? thanks!

We have tested resizing output but it didn't really produce a result in the quality we expect.

We would suggest white padding the input and crop it later.

For example, in your case, adding 960x8 white margin at the bottom of the input, run our algorithm (the output will be 960x528), and cut the 8pix margin at the bottom of the output.

thank you for your response, i will be using the following then. not the most beautiful code i have ever written but it pads before consulting your model and crops afterwards, just as you suggested.

sample, h, w = get_file({ strFirst, strSecond }, 'tri', nil, nil)
oh = 16 * math.floor(h / 16)
ow = 16 * math.floor(w / 16)
if oh < h then oh = oh + 16 end
if ow < w then ow = ow + 16 end
sample = ut.nn.cudanize(sample)
sample[1] = nn.Padding(4, ow - w, 4, 1.0):cuda():forward(sample[1])
sample[1] = nn.Padding(3, oh - h, 4, 1.0):cuda():forward(sample[1])
sample[2] = nn.Padding(4, ow - w, 4, 1.0):cuda():forward(sample[2])
sample[2] = nn.Padding(3, oh - h, 4, 1.0):cuda():forward(sample[2])
output = ut.nn.memFriendlyForward(model, sample):float()
output = nn.Narrow(4, 1, w):cuda():forward(output)
output = nn.Narrow(3, 1, h):cuda():forward(output)
output = ut.tf.defaultDetransform(output:squeeze())