Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fruit_nerf/fruit_nerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def get_image_metrics_and_images(
self, outputs: Dict[str, torch.Tensor], batch: Dict[str, torch.Tensor]
) -> Tuple[Dict[str, float], Dict[str, torch.Tensor]]:
image = batch["image"].to(self.device)
rgb = outputs["rgb"]
rgb = outputs["rgb"].to(self.device)
rgb = torch.clamp(rgb, min=0, max=1)
acc = colormaps.apply_colormap(outputs["accumulation"])
depth = colormaps.apply_depth_colormap(
Expand Down Expand Up @@ -452,7 +452,7 @@ def get_image_metrics_and_images(
from torchmetrics.classification import BinaryJaccardIndex
metric = BinaryJaccardIndex().to(self.device)
semantic_labels = torch.nn.functional.softmax(outputs["semantics"])
iou = metric(semantic_labels[..., 0], batch["fruit_mask"][..., 0])
iou = metric(semantic_labels[..., 0].to(self.device), batch["fruit_mask"][..., 0])
metrics_dict["iou"] = float(iou)

return metrics_dict, images_dict
Expand Down