nianticlabs / stereo-from-mono

[ECCV 2020] Learning stereo from single images using monocular depth estimation networks
Other
398 stars 54 forks source link

Saving the Right sided images #7

Closed Smartmayukh closed 3 years ago

Smartmayukh commented 3 years ago

I am unable to save the synthesized images , for example, using this code, I cannot save the right sided image from the left sided image. I have tried using

_savepath = os.path.join(self.opt.load_path, data_type, 'Right_Image') os.makedirs(_savepath, exist_ok=True) io.imsave(os.path.join(_savepath, '{}.png'.format(str(idx).zfill(3))), right_image)

in the warp_dataset.py after line number 336 but it is not working . I think some coding changes should be made in the Inference.py . But I cannot figure it out

JamieWatson683 commented 3 years ago

Hi - thanks for your interest in the repo!

That looks like a sensible addition to warp_dataset.py to save our right images - however warp_dataset.py isn't called by inference.py.

You could instead run training, since this will actually use the warp_dataset.py code to generate left/right stereo pairs - however this is fairly wasteful as you will be unnecessarily training the network. You probably want to comment out or delete lines 160 to 193 of trainer.py, and add a pass or continue statement to line 159.

Note that warp_dataset.py has a lot of randomness built in (i.e. for every input image and estimated depth, it can generate many random right images) - you can change this amending the max_disparity_range parameter of the process_disparity function to be something like (75, 76).

Let me know if this still doesn't work, and I can take a closer look.