mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 06:18:44 +08:00
Eng/vis multi outputs (#131)
* added dynamic setting options based on graph outputs * added functionality to view different types of outputs * fixed first value set to nothing * moved try except in smaller scope * thinking I fixed the weird every so often python stops because of exception error * fixed many dropdown issue; fixed default value issue
This commit is contained in:
1 parent
ff4f1bb421
commit
069cf2c40f
4 files changed
+115
-66
No files matched your search
@@ -136,6 +136,14 @@ class Graph(AbstractGraph):
|
||||
dict: Outputs of graph. (ie. rendered colors)
|
||||
"""
|
||||
|
||||
def process_outputs_as_images(self, outputs): # pylint:disable=no-self-use
|
||||
"""Process output images into visualizable colored images"""
|
||||
# TODO override this function elsewhere or do something else for processing images
|
||||
for k, v in outputs.items():
|
||||
if v.shape[-1] == 1:
|
||||
v = torch.tile(v, (1, 1, 3))
|
||||
outputs[k] = v
|
||||
|
||||
def forward_after_ray_generator(self, ray_bundle: RayBundle, batch: Union[str, Dict[str, torch.tensor]] = None):
|
||||
"""Run forward starting with a ray bundle."""
|
||||
intersected_ray_bundle = self.collider(ray_bundle)
|
||||
|
||||
@@ -145,6 +145,22 @@ class NGPGraph(Graph):
|
||||
loss_dict = {"rgb_loss": rgb_loss}
|
||||
return loss_dict
|
||||
|
||||
def process_outputs_as_images(self, outputs): # pylint:disable=no-self-use
|
||||
"""Do preprocessing to make images valid"""
|
||||
# TODO: make log_test_image_outputs use this directly
|
||||
# TODO: implement across all the different graph implementations
|
||||
acc = visualization.apply_colormap(outputs["accumulation"])
|
||||
depth = visualization.apply_depth_colormap(
|
||||
outputs["depth"],
|
||||
accumulation=outputs["accumulation"],
|
||||
)
|
||||
combined_acc = torch.cat([acc], dim=1)
|
||||
outputs["accumulation"] = combined_acc
|
||||
combined_depth = torch.cat([depth], dim=1)
|
||||
outputs["depth"] = combined_depth
|
||||
depth = visualization.apply_depth_colormap(outputs["depth_occupancy_grid"])
|
||||
outputs["depth_occupancy_grid"] = combined_depth
|
||||
|
||||
def log_test_image_outputs(self, image_idx, step, batch, outputs):
|
||||
image = batch["image"]
|
||||
rgb = outputs["rgb"]
|
||||
|
||||
Reference in new issue
Block a user