PWC-Net icon indicating copy to clipboard operation
PWC-Net copied to clipboard

How to understand the values 0.625, 1.25, 2.5, 5.0 in the PWCNet.py

Open poppinjie opened this issue 3 years ago • 6 comments

I find that these values are multiplied by the upsampled optical flow.But I am not clear what's the meanning of these operations.Why the upsampled optical flow need to multiply corresponding float value?

poppinjie avatar Mar 26 '21 12:03 poppinjie

I find that these values are multiplied by the upsampled optical flow.But I am not clear what's the meanning of these operations.Why the upsampled optical flow need to multiply corresponding float value?

I have the same question.Did you find its answer.

kajalsingh25111997 avatar May 12 '21 07:05 kajalsingh25111997

I'm sorry! I don't know yet. Maybe we can explore it together.

poppinjie avatar May 12 '21 07:05 poppinjie

I'm sorry! I don't know yet. Maybe we can explore it together.

poppinjie avatar May 12 '21 07:05 poppinjie

These values are obtained after combining two factors:

  • The flow value predicted by PWCNet is 20 times smaller than the original value.
  • The stride of the layer where the flow is being used (how many times smaller the layer is, compared to the output).

So, the first value (0.625) is applied on a layer whose stride is 32. Since the flow needs to be increased by 20 times, to adapt the flow value to that layer, we need to multiply it by 20/32=0.625. The next layer has stride 16, so we use 20/16=1.25, and so on.

hmorimitsu avatar Jul 10 '21 12:07 hmorimitsu

So What's the stride in your reply?Does it mean the global stride of the network?------------------ 原始邮件 ------------------ @.> 发送时间: 2021年7月10日(星期六) 晚上8:39 @.>; @.@.>; 主题: Re: [NVlabs/PWC-Net] How to understand the values 0.625, 1.25, 2.5, 5.0 in the PWCNet.py (#119)

poppinjie avatar Jul 14 '21 22:07 poppinjie

The stride of a layer is a scalar value which represents how many times smaller that layer is compared to the input image. For example, if the input image size was 512x512, and the current layer size is 64x64, then this layer has stride 8.

Looking at the code here https://github.com/NVlabs/PWC-Net/blob/master/PyTorch/models/PWCNet.py, we see that self.conv1x layers will have layer stride 2, self.conv2x will have layer stride 4, and so on. Following this logic, self.conv5x will have layer stride 32, so the flow value in this layer is multiplied by 0.625 as explained in my previous answer. In the next stage, we will be handling the self.conv4x features, which have layer stride 16, so we multiply the flow by 1.25.

hmorimitsu avatar Jul 15 '21 09:07 hmorimitsu