diff --git a/projects/implicitron_trainer/tests/experiment.yaml b/projects/implicitron_trainer/tests/experiment.yaml index a97246b7..6b5280da 100644 --- a/projects/implicitron_trainer/tests/experiment.yaml +++ b/projects/implicitron_trainer/tests/experiment.yaml @@ -64,17 +64,11 @@ data_source_ImplicitronDataSource_args: dataset_class_type: JsonIndexDataset path_manager_factory_class_type: PathManagerFactory dataset_JsonIndexDataset_args: - path_manager: null - frame_annotations_file: '' - sequence_annotations_file: '' - subset_lists_file: '' - subsets: null limit_to: 0 limit_sequences_to: 0 pick_sequence: [] exclude_sequence: [] limit_category_to: [] - dataset_root: '' load_images: true load_depths: true load_depth_masks: true @@ -92,7 +86,6 @@ data_source_ImplicitronDataSource_args: n_frames_per_sequence: -1 seed: 0 sort_frames: false - eval_batches: null path_manager_factory_PathManagerFactory_args: silence_logs: true dataset_map_provider_LlffDatasetMapProvider_args: diff --git a/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py b/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py index 882af842..71a936b6 100644 --- a/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py +++ b/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py @@ -9,7 +9,7 @@ import json import logging import os import warnings -from typing import Dict, List, Optional, Type +from typing import Dict, List, Optional, Tuple, Type from omegaconf import DictConfig, open_dict from pytorch3d.implicitron.dataset.dataset_map_provider import ( @@ -30,6 +30,19 @@ from pytorch3d.renderer.cameras import CamerasBase _CO3DV2_DATASET_ROOT: str = os.getenv("CO3DV2_DATASET_ROOT", "") +# _NEED_CONTROL is a list of those elements of JsonIndexDataset which +# are not directly specified for it in the config but come from the +# DatasetMapProvider. +_NEED_CONTROL: Tuple[str, ...] = ( + "dataset_root", + "eval_batches", + "eval_batch_index", + "path_manager", + "subsets", + "frame_annotations_file", + "sequence_annotations_file", + "subset_lists_file", +) logger = logging.getLogger(__name__) @@ -289,7 +302,8 @@ class JsonIndexDatasetMapProviderV2(DatasetMapProviderBase): # pyre-ignore [13] not expose certain fields of each dataset class. """ with open_dict(args): - del args["eval_batch_index"] + for key in _NEED_CONTROL: + del args[key] def create_dataset(self): # The dataset object is created inside `self.get_dataset_map` diff --git a/tests/implicitron/data/data_source.yaml b/tests/implicitron/data/data_source.yaml index 0c212c96..9528fdfa 100644 --- a/tests/implicitron/data/data_source.yaml +++ b/tests/implicitron/data/data_source.yaml @@ -52,17 +52,11 @@ dataset_map_provider_JsonIndexDatasetMapProviderV2_args: dataset_class_type: JsonIndexDataset path_manager_factory_class_type: PathManagerFactory dataset_JsonIndexDataset_args: - path_manager: null - frame_annotations_file: '' - sequence_annotations_file: '' - subset_lists_file: '' - subsets: null limit_to: 0 limit_sequences_to: 0 pick_sequence: [] exclude_sequence: [] limit_category_to: [] - dataset_root: '' load_images: true load_depths: true load_depth_masks: true @@ -80,7 +74,6 @@ dataset_map_provider_JsonIndexDatasetMapProviderV2_args: n_frames_per_sequence: -1 seed: 0 sort_frames: false - eval_batches: null path_manager_factory_PathManagerFactory_args: silence_logs: true dataset_map_provider_LlffDatasetMapProvider_args: