XingjianL commited on
Commit
fed1122
1 Parent(s): 8a8c04f
Files changed (1) hide show
  1. tomatotest.py +13 -4
tomatotest.py CHANGED
@@ -4,6 +4,8 @@ from datasets import GeneratorBasedBuilder, DatasetInfo, Features, SplitGenerato
4
  import datasets
5
  import numpy as np
6
  import h5py
 
 
7
  class CustomConfig(datasets.BuilderConfig):
8
  def __init__(self, **kwargs):
9
  super(CustomConfig, self).__init__(**kwargs)
@@ -16,9 +18,10 @@ _metadata_urls = {
16
 
17
  class RGBSemanticDepthDataset(GeneratorBasedBuilder):
18
  BUILDER_CONFIGS = [
19
- CustomConfig(name="all", version="1.0.0", description="load both segmentation and depth"),
20
- CustomConfig(name="depth", version="1.0.0", description="only load depth"),
21
- CustomConfig(name="seg", version="1.0.0", description="only load segmentation"),
 
22
  ] # Configs initialization
23
  BUILDER_CONFIG_CLASS = CustomConfig
24
  def _info(self):
@@ -54,6 +57,7 @@ class RGBSemanticDepthDataset(GeneratorBasedBuilder):
54
  return Image.open(io.BytesIO(bytes_stream))
55
 
56
  def _split_generators(self, dl_manager):
 
57
  archives = dl_manager.download({"train":["data/images_1730238419.175364.tar"],
58
  "val":["data/images_1730238419.175364.tar"]})
59
  split_metadata = dl_manager.download(_metadata_urls)
@@ -93,4 +97,9 @@ class RGBSemanticDepthDataset(GeneratorBasedBuilder):
93
  "left_seg": left_seg,
94
  "left_depth": left_depth,
95
  "right_depth": right_depth,
96
- }
 
 
 
 
 
 
4
  import datasets
5
  import numpy as np
6
  import h5py
7
+ from huggingface_hub import HfFileSystem
8
+
9
  class CustomConfig(datasets.BuilderConfig):
10
  def __init__(self, **kwargs):
11
  super(CustomConfig, self).__init__(**kwargs)
 
18
 
19
  class RGBSemanticDepthDataset(GeneratorBasedBuilder):
20
  BUILDER_CONFIGS = [
21
+ CustomConfig(name="full", version="1.0.0", description="load both segmentation and depth (for all tar files, 160GB)"),
22
+ CustomConfig(name="sample", version="1.0.0", description="load both segmentation and depth (for 1 tar file, 870MB)"),
23
+ CustomConfig(name="depth", version="1.0.0", description="only load depth (sample)"),
24
+ CustomConfig(name="seg", version="1.0.0", description="only load segmentation (sample)"),
25
  ] # Configs initialization
26
  BUILDER_CONFIG_CLASS = CustomConfig
27
  def _info(self):
 
57
  return Image.open(io.BytesIO(bytes_stream))
58
 
59
  def _split_generators(self, dl_manager):
60
+ print(self.config.dataset_type)
61
  archives = dl_manager.download({"train":["data/images_1730238419.175364.tar"],
62
  "val":["data/images_1730238419.175364.tar"]})
63
  split_metadata = dl_manager.download(_metadata_urls)
 
97
  "left_seg": left_seg,
98
  "left_depth": left_depth,
99
  "right_depth": right_depth,
100
+ }
101
+ def _get_dataset_filenames(self):
102
+ fs = HfFileSystem()
103
+ all_files = fs.ls("datasets/xingjianli/tomatotest/data")
104
+ filenames = ['/'.join(f['name'].split('/')[-2:]) for f in all_files]
105
+ return filenames