lmb-freiburg / flownet2

FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks
https://lmb.informatik.uni-freiburg.de/Publications/2017/IMKDB17/
Other
1k stars 318 forks source link

problems in convert_imageset_and_disparity.cpp #40

Closed Lvhhhh closed 7 years ago

Lvhhhh commented 7 years ago

why the value*32.768/1024?

value=cv_disp.at(y, x); // = flo_data[j]*32.768/1024;

nikolausmayer commented 7 years ago

Hi,

this code was originally used to create our own database format. This format did not save floating point values f, but instead 16bit integer values (short)(f*32.0) which allowed for much better compression.

The current code creates another database format where we do not use this trick. The fragment value*32.768/1024 is just value*32.0 (the dot . in 32.768 is a decimal mark, i.e. the number is 32768 (in Germany we use the dot as decimal mark, not the comma)). It's just a comment and shows where we changed the code.

Lvhhhh commented 7 years ago

thank u for your answer! i find the values are smaller about 32 times than values before these code. but the operation"*32.768/1024" is an annotation. how do these value shrink almost 32 times? just because the format of these values transform from 16bit integer values to float point?

nikolausmayer commented 7 years ago

I'm not sure what you mean. That code line does not change the values, it only casts them to short.

Lvhhhh commented 7 years ago

for example. the float ' a =1.0 ' becomes the short 'a = 32 ' when it cast to short . is it right?

Lvhhhh commented 7 years ago

because i found in "convert_imageset_and_disparity.cpp" l158 " \ value=cv_disp.at(y, x); // = flo_data[j]*32.768/1024; " for example, the value may be "32" . and then i found this value may become "1" when i debug the caffe from " train.prototxt " or write-pfm the "blob2". i dont know the reason where the value change from "32" to "1". so i may not say clearly~~

nikolausmayer commented 7 years ago

Ok, I finally got it. It's a bug, but it is not directly related to a "float -> short" conversion.

If you use the CustomData layer, line 158 in convert_imageset_and_disparity.cpp in its current form clashes with line 107 in src/caffe/layers/custom_data_layer.cpp which divides by 32.

Either change the CustomData layer to not do that, or change the converter code to this: value=cv_disp.at(y, x)*32.0; We actually fixed this in the flow conversion script, but forgot to do so in the disparity converter.

Lvhhhh commented 7 years ago

thank you!!!! i finally know !!!!!!

wzrf commented 6 years ago

@Lvhhhh Hi, do you solve the problem? Is the result correct after add the value=cv_disp.at(y, x)*32 ?