mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
Loosening the checks in eval script for CO3Dv2 style eval
Summary: V2 dataset does not have the concept of known/unseen frames. Test-time conditining is done with train-set frames, which violates the previous check. Also fixing a corner case in VideoWriter. Reviewed By: bottler Differential Revision: D42706976 fbshipit-source-id: d43be3dd3060d18cb9f46d5dcf6252d9f084110f
This commit is contained in:
parent
9dc28f5dd5
commit
54eb76d48c
@ -219,17 +219,10 @@ def eval_batch(
|
||||
frame_type = [frame_type]
|
||||
|
||||
is_train = is_train_frame(frame_type)
|
||||
if not (is_train[0] == is_train).all():
|
||||
raise ValueError("All frames in the eval batch have to be either train/test.")
|
||||
|
||||
# pyre-fixme[16]: `Optional` has no attribute `device`.
|
||||
is_known = is_known_frame(frame_type, device=frame_data.image_rgb.device)
|
||||
|
||||
if not ((is_known[1:] == 1).all() and (is_known[0] == 0).all()):
|
||||
if len(is_train) > 1 and (is_train[1] != is_train[1:]).any():
|
||||
raise ValueError(
|
||||
"For evaluation the first element of the batch has to be"
|
||||
+ " a target view while the rest should be source views."
|
||||
) # TODO: do we need to enforce this?
|
||||
"All (conditioning) frames in the eval batch have to be either train/test."
|
||||
)
|
||||
|
||||
for k in [
|
||||
"depth_map",
|
||||
@ -362,7 +355,7 @@ def eval_batch(
|
||||
|
||||
results["meta"] = {
|
||||
# store the size of the batch (corresponds to n_src_views+1)
|
||||
"batch_size": int(is_known.numel()),
|
||||
"batch_size": len(frame_type),
|
||||
# store the type of the target frame
|
||||
# pyre-fixme[16]: `None` has no attribute `__getitem__`.
|
||||
"frame_type": str(frame_data.frame_type[0]),
|
||||
|
@ -124,8 +124,11 @@ class VideoWriter:
|
||||
quiet: If `True`, suppresses logging messages.
|
||||
|
||||
Returns:
|
||||
video_path: The path to the generated video.
|
||||
video_path: The path to the generated video if any frames were added.
|
||||
Otherwise returns an empty string.
|
||||
"""
|
||||
if self.frame_num == 0:
|
||||
return ""
|
||||
|
||||
regexp = os.path.join(self.cache_dir, self.regexp)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user