Datasets:

ArXiv:
Tags:
License:
cgarciae commited on
Commit
5679ebe
1 Parent(s): f105ee9

clean cartoonset

Browse files
Files changed (1) hide show
  1. cartoonset.py +25 -30
cartoonset.py CHANGED
@@ -11,18 +11,32 @@ import datasets
11
  from datasets.tasks import ImageClassification
12
 
13
 
14
- _CITATION = """\
15
- @TECHREPORT{Krizhevsky09learningmultiple,
16
- author = {Alex Krizhevsky},
17
- title = {Learning multiple layers of features from tiny images},
18
- institution = {},
19
- year = {2009}
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
  """
22
 
23
  _DESCRIPTION = """\
24
- The Cartoonset-10k dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images
25
- per class. There are 50000 training images and 10000 test images.
 
26
  """
27
 
28
  _DATA_URLS = {
@@ -45,7 +59,7 @@ class Cartoonset(datasets.GeneratorBasedBuilder):
45
  datasets.BuilderConfig(
46
  name="100k",
47
  version=datasets.Version("1.0.0", ""),
48
- description="Loads the Cartoonset-10k Data Set",
49
  ),
50
  ]
51
 
@@ -57,24 +71,16 @@ class Cartoonset(datasets.GeneratorBasedBuilder):
57
  features=datasets.Features(
58
  {
59
  "img": datasets.Image(),
60
- # "label": datasets.features.ClassLabel(names=_NAMES),
61
  }
62
  ),
63
  supervised_keys=("img",),
64
  homepage="https://www.cs.toronto.edu/~kriz/cifar.html",
65
  citation=_CITATION,
66
- # task_templates=ImageClassification(
67
- # image_column="img", label_column="label"
68
- # ),
69
  )
70
 
71
  def _split_generators(self, dl_manager: datasets.DownloadManager):
72
  url = _DATA_URLS[self.config.name]
73
  print("URL:", url)
74
- exit()
75
- archive = dl_manager.download(url)
76
-
77
- print(archive)
78
 
79
  return [
80
  datasets.SplitGenerator(
@@ -84,28 +90,17 @@ class Cartoonset(datasets.GeneratorBasedBuilder):
84
  "split": "train",
85
  },
86
  ),
87
- # datasets.SplitGenerator(
88
- # name=datasets.Split.TEST, gen_kwargs={"files": dl_manager.iter_archive(archive), "split": "test"}
89
- # ),
90
  ]
91
 
92
  def _generate_examples(self, files, split):
93
  """This function returns the examples in the raw (text) form."""
94
 
95
- # if split == "train":
96
- # batches = ["data_batch_1", "data_batch_2", "data_batch_3", "data_batch_4", "data_batch_5"]
97
-
98
- # if split == "test":
99
- # batches = ["test_batch"]
100
- # batches = [f"Cartoonset-10k-batches-py/{filename}" for filename in batches]
101
- print("FILES", files)
102
-
103
  path: str
104
  for path, file_obj in files:
105
 
106
  if path.endswith(".png"):
107
- image = PIL.Image.open(path)
108
 
109
  yield path, {
110
- "img": np.asarray(image),
111
  }
 
11
  from datasets.tasks import ImageClassification
12
 
13
 
14
+ _CITATION = r"""
15
+ @article{DBLP:journals/corr/abs-1711-05139,
16
+ author = {Amelie Royer and
17
+ Konstantinos Bousmalis and
18
+ Stephan Gouws and
19
+ Fred Bertsch and
20
+ Inbar Mosseri and
21
+ Forrester Cole and
22
+ Kevin Murphy},
23
+ title = {{XGAN:} Unsupervised Image-to-Image Translation for many-to-many Mappings},
24
+ journal = {CoRR},
25
+ volume = {abs/1711.05139},
26
+ year = {2017},
27
+ url = {http://arxiv.org/abs/1711.05139},
28
+ eprinttype = {arXiv},
29
+ eprint = {1711.05139},
30
+ timestamp = {Mon, 13 Aug 2018 16:47:38 +0200},
31
+ biburl = {https://dblp.org/rec/journals/corr/abs-1711-05139.bib},
32
+ bibsource = {dblp computer science bibliography, https://dblp.org}
33
  }
34
  """
35
 
36
  _DESCRIPTION = """\
37
+ Cartoon Set is a collection of random, 2D cartoon avatar images. The cartoons vary in 10 artwork
38
+ categories, 4 color categories, and 4 proportion categories, with a total of ~1013 possible
39
+ combinations. We provide sets of 10k and 100k randomly chosen cartoons and labeled attributes.
40
  """
41
 
42
  _DATA_URLS = {
 
59
  datasets.BuilderConfig(
60
  name="100k",
61
  version=datasets.Version("1.0.0", ""),
62
+ description="Loads the Cartoonset-100k Data Set",
63
  ),
64
  ]
65
 
 
71
  features=datasets.Features(
72
  {
73
  "img": datasets.Image(),
 
74
  }
75
  ),
76
  supervised_keys=("img",),
77
  homepage="https://www.cs.toronto.edu/~kriz/cifar.html",
78
  citation=_CITATION,
 
 
 
79
  )
80
 
81
  def _split_generators(self, dl_manager: datasets.DownloadManager):
82
  url = _DATA_URLS[self.config.name]
83
  print("URL:", url)
 
 
 
 
84
 
85
  return [
86
  datasets.SplitGenerator(
 
90
  "split": "train",
91
  },
92
  ),
 
 
 
93
  ]
94
 
95
  def _generate_examples(self, files, split):
96
  """This function returns the examples in the raw (text) form."""
97
 
 
 
 
 
 
 
 
 
98
  path: str
99
  for path, file_obj in files:
100
 
101
  if path.endswith(".png"):
102
+ image = PIL.Image.open(file_obj)
103
 
104
  yield path, {
105
+ "img": image,
106
  }