yw26342 commited on
Commit
31c4b9b
·
1 Parent(s): d454d93

Update test.py

Browse files
Files changed (1) hide show
  1. test.py +6 -9
test.py CHANGED
@@ -568,11 +568,9 @@ class Food500(datasets.GeneratorBasedBuilder):
568
  metadata = dl_manager.iter_archive(split_metadata_path)
569
  for file_path, file_obj in metadata:
570
  if file_path == _TRAIN_TXT:
571
- # train_set = set(file_obj.read().split("\n"))
572
- # train_set = {path.encode("utf-8") for path in train_set}
573
- with open(file_path, encoding="utf-8") as f:
574
- train_set = set(f.read().split("\n"))
575
- if file_path == _VALID_TXT:
576
  # valid_set = set(file_obj.read().split("\n"))
577
  # valid_set = {path.encode("utf-8") for path in valid_set}
578
  with open(file_path, encoding="utf-8") as f:
@@ -581,8 +579,7 @@ class Food500(datasets.GeneratorBasedBuilder):
581
  # test_set = set(file_obj.read().split("\n"))
582
  # test_set = {path.encode("utf-8") for path in test_set}
583
  with open(file_path, encoding="utf-8") as f:
584
- test_set = set(f.read().split("\n"))
585
- pass
586
  return [
587
  datasets.SplitGenerator(
588
  name=datasets.Split.TRAIN,
@@ -591,7 +588,7 @@ class Food500(datasets.GeneratorBasedBuilder):
591
  "metadata_set": train_set,
592
  },
593
  ),
594
- datasets.SplitGenerator(
595
  name=datasets.Split.VALIDATION,
596
  gen_kwargs={
597
  "images": dl_manager.iter_archive(archive_path),
@@ -604,7 +601,7 @@ class Food500(datasets.GeneratorBasedBuilder):
604
  "images": dl_manager.iter_archive(archive_path),
605
  "metadata_set": test_set,
606
  },
607
- ),
608
  ]
609
 
610
  def _generate_examples(self, images, metadata_set):
 
568
  metadata = dl_manager.iter_archive(split_metadata_path)
569
  for file_path, file_obj in metadata:
570
  if file_path == _TRAIN_TXT:
571
+ train_set = set(file_obj.read().split("\n"))
572
+ train_set = {path.encode("utf-8") for path in train_set}
573
+ """if file_path == _VALID_TXT:
 
 
574
  # valid_set = set(file_obj.read().split("\n"))
575
  # valid_set = {path.encode("utf-8") for path in valid_set}
576
  with open(file_path, encoding="utf-8") as f:
 
579
  # test_set = set(file_obj.read().split("\n"))
580
  # test_set = {path.encode("utf-8") for path in test_set}
581
  with open(file_path, encoding="utf-8") as f:
582
+ test_set = set(f.read().split("\n"))"""
 
583
  return [
584
  datasets.SplitGenerator(
585
  name=datasets.Split.TRAIN,
 
588
  "metadata_set": train_set,
589
  },
590
  ),
591
+ """datasets.SplitGenerator(
592
  name=datasets.Split.VALIDATION,
593
  gen_kwargs={
594
  "images": dl_manager.iter_archive(archive_path),
 
601
  "images": dl_manager.iter_archive(archive_path),
602
  "metadata_set": test_set,
603
  },
604
+ ),"""
605
  ]
606
 
607
  def _generate_examples(self, images, metadata_set):