Updating metrics dict code and logic for all the graphs (#198)

* illustrating logic of metrics dict with vanilla nerf

* updated all graph impls

* clean up.

* cleanup.

* format.

Co-authored-by: Alexander Kristoffersen <akristoffersen@berkeley.edu>
This commit is contained in:
Ethan WeberandAlexander Kristoffersen authored and GitHub committed 2022-07-26 21:02:45 -07:00
1 parent 0777883fb6
commit 934bd4bd72
8 files changed
+43 -23

No files matched your search

+3 -2
View File
@@ -36,7 +36,7 @@ from nerfactory.fields.modules.mlp import MLP
from nerfactory.fields.nerf_field import NeRFField
from nerfactory.graphs.vanilla_nerf import NeRFGraph
from nerfactory.renderers.renderers import SemanticRenderer
from nerfactory.utils import writer
from nerfactory.utils import misc, writer
class SemanticNerfField(Field):
@@ -167,7 +167,7 @@ class SemanticNerfGraph(NeRFGraph):
}
return outputs
def get_loss_dict(self, outputs, batch):
def get_loss_dict(self, outputs, batch, metrics_dict, loss_coefficients):
image = batch["image"]
rgb_loss_coarse = self.rgb_loss(image, outputs["rgb_coarse"])
rgb_loss_fine = self.rgb_loss(image, outputs["rgb_fine"])
@@ -179,6 +179,7 @@ class SemanticNerfGraph(NeRFGraph):
"rgb_loss_fine": rgb_loss_fine,
"semantic_loss_fine": semantic_loss_fine,
}
loss_dict = misc.scale_dict(loss_dict, loss_coefficients)
return loss_dict
def log_test_image_outputs(self, image_idx, step, batch, outputs):