RenYurui / Global-Flow-Local-Attention

The source code for paper "Deep Image Spatial Transformation for Person Image Generation"
https://renyurui.github.io/GFLA-web
Other
568 stars 84 forks source link

[Doubt of flow interpolation] Flow cannot be directly interpolate #67

Closed Jarvisss closed 3 years ago

Jarvisss commented 4 years ago

https://github.com/RenYurui/Global-Flow-Local-Attention/blob/749bf70c834ea717aee7c1975d08aab31d1f0f43/model/networks/external_function.py#L254

For example, assume the flow vector at location (i,j) of spatial size (256,256) is (2,4) . If we downsample the flow to (128,128), the downsampled flow vector at location (i', j'), should be rescaled by 2, which is (1,2),

But with the code attached above, the flow vector would be (2,4), as F.interpolate just bilinear samples from nearby flow values and does not consider spatial change.

RenYurui commented 3 years ago

Hi Jarvisss, The optical flows are Normalized to [-1, 1] before using interpolate. Therefore, we can use interpolation methods such as bilinear sampling to resize the scale of the flow map.