def __init__(self,
              config,
              input_transform=None,
              target_transform=None,
              augment_data=True,
              elastic_distortion=False,
              cache=False,
              phase=DatasetPhase.Train):
     if isinstance(phase, str):
         phase = str2datasetphase_type(phase)
     # Use cropped rooms for train/val
     data_root = config.scannet_path
     if phase not in [DatasetPhase.Train, DatasetPhase.TrainVal]:
         self.CLIP_BOUND = self.TEST_CLIP_BOUND
     data_paths = read_txt(
         os.path.join(data_root, self.DATA_PATH_FILE[phase]))
     logging.info('Loading {}: {}'.format(self.__class__.__name__,
                                          self.DATA_PATH_FILE[phase]))
     super().__init__(data_paths,
                      data_root=data_root,
                      input_transform=input_transform,
                      target_transform=target_transform,
                      ignore_label=config.ignore_label,
                      return_transformation=config.return_transformation,
                      augment_data=augment_data,
                      elastic_distortion=elastic_distortion,
                      config=config)
 def __init__(self,
              config,
              prevoxel_transform=None,
              input_transform=None,
              target_transform=None,
              augment_data=True,
              elastic_distortion=False,
              cache=False,
              phase=DatasetPhase.Train):
     if isinstance(phase, str):
         phase = str2datasetphase_type(phase)
     if phase not in [DatasetPhase.Train, DatasetPhase.TrainVal]:
         self.CLIP_BOUND = self.TEST_CLIP_BOUND
     data_root = config.synthia_path
     data_paths = read_txt(
         osp.join('./splits/synthia4d', self.DATA_PATH_FILE[phase]))
     data_paths = [d.split()[0] for d in data_paths]
     logging.info('Loading {}: {}'.format(self.__class__.__name__,
                                          self.DATA_PATH_FILE[phase]))
     super().__init__(data_paths,
                      data_root=data_root,
                      input_transform=input_transform,
                      target_transform=target_transform,
                      ignore_label=config.ignore_label,
                      return_transformation=config.return_transformation,
                      augment_data=augment_data,
                      elastic_distortion=elastic_distortion,
                      config=config)
Example #3
0
    def __init__(self,
                 config,
                 prevoxel_transform=None,
                 input_transform=None,
                 target_transform=None,
                 augment_data=True,
                 elastic_distortion=False,
                 cache=False,
                 phase=DatasetPhase.Train):
        if isinstance(phase, str):
            phase = str2datasetphase_type(phase)
        if phase not in [DatasetPhase.Train, DatasetPhase.TrainVal]:
            self.CLIP_BOUND = self.TEST_CLIP_BOUND
        data_root = config.synthia_path
        data_paths = read_txt(osp.join(data_root, self.DATA_PATH_FILE[phase]))
        data_paths = sorted([d.split()[0] for d in data_paths])
        seq2files = defaultdict(list)
        for f in data_paths:
            seq_name = f.split(os.sep)[0]
            seq2files[seq_name].append(f)
        self.camera_path = config.synthia_camera_path
        self.camera_intrinsic_file = config.synthia_camera_intrinsic_file
        self.camera_extrinsics_file = config.synthia_camera_extrinsics_file
        # Force sort file sequence for easier debugging.
        file_seq_list = []
        for key in sorted(seq2files.keys()):
            file_seq_list.append(sorted(seq2files[key]))

        logging.info('Loading {}: {}'.format(self.__class__.__name__,
                                             self.DATA_PATH_FILE[phase]))
        TemporalVoxelizationDataset.__init__(
            self,
            file_seq_list,
            data_root=data_root,
            input_transform=input_transform,
            target_transform=target_transform,
            ignore_label=config.ignore_label,
            temporal_dilation=config.temporal_dilation,
            temporal_numseq=config.temporal_numseq,
            return_transformation=config.return_transformation,
            augment_data=augment_data,
            elastic_distortion=elastic_distortion,
            config=config)
Example #4
0
    def __init__(self,
                 config,
                 prevoxel_transform=None,
                 input_transform=None,
                 target_transform=None,
                 cache=False,
                 augment_data=True,
                 elastic_distortion=False,
                 phase=DatasetPhase.Train):
        if isinstance(phase, str):
            phase = str2datasetphase_type(phase)
        if phase not in [DatasetPhase.Train, DatasetPhase.TrainVal]:
            self.CLIP_BOUND = self.TEST_CLIP_BOUND
        data_root = config.data.stanford3d_path
        if isinstance(self.DATA_PATH_FILE[phase], (list, tuple)):
            data_paths = []
            for split in self.DATA_PATH_FILE[phase]:
                data_paths += read_txt(os.path.join(data_root, 'splits',
                                                    split))
        else:
            data_paths = read_txt(
                os.path.join(data_root, 'splits', self.DATA_PATH_FILE[phase]))

        if config.data.voxel_size:
            self.VOXEL_SIZE = config.data.voxel_size
        logging.info('voxel size: {}'.format(self.VOXEL_SIZE))
        logging.info('Loading {} {}: {}'.format(self.__class__.__name__, phase,
                                                self.DATA_PATH_FILE[phase]))

        VoxelizationDataset.__init__(
            self,
            data_paths,
            data_root=data_root,
            prevoxel_transform=prevoxel_transform,
            input_transform=input_transform,
            target_transform=target_transform,
            ignore_label=config.data.ignore_label,
            return_transformation=config.data.return_transformation,
            augment_data=augment_data,
            elastic_distortion=elastic_distortion,
            config=config)
Example #5
0
 def __init__(self,
              config,
              input_transform=None,
              target_transform=None,
              augment_data=True,
              cache=False,
              phase=DatasetPhase.Train):
   if isinstance(phase, str):
     phase = str2datasetphase_type(phase)
   data_root = config.sunrgbd_path
   data_paths = read_txt(os.path.join(data_root, self.DATA_PATH_FILE[phase]))
   logging.info('Loading {}: {}'.format(self.__class__.__name__, self.DATA_PATH_FILE[phase]))
   super().__init__(
       data_paths,
       data_root=data_root,
       input_transform=input_transform,
       target_transform=target_transform,
       ignore_label=config.ignore_label,
       return_transformation=config.return_transformation,
       augment_data=augment_data,
       config=config)