Combined dataset that includes Co3D, Re10k and DAVIS datasets. Args: opt: Configuration object that includes: - dataset_weights: Dict of dataset names to their weights - root_paths: Dict of dataset names to their root paths
(self, opt, training=True, shuffle=False, override_nearby_range=None)
| 11 | |
| 12 | class CombinedDataset(Dataset): |
| 13 | def __init__(self, opt, training=True, shuffle=False, override_nearby_range=None): |
| 14 | """ |
| 15 | Combined dataset that includes Co3D, Re10k and DAVIS datasets. |
| 16 | |
| 17 | Args: |
| 18 | opt: Configuration object that includes: |
| 19 | - dataset_weights: Dict of dataset names to their weights |
| 20 | - root_paths: Dict of dataset names to their root paths |
| 21 | training: Whether in training mode |
| 22 | shuffle: Whether to shuffle the dataset |
| 23 | override_nearby_range: Override the nearby range for the dataset |
| 24 | """ |
| 25 | super().__init__() |
| 26 | self.opt = opt |
| 27 | self.training = training |
| 28 | self.shuffle = shuffle |
| 29 | self.rcvd = hasattr(opt, 'vos_path') and opt.vos_path != "" |
| 30 | self.override_nearby_range = override_nearby_range |
| 31 | if override_nearby_range is not None: |
| 32 | nearby_range_kwargs = {"nearby_range": override_nearby_range} |
| 33 | else: |
| 34 | nearby_range_kwargs = {} |
| 35 | |
| 36 | if self.rcvd: |
| 37 | print("Using Re10k, Co3D, DAVIS and VOS datasets") |
| 38 | else: |
| 39 | print("Using Re10k, Co3D and DAVIS datasets") |
| 40 | |
| 41 | self.set_transform() |
| 42 | |
| 43 | self.datasets = {} |
| 44 | self.dataset_lengths = {} |
| 45 | self.dataset_names = [] |
| 46 | |
| 47 | # Setup Co3D dataset if path exists |
| 48 | if hasattr(opt, 'co3d_path'): |
| 49 | opt_co3d = deepcopy(opt) |
| 50 | opt_co3d.root_path = opt_co3d.co3d_path |
| 51 | dataset = Co3DDataset(opt=opt_co3d, training=training, shuffle=shuffle, **nearby_range_kwargs) |
| 52 | dataset.transform = self.transform |
| 53 | dataset.depth_transform = self.depth_transform |
| 54 | self.datasets['co3d'] = dataset |
| 55 | self.dataset_lengths['co3d'] = len(dataset) |
| 56 | |
| 57 | # Setup Re10k dataset if path exists |
| 58 | if hasattr(opt, 're10k_path'): |
| 59 | opt_re10k = deepcopy(opt) |
| 60 | opt_re10k.root_path = opt_re10k.re10k_path |
| 61 | dataset = Re10kMapDataset(opt=opt_re10k, training=training, shuffle=shuffle, **nearby_range_kwargs) |
| 62 | dataset.transform = self.transform |
| 63 | dataset.depth_transform = self.depth_transform |
| 64 | self.datasets['re10k'] = dataset |
| 65 | self.dataset_lengths['re10k'] = len(dataset) |
| 66 | |
| 67 | # Setup DAVIS dataset if path exists |
| 68 | if hasattr(opt, 'davis_path'): |
| 69 | opt_davis = deepcopy(opt) |
| 70 | opt_davis.root_path = opt_davis.davis_path |
nothing calls this directly
no test coverage detected