Add forbidden fields to map_provider_v2

Summary:
Added _NEED_CONTROL
 to JsonIndexDatasetMapProviderV2 and made dataset_tweak_args use it.

Reviewed By: bottler

Differential Revision: D38313914

fbshipit-source-id: 529847571065dfba995b609a66737bd91e002cfe
This commit is contained in:
Darijan Gudelj 2022-08-02 06:38:51 -07:00 committed by Facebook GitHub Bot
parent 3b7ab22d10
commit 37250a4326
3 changed files with 16 additions and 16 deletions

View File

@ -64,17 +64,11 @@ data_source_ImplicitronDataSource_args:
dataset_class_type: JsonIndexDataset dataset_class_type: JsonIndexDataset
path_manager_factory_class_type: PathManagerFactory path_manager_factory_class_type: PathManagerFactory
dataset_JsonIndexDataset_args: dataset_JsonIndexDataset_args:
path_manager: null
frame_annotations_file: ''
sequence_annotations_file: ''
subset_lists_file: ''
subsets: null
limit_to: 0 limit_to: 0
limit_sequences_to: 0 limit_sequences_to: 0
pick_sequence: [] pick_sequence: []
exclude_sequence: [] exclude_sequence: []
limit_category_to: [] limit_category_to: []
dataset_root: ''
load_images: true load_images: true
load_depths: true load_depths: true
load_depth_masks: true load_depth_masks: true
@ -92,7 +86,6 @@ data_source_ImplicitronDataSource_args:
n_frames_per_sequence: -1 n_frames_per_sequence: -1
seed: 0 seed: 0
sort_frames: false sort_frames: false
eval_batches: null
path_manager_factory_PathManagerFactory_args: path_manager_factory_PathManagerFactory_args:
silence_logs: true silence_logs: true
dataset_map_provider_LlffDatasetMapProvider_args: dataset_map_provider_LlffDatasetMapProvider_args:

View File

@ -9,7 +9,7 @@ import json
import logging import logging
import os import os
import warnings import warnings
from typing import Dict, List, Optional, Type from typing import Dict, List, Optional, Tuple, Type
from omegaconf import DictConfig, open_dict from omegaconf import DictConfig, open_dict
from pytorch3d.implicitron.dataset.dataset_map_provider import ( 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", "") _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__) logger = logging.getLogger(__name__)
@ -289,7 +302,8 @@ class JsonIndexDatasetMapProviderV2(DatasetMapProviderBase): # pyre-ignore [13]
not expose certain fields of each dataset class. not expose certain fields of each dataset class.
""" """
with open_dict(args): with open_dict(args):
del args["eval_batch_index"] for key in _NEED_CONTROL:
del args[key]
def create_dataset(self): def create_dataset(self):
# The dataset object is created inside `self.get_dataset_map` # The dataset object is created inside `self.get_dataset_map`

View File

@ -52,17 +52,11 @@ dataset_map_provider_JsonIndexDatasetMapProviderV2_args:
dataset_class_type: JsonIndexDataset dataset_class_type: JsonIndexDataset
path_manager_factory_class_type: PathManagerFactory path_manager_factory_class_type: PathManagerFactory
dataset_JsonIndexDataset_args: dataset_JsonIndexDataset_args:
path_manager: null
frame_annotations_file: ''
sequence_annotations_file: ''
subset_lists_file: ''
subsets: null
limit_to: 0 limit_to: 0
limit_sequences_to: 0 limit_sequences_to: 0
pick_sequence: [] pick_sequence: []
exclude_sequence: [] exclude_sequence: []
limit_category_to: [] limit_category_to: []
dataset_root: ''
load_images: true load_images: true
load_depths: true load_depths: true
load_depth_masks: true load_depth_masks: true
@ -80,7 +74,6 @@ dataset_map_provider_JsonIndexDatasetMapProviderV2_args:
n_frames_per_sequence: -1 n_frames_per_sequence: -1
seed: 0 seed: 0
sort_frames: false sort_frames: false
eval_batches: null
path_manager_factory_PathManagerFactory_args: path_manager_factory_PathManagerFactory_args:
silence_logs: true silence_logs: true
dataset_map_provider_LlffDatasetMapProvider_args: dataset_map_provider_LlffDatasetMapProvider_args: