gigant commited on
Commit
47097fb
·
1 Parent(s): 0d58cdc

Update horse2zebra.py

Browse files
Files changed (1) hide show
  1. horse2zebra.py +10 -12
horse2zebra.py CHANGED
@@ -20,12 +20,10 @@ class Horse2Zebra(datasets.GeneratorBasedBuilder):
20
  VERSION = datasets.Version("1.0.0")
21
 
22
  BUILDER_CONFIGS = [
23
- datasets.BuilderConfig(name="train", version=VERSION, description="Train split"),
24
- datasets.BuilderConfig(name="test", version=VERSION, description="Test split"),
25
  ]
26
 
27
- DEFAULT_CONFIG_NAME = "train"
28
-
29
  def _info(self):
30
  features = datasets.Features(
31
  {
@@ -45,26 +43,26 @@ class Horse2Zebra(datasets.GeneratorBasedBuilder):
45
  data_dir = dl_manager.download_and_extract(urls)
46
  return [
47
  datasets.SplitGenerator(
48
- name="horse",
49
  gen_kwargs={
50
  "datapath": os.path.join(data_dir, "horse2zebra"),
51
- "split":"horse"
52
  },
53
  ),
54
  datasets.SplitGenerator(
55
- name="zebra",
56
  gen_kwargs={
57
  "datapath": os.path.join(data_dir, "horse2zebra"),
58
- "split":"zebra"
59
  },
60
  ),
61
  ]
62
 
63
  def _generate_examples(self, datapath, split):
64
- if split=="horse":
65
- dir = "trainA" if self.config.name == "train" else "testA"
66
- elif split=="zebra":
67
- dir = "trainB" if self.config.name == "train" else "testB"
68
  image_dir = os.path.join(datapath, dir)
69
  for idx, image_file in enumerate(os.listdir(image_dir)):
70
  image_id = image_file.split(".")[0]
 
20
  VERSION = datasets.Version("1.0.0")
21
 
22
  BUILDER_CONFIGS = [
23
+ datasets.BuilderConfig(name="horse", version=VERSION, description="Images of horses"),
24
+ datasets.BuilderConfig(name="zebra", version=VERSION, description="Images of zebras"),
25
  ]
26
 
 
 
27
  def _info(self):
28
  features = datasets.Features(
29
  {
 
43
  data_dir = dl_manager.download_and_extract(urls)
44
  return [
45
  datasets.SplitGenerator(
46
+ name=datasets.Split.TRAIN,
47
  gen_kwargs={
48
  "datapath": os.path.join(data_dir, "horse2zebra"),
49
+ "split":"train"
50
  },
51
  ),
52
  datasets.SplitGenerator(
53
+ name=datasets.Split.TEST,
54
  gen_kwargs={
55
  "datapath": os.path.join(data_dir, "horse2zebra"),
56
+ "split":"test"
57
  },
58
  ),
59
  ]
60
 
61
  def _generate_examples(self, datapath, split):
62
+ if split=="train":
63
+ dir = "trainA" if self.config.name == "horse" else "trainB"
64
+ elif split=="test":
65
+ dir = "testA" if self.config.name == "horse" else "testB"
66
  image_dir = os.path.join(datapath, dir)
67
  for idx, image_file in enumerate(os.listdir(image_dir)):
68
  image_id = image_file.split(".")[0]