shubham-goel/ucmr

Where do the results go?

nightfarrow opened this issue · 4 comments

I have a very basic question...
Where do the results go? When I run

python -m src.demo \
    --pred_pose \
    --pretrained_network_path=cachedir/snapshots/cam/e400_cub_train_cam4/pred_net_600.pth \
    --shape_path=cachedir/template_shape/bird_template.npy\
    --img_path demo_data/birdie1.png

...this is the resulting console log:

root@dc751569af5a:/workspace# python -m src.demo \
>     --pred_pose \
>     --pretrained_network_path=cachedir/snapshots/cam/e400_cub_train_cam4/pred_net_600.pth \
>     --shape_path=cachedir/template_shape/bird_template.npy\
>     --img_path demo_data/birdie1.png
Display not found. Using Agg backend for matplotlib
Loading shape from cachedir/template_shape/bird_template.npy
verts:      mean-centering by [ 0.          0.5093799  -0.01742622]
verts_uv:   provided
faces_uv:   from verts_uv
Setting up model..
Mesh contains 237x2=474 symmetric vertices, 81 indep vertices
textureImg:     128x256
/opt/conda/lib/python3.6/site-packages/torch/nn/functional.py:2539: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode))
/opt/conda/lib/python3.6/site-packages/torch/nn/functional.py:1386: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
  warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
done

and then when I look in ucmr/results/cub/render/ there is nothing there. Did the command fail for me or am I not understanding where the results are meant to go?

The demo script is supposed to show a matplotlib window containing visualizations of the predicted shape/texture/camera. So it doesn't work in the absence of a display (eg. when you ssh into a remote server). Please use ssh -X, run the demo on your local machine, or use plt.savefig in the demo script to save the visualization to disk.

Thanks! That successfully saved an image of the results.
Is there a similar code line that can save a 3D file of the pred mesh to the computer, like in *.stl or *.obj format?

What's happening is that, as you predicted, MatPlotLib isn't working to display the results in a window, on my Ubuntu environment. I'm using the Dockerfile so that may be why- I see Google results of people having issues with matplotlib displays in Docker containers. So, I'm trying to circumvent the need for matplotlib display by trying to just get the 3D file directly saved to my computer instead.

Sure, you can use this function to save the mesh (without texture) to file. To additionally save the predicted texture image, you could save the it as a PNG separately.

submitted follow-up question as new issue for organization purposes