mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	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:
		
							parent
							
								
									3b7ab22d10
								
							
						
					
					
						commit
						37250a4326
					
				@ -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:
 | 
			
		||||
 | 
			
		||||
@ -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`
 | 
			
		||||
 | 
			
		||||
@ -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:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user