From fc7a4cacc36ecf2b8feb996bdfb1203dee5d836b Mon Sep 17 00:00:00 2001 From: Amitav Baruah Date: Thu, 19 Nov 2020 13:51:17 -0800 Subject: [PATCH] Fix plotly pointcloud visualization feature bug Summary: If a pointcloud had less than pointcloud_max_points, the colors would not render. This diff fixes that. Reviewed By: bottler Differential Revision: D25099044 fbshipit-source-id: 47c3ddcdb4e06284b0a7966ffca1b973f394921f --- pytorch3d/vis/plotly_vis.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytorch3d/vis/plotly_vis.py b/pytorch3d/vis/plotly_vis.py index a0c09a1c..c97ddce7 100644 --- a/pytorch3d/vis/plotly_vis.py +++ b/pytorch3d/vis/plotly_vis.py @@ -587,7 +587,9 @@ def _add_pointcloud_trace( color = None if features is not None: - features = features[indices] + if indices is not None: + # Only select features if we selected vertices above + features = features[indices] if features.shape[1] == 4: # rgba template = "rgb(%d, %d, %d, %f)" rgb = (features[:, :3].clamp(0.0, 1.0) * 255).int()