MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / GSCDataset

Class GSCDataset

examples/datasets/colmap.py:404–439  ·  view source on GitHub ↗

Dataset class for GSC with scene-specific train/test view split.

Source from the content-addressed store, hash-verified

402 return data
403
404class GSCDataset(Dataset):
405 """Dataset class for GSC with scene-specific train/test view split."""
406
407 def __init__(
408 self,
409 parser: Parser,
410 split: str = "train",
411 patch_size: Optional[int] = None,
412 load_depths: bool = False,
413 test_view_ids: Optional[Union[List[int], Literal["all"]]] = None
414 ):
415 # Call parent class constructor without setting indices
416 super().__init__(parser, split, patch_size, load_depths)
417
418 if test_view_ids is None:
419 # If no custom test view indices are provided, use the default split from parent class
420 return
421
422 # Convert indices to sets for efficient lookup
423 all_indices = set(range(len(self.parser.image_names)))
424 if test_view_ids == "all":
425 test_indices = all_indices
426 train_indices = set()
427 else:
428 test_indices = set(test_view_ids)
429 train_indices = all_indices - test_indices # Set difference operation
430
431 # Select indices based on split
432 if split == "train":
433 self.indices = np.array(list(train_indices))
434 else:
435 self.indices = np.array(list(test_indices))
436 print(f"The test view id is: {self.indices}.")
437
438 # Ensure indices are sorted
439 self.indices.sort()
440
441if __name__ == "__main__":
442 import argparse

Callers 6

set_up_datasetsMethod · 0.90
set_up_datasetsMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
test_ply_quantizationFunction · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by 1

test_ply_quantizationFunction · 0.72