system HF staff commited on
Commit
cf7c2d4
1 Parent(s): 505916b

Update files from the datasets library (from 1.14.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.14.0

Files changed (4) hide show
  1. README.md +10 -1
  2. dataset_infos.json +1 -1
  3. dummy/0.0.0/dummy_data.zip +2 -2
  4. food101.py +42 -18
README.md CHANGED
@@ -259,7 +259,16 @@ The data instances have the following fields:
259
 
260
  ### Licensing Information
261
 
262
- [More Information Needed]
 
 
 
 
 
 
 
 
 
263
 
264
  ### Citation Information
265
 
 
259
 
260
  ### Licensing Information
261
 
262
+ LICENSE AGREEMENT
263
+ =================
264
+ - The Food-101 data set consists of images from Foodspotting [1] which are not
265
+ property of the Federal Institute of Technology Zurich (ETHZ). Any use beyond
266
+ scientific fair use must be negociated with the respective picture owners
267
+ according to the Foodspotting terms of use [2].
268
+
269
+ [1] http://www.foodspotting.com/
270
+ [2] http://www.foodspotting.com/terms/
271
+
272
 
273
  ### Citation Information
274
 
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"default": {"description": "This dataset consists of 101 food categories, with 101'000 images. For each class, 250 manually reviewed test images are provided as well as 750 training images. On purpose, the training images were not cleaned, and thus still contain some amount of noise. This comes mostly in the form of intense colors and sometimes wrong labels. All images were rescaled to have a maximum side length of 512 pixels.", "citation": " @inproceedings{bossard14,\n title = {Food-101 -- Mining Discriminative Components with Random Forests},\n author = {Bossard, Lukas and Guillaumin, Matthieu and Van Gool, Luc},\n booktitle = {European Conference on Computer Vision},\n year = {2014}\n}\n", "homepage": "https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/", "license": "", "features": {"image": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 101, "names": ["apple_pie", "baby_back_ribs", "baklava", "beef_carpaccio", "beef_tartare", "beet_salad", "beignets", "bibimbap", "bread_pudding", "breakfast_burrito", "bruschetta", "caesar_salad", "cannoli", "caprese_salad", "carrot_cake", "ceviche", "cheesecake", "cheese_plate", "chicken_curry", "chicken_quesadilla", "chicken_wings", "chocolate_cake", "chocolate_mousse", "churros", "clam_chowder", "club_sandwich", "crab_cakes", "creme_brulee", "croque_madame", "cup_cakes", "deviled_eggs", "donuts", "dumplings", "edamame", "eggs_benedict", "escargots", "falafel", "filet_mignon", "fish_and_chips", "foie_gras", "french_fries", "french_onion_soup", "french_toast", "fried_calamari", "fried_rice", "frozen_yogurt", "garlic_bread", "gnocchi", "greek_salad", "grilled_cheese_sandwich", "grilled_salmon", "guacamole", "gyoza", "hamburger", "hot_and_sour_soup", "hot_dog", "huevos_rancheros", "hummus", "ice_cream", "lasagna", "lobster_bisque", "lobster_roll_sandwich", "macaroni_and_cheese", "macarons", "miso_soup", "mussels", "nachos", "omelette", "onion_rings", "oysters", "pad_thai", "paella", "pancakes", "panna_cotta", "peking_duck", "pho", "pizza", "pork_chop", "poutine", "prime_rib", "pulled_pork_sandwich", "ramen", "ravioli", "red_velvet_cake", "risotto", "samosa", "sashimi", "scallops", "seaweed_salad", "shrimp_and_grits", "spaghetti_bolognese", "spaghetti_carbonara", "spring_rolls", "steak", "strawberry_shortcake", "sushi", "tacos", "takoyaki", "tiramisu", "tuna_tartare", "waffles"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "image", "output": "label"}, "task_templates": [{"task": "image-classification", "image_file_path_column": "image", "label_column": "label", "labels": ["apple_pie", "baby_back_ribs", "baklava", "beef_carpaccio", "beef_tartare", "beet_salad", "beignets", "bibimbap", "bread_pudding", "breakfast_burrito", "bruschetta", "caesar_salad", "cannoli", "caprese_salad", "carrot_cake", "ceviche", "cheese_plate", "cheesecake", "chicken_curry", "chicken_quesadilla", "chicken_wings", "chocolate_cake", "chocolate_mousse", "churros", "clam_chowder", "club_sandwich", "crab_cakes", "creme_brulee", "croque_madame", "cup_cakes", "deviled_eggs", "donuts", "dumplings", "edamame", "eggs_benedict", "escargots", "falafel", "filet_mignon", "fish_and_chips", "foie_gras", "french_fries", "french_onion_soup", "french_toast", "fried_calamari", "fried_rice", "frozen_yogurt", "garlic_bread", "gnocchi", "greek_salad", "grilled_cheese_sandwich", "grilled_salmon", "guacamole", "gyoza", "hamburger", "hot_and_sour_soup", "hot_dog", "huevos_rancheros", "hummus", "ice_cream", "lasagna", "lobster_bisque", "lobster_roll_sandwich", "macaroni_and_cheese", "macarons", "miso_soup", "mussels", "nachos", "omelette", "onion_rings", "oysters", "pad_thai", "paella", "pancakes", "panna_cotta", "peking_duck", "pho", "pizza", "pork_chop", "poutine", "prime_rib", "pulled_pork_sandwich", "ramen", "ravioli", "red_velvet_cake", "risotto", "samosa", "sashimi", "scallops", "seaweed_salad", "shrimp_and_grits", "spaghetti_bolognese", "spaghetti_carbonara", "spring_rolls", "steak", "strawberry_shortcake", "sushi", "tacos", "takoyaki", "tiramisu", "tuna_tartare", "waffles"]}], "builder_name": "food101", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 13210094, "num_examples": 75750, "dataset_name": "food101"}, "validation": {"name": "validation", "num_bytes": 4403191, "num_examples": 25250, "dataset_name": "food101"}}, "download_checksums": {"http://data.vision.ee.ethz.ch/cvl/food-101.tar.gz": {"num_bytes": 4996278331, "checksum": "d97d15e438b7f4498f96086a4f7e2fa42a32f2712e87d3295441b2b6314053a4"}}, "download_size": 4996278331, "post_processing_size": null, "dataset_size": 17613285, "size_in_bytes": 5013891616}}
 
1
+ {"default": {"description": "This dataset consists of 101 food categories, with 101'000 images. For each class, 250 manually reviewed test images are provided as well as 750 training images. On purpose, the training images were not cleaned, and thus still contain some amount of noise. This comes mostly in the form of intense colors and sometimes wrong labels. All images were rescaled to have a maximum side length of 512 pixels.", "citation": " @inproceedings{bossard14,\n title = {Food-101 -- Mining Discriminative Components with Random Forests},\n author = {Bossard, Lukas and Guillaumin, Matthieu and Van Gool, Luc},\n booktitle = {European Conference on Computer Vision},\n year = {2014}\n}\n", "homepage": "https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/", "license": "LICENSE AGREEMENT\n=================\n - The Food-101 data set consists of images from Foodspotting [1] which are not\n property of the Federal Institute of Technology Zurich (ETHZ). Any use beyond\n scientific fair use must be negociated with the respective picture owners\n according to the Foodspotting terms of use [2].\n\n[1] http://www.foodspotting.com/\n[2] http://www.foodspotting.com/terms/\n", "features": {"image": {"filename": {"dtype": "string", "id": null, "_type": "Value"}, "data": {"dtype": "binary", "id": null, "_type": "Value"}}, "label": {"num_classes": 101, "names": ["apple_pie", "baby_back_ribs", "baklava", "beef_carpaccio", "beef_tartare", "beet_salad", "beignets", "bibimbap", "bread_pudding", "breakfast_burrito", "bruschetta", "caesar_salad", "cannoli", "caprese_salad", "carrot_cake", "ceviche", "cheesecake", "cheese_plate", "chicken_curry", "chicken_quesadilla", "chicken_wings", "chocolate_cake", "chocolate_mousse", "churros", "clam_chowder", "club_sandwich", "crab_cakes", "creme_brulee", "croque_madame", "cup_cakes", "deviled_eggs", "donuts", "dumplings", "edamame", "eggs_benedict", "escargots", "falafel", "filet_mignon", "fish_and_chips", "foie_gras", "french_fries", "french_onion_soup", "french_toast", "fried_calamari", "fried_rice", "frozen_yogurt", "garlic_bread", "gnocchi", "greek_salad", "grilled_cheese_sandwich", "grilled_salmon", "guacamole", "gyoza", "hamburger", "hot_and_sour_soup", "hot_dog", "huevos_rancheros", "hummus", "ice_cream", "lasagna", "lobster_bisque", "lobster_roll_sandwich", "macaroni_and_cheese", "macarons", "miso_soup", "mussels", "nachos", "omelette", "onion_rings", "oysters", "pad_thai", "paella", "pancakes", "panna_cotta", "peking_duck", "pho", "pizza", "pork_chop", "poutine", "prime_rib", "pulled_pork_sandwich", "ramen", "ravioli", "red_velvet_cake", "risotto", "samosa", "sashimi", "scallops", "seaweed_salad", "shrimp_and_grits", "spaghetti_bolognese", "spaghetti_carbonara", "spring_rolls", "steak", "strawberry_shortcake", "sushi", "tacos", "takoyaki", "tiramisu", "tuna_tartare", "waffles"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "image", "output": "label"}, "task_templates": null, "builder_name": "food101", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3843765322, "num_examples": 75750, "dataset_name": "food101"}, "validation": {"name": "validation", "num_bytes": 1275549954, "num_examples": 25250, "dataset_name": "food101"}}, "download_checksums": {"http://data.vision.ee.ethz.ch/cvl/food-101.tar.gz": {"num_bytes": 4996278331, "checksum": "d97d15e438b7f4498f96086a4f7e2fa42a32f2712e87d3295441b2b6314053a4"}, "https://s3.amazonaws.com/datasets.huggingface.co/food101/meta/train.txt": {"num_bytes": 1468812, "checksum": "2920f7d55473974492b41a01241ccfd71df1b74d29d27b617337f840f58f77ab"}, "https://s3.amazonaws.com/datasets.huggingface.co/food101/meta/test.txt": {"num_bytes": 489429, "checksum": "440d53374697d019a972fe66e8e44031ae80267a126ecb814ad537ec1fd506db"}}, "download_size": 4998236572, "post_processing_size": null, "dataset_size": 5119315276, "size_in_bytes": 10117551848}}
dummy/0.0.0/dummy_data.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c75fa3428f1705c7b7390392422b3a952a18beddcde785af2663dd96bc84571b
3
- size 715637
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65c32f851cd9ed4131896fea0254b6cb8adb8a9dab1b82a0adec5b8ef1af70b1
3
+ size 348186
food101.py CHANGED
@@ -14,15 +14,16 @@
14
  # limitations under the License.
15
  """Dataset class for Food-101 dataset."""
16
 
17
- import json
18
- from pathlib import Path
19
-
20
  import datasets
21
- from datasets.tasks import ImageClassification
22
 
23
 
24
  _BASE_URL = "http://data.vision.ee.ethz.ch/cvl/food-101.tar.gz"
25
 
 
 
 
 
 
26
  _HOMEPAGE = "https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/"
27
 
28
  _DESCRIPTION = (
@@ -43,6 +44,18 @@ _CITATION = """\
43
  }
44
  """
45
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  _NAMES = [
47
  "apple_pie",
48
  "baby_back_ribs",
@@ -147,6 +160,8 @@ _NAMES = [
147
  "waffles",
148
  ]
149
 
 
 
150
 
151
  class Food101(datasets.GeneratorBasedBuilder):
152
  """Food-101 Images dataset."""
@@ -156,36 +171,45 @@ class Food101(datasets.GeneratorBasedBuilder):
156
  description=_DESCRIPTION,
157
  features=datasets.Features(
158
  {
159
- "image": datasets.Value("string"),
160
  "label": datasets.features.ClassLabel(names=_NAMES),
161
  }
162
  ),
163
  supervised_keys=("image", "label"),
164
  homepage=_HOMEPAGE,
165
- task_templates=[ImageClassification(image_file_path_column="image", label_column="label", labels=_NAMES)],
166
  citation=_CITATION,
 
167
  )
168
 
169
  def _split_generators(self, dl_manager):
170
- dl_path = Path(dl_manager.download_and_extract(_BASE_URL))
171
- meta_path = dl_path / "food-101" / "meta"
172
- image_dir_path = dl_path / "food-101" / "images"
173
  return [
174
  datasets.SplitGenerator(
175
  name=datasets.Split.TRAIN,
176
- gen_kwargs={"json_file_path": meta_path / "train.json", "image_dir_path": image_dir_path},
 
 
 
177
  ),
178
  datasets.SplitGenerator(
179
  name=datasets.Split.VALIDATION,
180
- gen_kwargs={"json_file_path": meta_path / "test.json", "image_dir_path": image_dir_path},
 
 
 
181
  ),
182
  ]
183
 
184
- def _generate_examples(self, json_file_path, image_dir_path):
185
  """Generate images and labels for splits."""
186
- data = json.loads(json_file_path.read_text())
187
- for label, images in data.items():
188
- for image_name in images:
189
- image = image_dir_path / f"{image_name}.jpg"
190
- features = {"image": str(image), "label": label}
191
- yield image_name, features
 
 
 
 
 
14
  # limitations under the License.
15
  """Dataset class for Food-101 dataset."""
16
 
 
 
 
17
  import datasets
 
18
 
19
 
20
  _BASE_URL = "http://data.vision.ee.ethz.ch/cvl/food-101.tar.gz"
21
 
22
+ _METADATA_URLS = {
23
+ "train": "https://s3.amazonaws.com/datasets.huggingface.co/food101/meta/train.txt",
24
+ "test": "https://s3.amazonaws.com/datasets.huggingface.co/food101/meta/test.txt",
25
+ }
26
+
27
  _HOMEPAGE = "https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/"
28
 
29
  _DESCRIPTION = (
 
44
  }
45
  """
46
 
47
+ _LICENSE = """\
48
+ LICENSE AGREEMENT
49
+ =================
50
+ - The Food-101 data set consists of images from Foodspotting [1] which are not
51
+ property of the Federal Institute of Technology Zurich (ETHZ). Any use beyond
52
+ scientific fair use must be negociated with the respective picture owners
53
+ according to the Foodspotting terms of use [2].
54
+
55
+ [1] http://www.foodspotting.com/
56
+ [2] http://www.foodspotting.com/terms/
57
+ """
58
+
59
  _NAMES = [
60
  "apple_pie",
61
  "baby_back_ribs",
 
160
  "waffles",
161
  ]
162
 
163
+ _IMAGES_DIR = "food-101/images/"
164
+
165
 
166
  class Food101(datasets.GeneratorBasedBuilder):
167
  """Food-101 Images dataset."""
 
171
  description=_DESCRIPTION,
172
  features=datasets.Features(
173
  {
174
+ "image": {"filename": datasets.Value("string"), "data": datasets.Value("binary")},
175
  "label": datasets.features.ClassLabel(names=_NAMES),
176
  }
177
  ),
178
  supervised_keys=("image", "label"),
179
  homepage=_HOMEPAGE,
 
180
  citation=_CITATION,
181
+ license=_LICENSE,
182
  )
183
 
184
  def _split_generators(self, dl_manager):
185
+ archive_path = dl_manager.download(_BASE_URL)
186
+ split_metadata_paths = dl_manager.download(_METADATA_URLS)
 
187
  return [
188
  datasets.SplitGenerator(
189
  name=datasets.Split.TRAIN,
190
+ gen_kwargs={
191
+ "images": dl_manager.iter_archive(archive_path),
192
+ "metadata_path": split_metadata_paths["train"],
193
+ },
194
  ),
195
  datasets.SplitGenerator(
196
  name=datasets.Split.VALIDATION,
197
+ gen_kwargs={
198
+ "images": dl_manager.iter_archive(archive_path),
199
+ "metadata_path": split_metadata_paths["test"],
200
+ },
201
  ),
202
  ]
203
 
204
+ def _generate_examples(self, images, metadata_path):
205
  """Generate images and labels for splits."""
206
+ with open(metadata_path, encoding="utf-8") as f:
207
+ files_to_keep = set(f.read().split("\n"))
208
+ for file_path, file_obj in images:
209
+ if file_path.startswith(_IMAGES_DIR):
210
+ if file_path[len(_IMAGES_DIR) : -len(".jpg")] in files_to_keep:
211
+ label = file_path.split("/")[2]
212
+ yield file_path, {
213
+ "image": {"filename": file_path.split("/")[-1], "data": file_obj.read()},
214
+ "label": label,
215
+ }