Skip to content

Commit a7256e4

Browse files
shapovalovfacebook-github-bot
authored andcommitted
Consider the first frame as target ignoring subset labels in evaluator
Summary: Aligning the logic with the official CO3Dv2 evaluation: https://github.com/facebookresearch/co3d/blob/92283c43688c3be685eea35f2eaf3ce58b5bbf0b/co3d/dataset/utils.py#L7 This will make the evaluator work with the datasets that do not define known/unseen subsets. Reviewed By: bottler Differential Revision: D42803136 fbshipit-source-id: cfac389eab010c32d2e33b40fc7f6ed845c327ef
1 parent 9540c29 commit a7256e4

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pytorch3d/implicitron/evaluation/evaluate_new_view_synthesis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import torch
1616
import torch.nn.functional as F
1717
from pytorch3d.implicitron.dataset.dataset_base import FrameData
18-
from pytorch3d.implicitron.dataset.utils import is_known_frame, is_train_frame
18+
from pytorch3d.implicitron.dataset.utils import is_train_frame
1919
from pytorch3d.implicitron.models.base_model import ImplicitronRender
2020
from pytorch3d.implicitron.tools import vis_utils
2121
from pytorch3d.implicitron.tools.image_utils import mask_background

pytorch3d/implicitron/evaluation/evaluator.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,11 @@ def _dump_to_json(
149149

150150
def _get_eval_frame_data(frame_data: Any) -> Any:
151151
"""
152-
Masks the unknown image data to make sure we cannot use it at model evaluation time.
152+
Masks the target image data to make sure we cannot use it at model evaluation
153+
time. Assumes the first batch element is target, the rest are source.
153154
"""
154155
frame_data_for_eval = copy.deepcopy(frame_data)
155-
is_known = ds_utils.is_known_frame(frame_data.frame_type).type_as(
156-
frame_data.image_rgb
157-
)[:, None, None, None]
158156
for k in ("image_rgb", "depth_map", "fg_probability", "mask_crop"):
159157
value = getattr(frame_data_for_eval, k)
160-
value_masked = value.clone() * is_known if value is not None else None
161-
setattr(frame_data_for_eval, k, value_masked)
158+
value[0].zero_()
162159
return frame_data_for_eval

0 commit comments

Comments
 (0)