jtz18 commited on
Commit
771b1c1
·
verified ·
1 Parent(s): 376b926

update dataset with task1

Browse files
Files changed (1) hide show
  1. skin-lesion.py +42 -8
skin-lesion.py CHANGED
@@ -60,7 +60,8 @@ _URLS = {
60
  "milia_like_cyst": "https://storage.googleapis.com/lesion-dataset/dataset-milia_like_cyst.zip",
61
  "negative_network": "https://storage.googleapis.com/lesion-dataset/dataset-negative_network.zip",
62
  "pigment_network": "https://storage.googleapis.com/lesion-dataset/dataset-pigment_network.zip",
63
- "streaks": "https://storage.googleapis.com/lesion-dataset/dataset-streaks.zip"
 
64
  }
65
 
66
 
@@ -76,9 +77,10 @@ class LesionDataset(datasets.GeneratorBasedBuilder):
76
  datasets.BuilderConfig(name="milia_like_cyst", version=VERSION, description="This will return the dataset with only milia_like_cyst class"),
77
  datasets.BuilderConfig(name="negative_network", version=VERSION, description="This will return the dataset with only negative_network class"),
78
  datasets.BuilderConfig(name="pigment_network", version=VERSION, description="This will return the dataset with only pigment_network class"),
79
- datasets.BuilderConfig(name="streaks", version=VERSION, description="This will return the dataset with only streaks class")
 
80
  ]
81
- DEFAULT_CONFIG_NAME = "full" # It's not mandatory to have a default configuration. Just use one if it make sense.
82
 
83
  def _info(self):
84
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
@@ -93,8 +95,8 @@ class LesionDataset(datasets.GeneratorBasedBuilder):
93
  "label4": datasets.Image(),
94
  }
95
  )
96
- print(type(features))
97
- elif self.config.name in ['globules', 'milia_like_cyst', 'negative_network', 'pigment_network', 'streaks']:
98
  features = datasets.Features(
99
  {
100
  "image": datasets.Image(),
@@ -144,13 +146,45 @@ class LesionDataset(datasets.GeneratorBasedBuilder):
144
  'streaks': 4
145
  }
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  return [
148
  datasets.SplitGenerator(
149
  name=datasets.Split.TRAIN,
150
  # These kwargs will be passed to _generate_examples
151
  gen_kwargs={
152
  "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Training_Input"),
153
- "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task2_Training_GroundTruth_v3"),
154
  "split": "train",
155
  },
156
  ),
@@ -159,7 +193,7 @@ class LesionDataset(datasets.GeneratorBasedBuilder):
159
  # These kwargs will be passed to _generate_examples
160
  gen_kwargs={
161
  "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Validation_Input"),
162
- "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task2_Validation_GroundTruth"),
163
  "split": "validation",
164
  },
165
  ),
@@ -168,7 +202,7 @@ class LesionDataset(datasets.GeneratorBasedBuilder):
168
  # These kwargs will be passed to _generate_examples
169
  gen_kwargs={
170
  "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Test_Input"),
171
- "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task2_Test_GroundTruth"),
172
  "split": "test"
173
  },
174
  ),
 
60
  "milia_like_cyst": "https://storage.googleapis.com/lesion-dataset/dataset-milia_like_cyst.zip",
61
  "negative_network": "https://storage.googleapis.com/lesion-dataset/dataset-negative_network.zip",
62
  "pigment_network": "https://storage.googleapis.com/lesion-dataset/dataset-pigment_network.zip",
63
+ "streaks": "https://storage.googleapis.com/lesion-dataset/dataset-streaks.zip",
64
+ "task1": "https://storage.googleapis.com/lesion-dataset/dataset-task1.zip",
65
  }
66
 
67
 
 
77
  datasets.BuilderConfig(name="milia_like_cyst", version=VERSION, description="This will return the dataset with only milia_like_cyst class"),
78
  datasets.BuilderConfig(name="negative_network", version=VERSION, description="This will return the dataset with only negative_network class"),
79
  datasets.BuilderConfig(name="pigment_network", version=VERSION, description="This will return the dataset with only pigment_network class"),
80
+ datasets.BuilderConfig(name="streaks", version=VERSION, description="This will return the dataset with only streaks class"),
81
+ datasets.BuilderConfig(name="task1", version=VERSION, description="This will return the dataset for task1"),
82
  ]
83
+ DEFAULT_CONFIG_NAME = "task1" # It's not mandatory to have a default configuration. Just use one if it make sense.
84
 
85
  def _info(self):
86
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
 
95
  "label4": datasets.Image(),
96
  }
97
  )
98
+
99
+ elif self.config.name in ['globules', 'milia_like_cyst', 'negative_network', 'pigment_network', 'streaks', 'task1']:
100
  features = datasets.Features(
101
  {
102
  "image": datasets.Image(),
 
146
  'streaks': 4
147
  }
148
 
149
+ # Task 2
150
+ if self.config.name in ['full', 'globules', 'milia_like_cyst', 'negative_network', 'pigment_network', 'streaks']:
151
+ return [
152
+ datasets.SplitGenerator(
153
+ name=datasets.Split.TRAIN,
154
+ # These kwargs will be passed to _generate_examples
155
+ gen_kwargs={
156
+ "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Training_Input"),
157
+ "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task2_Training_GroundTruth_v3"),
158
+ "split": "train",
159
+ },
160
+ ),
161
+ datasets.SplitGenerator(
162
+ name=datasets.Split.VALIDATION,
163
+ # These kwargs will be passed to _generate_examples
164
+ gen_kwargs={
165
+ "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Validation_Input"),
166
+ "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task2_Validation_GroundTruth"),
167
+ "split": "validation",
168
+ },
169
+ ),
170
+ datasets.SplitGenerator(
171
+ name=datasets.Split.TEST,
172
+ # These kwargs will be passed to _generate_examples
173
+ gen_kwargs={
174
+ "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Test_Input"),
175
+ "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task2_Test_GroundTruth"),
176
+ "split": "test"
177
+ },
178
+ ),
179
+ ]
180
+
181
  return [
182
  datasets.SplitGenerator(
183
  name=datasets.Split.TRAIN,
184
  # These kwargs will be passed to _generate_examples
185
  gen_kwargs={
186
  "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Training_Input"),
187
+ "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1_Training_GroundTruth"),
188
  "split": "train",
189
  },
190
  ),
 
193
  # These kwargs will be passed to _generate_examples
194
  gen_kwargs={
195
  "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Validation_Input"),
196
+ "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1_Validation_GroundTruth"),
197
  "split": "validation",
198
  },
199
  ),
 
202
  # These kwargs will be passed to _generate_examples
203
  gen_kwargs={
204
  "filepath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1-2_Test_Input"),
205
+ "labelpath": os.path.join(data_dir, f"{base_name}/ISIC2018_Task1_Test_GroundTruth"),
206
  "split": "test"
207
  },
208
  ),