alkzar90 commited on
Commit
1c43976
·
1 Parent(s): 16e28d5

New dataset version

Browse files
Files changed (1) hide show
  1. rock-glacier-dataset.py +24 -6
rock-glacier-dataset.py CHANGED
@@ -19,8 +19,10 @@ import re
19
  import datasets
20
  from datasets.tasks import ImageClassification
21
 
22
- datasets.logging.set_verbosity_info()
23
  logger = datasets.logging.get_logger(__name__)
 
 
24
 
25
 
26
  _HOMEPAGE = "https://github.com/alcazar90/rock-glacier-detection"
@@ -41,12 +43,20 @@ TODO: Add a description...
41
  """
42
 
43
 
 
 
 
 
 
 
 
44
  _URLS = {
45
- "train": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/train.zip",
46
- "validation": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/validation.zip",
47
- "train_mask": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/glaciar_masks_trainset.zip",
48
  }
49
 
 
50
  _NAMES = ["glaciar", "cordillera"]
51
 
52
 
@@ -112,6 +122,13 @@ class RockGlacierDataset(datasets.GeneratorBasedBuilder):
112
  "split": "validation",
113
  },
114
  ),
 
 
 
 
 
 
 
115
  ]
116
 
117
  if self.config.name == "image-segmentation":
@@ -131,7 +148,8 @@ class RockGlacierDataset(datasets.GeneratorBasedBuilder):
131
  if self.config.name == "image-classification":
132
  for i, path in enumerate(files):
133
  file_name = os.path.basename(path)
134
- if file_name.endswith(".png"):
 
135
  yield i, {
136
  "image": path,
137
  "labels": os.path.basename(os.path.dirname(path)).lower(),
@@ -153,4 +171,4 @@ class RockGlacierDataset(datasets.GeneratorBasedBuilder):
153
  "image": path,
154
  "labels": imageId2mask[re.search('\d+', file_name).group(0)]
155
  }
156
-
 
19
  import datasets
20
  from datasets.tasks import ImageClassification
21
 
22
+ datasets.logging.set_verbosity_debug()
23
  logger = datasets.logging.get_logger(__name__)
24
+ #datasets.logging.set_verbosity_info()
25
+ #datasets.logging.set_verbosity_debug()
26
 
27
 
28
  _HOMEPAGE = "https://github.com/alcazar90/rock-glacier-detection"
 
43
  """
44
 
45
 
46
+ #_URLS = {
47
+ # "train": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/train.zip",
48
+ # "validation": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/validation.zip",
49
+ # "train_mask": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/glaciar_masks_trainset.zip",
50
+ #}
51
+
52
+
53
  _URLS = {
54
+ "train": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/data_v01/train.zip",
55
+ "validation": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/data_v01/val.zip",
56
+ "test": "https://huggingface.co/datasets/alkzar90/rock-glacier-dataset/resolve/main/data/data_v01/test.zip",
57
  }
58
 
59
+
60
  _NAMES = ["glaciar", "cordillera"]
61
 
62
 
 
122
  "split": "validation",
123
  },
124
  ),
125
+ datasets.SplitGenerator(
126
+ name=datasets.Split.TEST,
127
+ gen_kwargs={
128
+ "files": dl_manager.iter_files([data_files["test"]]),
129
+ "split": "test",
130
+ },
131
+ ),
132
  ]
133
 
134
  if self.config.name == "image-segmentation":
 
148
  if self.config.name == "image-classification":
149
  for i, path in enumerate(files):
150
  file_name = os.path.basename(path)
151
+ dir_name = os.path.basename(os.path.dirname(path))
152
+ if dir_name != "masks" and file_name.endswith(".png"):
153
  yield i, {
154
  "image": path,
155
  "labels": os.path.basename(os.path.dirname(path)).lower(),
 
171
  "image": path,
172
  "labels": imageId2mask[re.search('\d+', file_name).group(0)]
173
  }
174
+