XingjianL commited on
Commit
d75821a
1 Parent(s): 09039e6

test custom config

Browse files
Files changed (1) hide show
  1. tomatotest.py +7 -4
tomatotest.py CHANGED
@@ -6,12 +6,15 @@ import numpy as np
6
  import h5py
7
  class CustomConfig(datasets.BuilderConfig):
8
  def __init__(self, **kwargs):
9
- self.dataset_type = kwargs.pop("dataset_type", "all")
10
  super(CustomConfig, self).__init__(**kwargs)
 
 
11
 
12
  class RGBSemanticDepthDataset(GeneratorBasedBuilder):
13
  BUILDER_CONFIGS = [
14
- CustomConfig(name="custom_config", version="1.0.0", description="")
 
 
15
  ] # Configs initialization
16
  BUILDER_CONFIG_CLASS = CustomConfig
17
  def _info(self):
@@ -59,11 +62,11 @@ class RGBSemanticDepthDataset(GeneratorBasedBuilder):
59
  ]
60
 
61
  def _generate_examples(self, archives):
62
- print(self.dataset_type)
63
  for archive in archives:
64
  for path, file in archive:
65
  #print(path)
66
- left_rgb, right_rgb, left_seg, left_depth, right_depth = self._h5_loader(file.read(), self.dataset_type)
67
  yield path, {
68
  "left_rgb": left_rgb,
69
  "right_rgb": right_rgb,
 
6
  import h5py
7
  class CustomConfig(datasets.BuilderConfig):
8
  def __init__(self, **kwargs):
 
9
  super(CustomConfig, self).__init__(**kwargs)
10
+ self.dataset_type = kwargs.pop("dataset_type", "all")
11
+
12
 
13
  class RGBSemanticDepthDataset(GeneratorBasedBuilder):
14
  BUILDER_CONFIGS = [
15
+ CustomConfig(name="all", version="1.0.0", description="all"),
16
+ CustomConfig(name="depth", version="1.0.0", description="depth"),
17
+ CustomConfig(name="segment", version="1.0.0", description="segmentation"),
18
  ] # Configs initialization
19
  BUILDER_CONFIG_CLASS = CustomConfig
20
  def _info(self):
 
62
  ]
63
 
64
  def _generate_examples(self, archives):
65
+ print(self.config.dataset_type)
66
  for archive in archives:
67
  for path, file in archive:
68
  #print(path)
69
+ left_rgb, right_rgb, left_seg, left_depth, right_depth = self._h5_loader(file.read(), self.config.dataset_type)
70
  yield path, {
71
  "left_rgb": left_rgb,
72
  "right_rgb": right_rgb,