ayanc / fdscs

45 stars 8 forks source link

Disparity "pfm" as "unint16"? #7

Closed fshamsafar closed 4 years ago

fshamsafar commented 4 years ago

Hi,

I tried to train the model from scratch with exactly the same specifications as in GitHub. However, when it gets to the 350K iteration the output model (model_350000.npz) gives different results than the one already available in GitHub repo.

I have changed the SceneFlow disparities from pfm to png with uint16 data type. Can it be the reason why I am not getting a similar model? Did you use the disparities as uint8 data type?

Thanks.

ayanc commented 4 years ago

We stored the png files as uint16, but scaled up the PFM disparities by a factor of 256.0 (so as to use the full uint16 range). Did you do that ? You can look at the way we convert and read in GT disparity values in pdata.py.

fshamsafar commented 4 years ago

We stored the png files as uint16, but scaled up the PFM disparities by a factor of 256.0 (so as to use the full uint16 range). Did you do that ? You can look at the way we convert and read in GT disparity values in pdata.py.

Thanks. Actually I was not scaling before saving. Now, I am using this code to change to save the pfm as png uint16.

pfm = readPFM([tlist[i] % lggrp][0])[0]
pfm = pfm * 256.0            
pfm32 = pfm.astype(np.uint16)
pfm32_buffer = pfm32.tobytes()
img = Image.new("I", pfm32.T.shape)
img.frombytes(pfm32_buffer, 'raw', "I;16")

But with this scaling, the maximum value would exceed 65535, and when it is changed to np.uint16, it losses some information. Doesn't that make a problem?

ayanc commented 4 years ago

Yes. But since the goal is to mainly pre-train for KITTI (where the max disparity is 255), this should be fine.