system HF staff commited on
Commit
83f35c9
1 Parent(s): cf7c2d4

Update files from the datasets library (from 1.17.0)

Browse files

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

Files changed (3) hide show
  1. README.md +2 -2
  2. dataset_infos.json +1 -1
  3. food101.py +5 -3
README.md CHANGED
@@ -76,7 +76,7 @@ A sample from the training set is provided below:
76
 
77
  ```
78
  {
79
- 'image': '/root/.cache/huggingface/datasets/downloads/extracted/6e1e8c9052e9f3f7ecbcb4b90860668f81c1d36d86cc9606d49066f8da8bfb4f/food-101/images/churros/1004234.jpg',
80
  'label': 23
81
  }
82
  ```
@@ -85,7 +85,7 @@ A sample from the training set is provided below:
85
 
86
  The data instances have the following fields:
87
 
88
- - `image`: a `string` filepath to an image.
89
  - `label`: an `int` classification label.
90
 
91
  <details>
 
76
 
77
  ```
78
  {
79
+ 'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=384x512 at 0x276021C5EB8>,
80
  'label': 23
81
  }
82
  ```
 
85
 
86
  The data instances have the following fields:
87
 
88
+ - `image`: A `PIL.Image.Image` object containing the image. Note that when accessing the image column: `dataset[0]["image"]` the image file is automatically decoded. Decoding of a large number of image files might take a significant amount of time. Thus it is important to first query the sample index before the `"image"` column, *i.e.* `dataset[0]["image"]` should **always** be preferred over `dataset["image"][0]`.
89
  - `label`: an `int` classification label.
90
 
91
  <details>
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": "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}}
 
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": {"id": null, "_type": "Image"}, "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_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": 3845865322, "num_examples": 75750, "dataset_name": "food101"}, "validation": {"name": "validation", "num_bytes": 1276249954, "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": 5122115276, "size_in_bytes": 10120351848}}
food101.py CHANGED
@@ -15,6 +15,7 @@
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"
@@ -171,14 +172,15 @@ class Food101(datasets.GeneratorBasedBuilder):
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):
@@ -210,6 +212,6 @@ class Food101(datasets.GeneratorBasedBuilder):
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
  }
 
15
  """Dataset class for Food-101 dataset."""
16
 
17
  import datasets
18
+ from datasets.tasks import ImageClassification
19
 
20
 
21
  _BASE_URL = "http://data.vision.ee.ethz.ch/cvl/food-101.tar.gz"
 
172
  description=_DESCRIPTION,
173
  features=datasets.Features(
174
  {
175
+ "image": datasets.Image(),
176
+ "label": datasets.ClassLabel(names=_NAMES),
177
  }
178
  ),
179
  supervised_keys=("image", "label"),
180
  homepage=_HOMEPAGE,
181
  citation=_CITATION,
182
  license=_LICENSE,
183
+ task_templates=[ImageClassification(image_column="image", label_column="label", labels=_NAMES)],
184
  )
185
 
186
  def _split_generators(self, dl_manager):
 
212
  if file_path[len(_IMAGES_DIR) : -len(".jpg")] in files_to_keep:
213
  label = file_path.split("/")[2]
214
  yield file_path, {
215
+ "image": {"path": file_path, "bytes": file_obj.read()},
216
  "label": label,
217
  }