sps44 commited on
Commit
b1c0bc2
1 Parent(s): 722bcc5

add label string

Browse files
Files changed (1) hide show
  1. food101-enriched.py +5 -5
food101-enriched.py CHANGED
@@ -191,7 +191,7 @@ class Food101Enriched(datasets.GeneratorBasedBuilder):
191
  {
192
  "image": datasets.Value("string"),
193
  "label": datasets.features.ClassLabel(names=_NAMES),
194
- #"label_str": datasets.Value("string"),
195
  "split": datasets.Value("string"),
196
  }
197
  ),
@@ -224,7 +224,7 @@ class Food101Enriched(datasets.GeneratorBasedBuilder):
224
  df = metadata[metadata['split']=='train']
225
 
226
  if split == "test":
227
- df = metadata[metadata['split']=='test']
228
 
229
  if split == "all":
230
  df = metadata
@@ -240,7 +240,7 @@ class Food101Enriched(datasets.GeneratorBasedBuilder):
240
  result = {
241
  'image': img_path,
242
  'label': row['label'],
243
- #'label_str': row['fine_label_str'],
244
  'split': split,
245
  }
246
  yield index, result
@@ -251,5 +251,5 @@ class Food101Enriched(datasets.GeneratorBasedBuilder):
251
 
252
 
253
 
254
- if __name__ == "__main__":
255
- ds = load_dataset("food101-enriched.py", split="all")
 
191
  {
192
  "image": datasets.Value("string"),
193
  "label": datasets.features.ClassLabel(names=_NAMES),
194
+ "label_str": datasets.Value("string"),
195
  "split": datasets.Value("string"),
196
  }
197
  ),
 
224
  df = metadata[metadata['split']=='train']
225
 
226
  if split == "test":
227
+ df = metadata[metadata['split']=='validation']
228
 
229
  if split == "all":
230
  df = metadata
 
240
  result = {
241
  'image': img_path,
242
  'label': row['label'],
243
+ 'label_str': row['label'],
244
  'split': split,
245
  }
246
  yield index, result
 
251
 
252
 
253
 
254
+ #if __name__ == "__main__":
255
+ # ds = load_dataset("food101-enriched.py", split="all")