ClementPinard / SfmLearner-Pytorch

Pytorch version of SfmLearner from Tinghui Zhou et al.
MIT License
1.01k stars 224 forks source link

How to visualize the warped image (ref_img_wapred) #146

Closed huhaoyue closed 1 year ago

huhaoyue commented 1 year ago

I want to visualize the reconstructed images by warping, but I can't write related scripts. I really hope can get your help. I saw the same issue in the previous problem, but he provided the test_warp.py is no relevant content after I download it.

ClementPinard commented 1 year ago

Hi, the warped images are actually part of the output from photometric reconstruction loss https://github.com/ClementPinard/SfmLearner-Pytorch/blob/9640fbb2157be78e3eb195287ed76ac797282113/loss_functions.py#L9

And as you can see during training, it is transformed into tensorboard within this line of code : https://github.com/ClementPinard/SfmLearner-Pytorch/blob/master/train.py#L311

As such, to visualize it you can simply run the training with the option --log-output and --training-output-freq set to a certain number N, to get vizualisations on tensorboard, it will output a new image with target, warped and diff every N batch (corresponding to the first image of the batch)

Or you can run photometric reconstruction loss function and then try to modify the function log output tensorboard to get the image and save it in jpg instead of tensorboard format.

https://github.com/ClementPinard/SfmLearner-Pytorch/blob/9640fbb2157be78e3eb195287ed76ac797282113/utils.py#L69