mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
removed stats tracker; consolidate writers into local writer
This commit is contained in:
1 parent
4dee65b480
commit
59eeaca93b
9 files changed
+248
-316
No files matched your search
@@ -212,4 +212,4 @@ class NerfWGraph(NeRFGraph):
|
||||
row2 = torch.cat([depth_fine, depth_fine_static, depth_coarse], dim=-2)
|
||||
combined_image = torch.cat([row0, row1, row2], dim=-3)
|
||||
|
||||
writer.write_image(name="image_idx_{image_idx}-nerfw", image=combined_image, step=step, group="img")
|
||||
writer.put_scalar(name="image_idx_{image_idx}-nerfw", image=combined_image, step=step, group="img")
|
||||
@@ -155,4 +155,4 @@ class SemanticNerfGraph(NeRFGraph):
|
||||
self.stuff_classes
|
||||
)
|
||||
semantic_labels_image = visualization.apply_colormap(semantic_labels[..., None])
|
||||
writer.write_image(name="image_idx_{image_idx}", image=semantic_labels_image, step=step, group="semantics")
|
||||
writer.put_image(name="image_idx_{image_idx}", image=semantic_labels_image, step=step, group="semantics")
|
||||
@@ -23,7 +23,7 @@ from mattport.nerf.sampler import PDFSampler, UniformSampler
|
||||
from mattport.structures import colors
|
||||
from mattport.structures.rays import PointSamples, RayBundle
|
||||
from mattport.nerf.colliders import NearFarCollider
|
||||
from mattport.utils import stats_tracker, visualization, writer
|
||||
from mattport.utils import visualization, writer
|
||||
from mattport.utils.misc import is_not_none
|
||||
|
||||
|
||||
@@ -231,9 +231,9 @@ class NeRFGraph(Graph):
|
||||
combined_acc = torch.cat([acc_coarse, acc_fine], dim=1)
|
||||
combined_depth = torch.cat([depth_coarse, depth_fine], dim=1)
|
||||
|
||||
writer.write_image(name=f"image_idx_{image_idx}", image=combined_rgb, step=step, group="img")
|
||||
writer.write_image(name=f"image_idx_{image_idx}", image=combined_acc, step=step, group="accumulation")
|
||||
writer.write_image(name=f"image_idx_{image_idx}", image=combined_depth, step=step, group="depth")
|
||||
writer.put_image(name=f"image_idx_{image_idx}", image=combined_rgb, step=step, group="img")
|
||||
writer.put_image(name=f"image_idx_{image_idx}", image=combined_acc, step=step, group="accumulation")
|
||||
writer.put_image(name=f"image_idx_{image_idx}", image=combined_depth, step=step, group="depth")
|
||||
|
||||
# Switch images from [H, W, C] to [1, C, H, W] for metrics computations
|
||||
image = torch.moveaxis(image, -1, 0)[None, ...]
|
||||
@@ -245,13 +245,11 @@ class NeRFGraph(Graph):
|
||||
fine_ssim = self.ssim(image, rgb_fine)
|
||||
fine_lpips = self.lpips(image, rgb_fine)
|
||||
|
||||
writer.write_scalar(name=f"val_{image_idx}-coarse", scalar=float(coarse_psnr), step=step, group="psnr")
|
||||
writer.write_scalar(name=f"val_{image_idx}-fine", scalar=float(fine_psnr), step=step, group="psnr")
|
||||
writer.write_scalar(name=f"val_{image_idx}", scalar=float(fine_ssim), step=step, group="ssim")
|
||||
writer.write_scalar(name=f"val_{image_idx}", scalar=float(fine_lpips), step=step, group="lpips")
|
||||
writer.put_scalar(name=f"val_{image_idx}-coarse", scalar=float(coarse_psnr), step=step, group="psnr")
|
||||
writer.put_scalar(name=f"val_{image_idx}-fine", scalar=float(fine_psnr), step=step, group="psnr")
|
||||
writer.put_scalar(name=f"val_{image_idx}", scalar=float(fine_ssim), step=step, group="ssim")
|
||||
writer.put_scalar(name=f"val_{image_idx}", scalar=float(fine_lpips), step=step, group="lpips")
|
||||
|
||||
stats_tracker.update_stats(
|
||||
{"name": stats_tracker.Stats.CURR_TEST_PSNR, "value": float(fine_psnr), "step": step}
|
||||
)
|
||||
writer.put_scalar(name="Test PSNR", scalar=float(fine_psnr), step=step)
|
||||
|
||||
return fine_psnr.item()
|
||||
Reference in new issue
Block a user