NVlabs / PWC-Net

PWC-Net: CNNs for Optical Flow Using Pyramid, Warping, and Cost Volume, CVPR 2018 (Oral)
Other
1.63k stars 357 forks source link

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

Open poppinjie opened 3 years ago

poppinjie commented 3 years ago

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?

kajalsingh25111997 commented 3 years ago

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.

poppinjie commented 3 years ago

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

poppinjie commented 3 years ago

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

hmorimitsu commented 3 years ago

These values are obtained after combining two factors:

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.

poppinjie commented 3 years ago

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)

hmorimitsu commented 3 years ago

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.