system HF staff commited on
Commit
aae2beb
1 Parent(s): d0a16ec

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 +3 -1
  2. cats_vs_dogs.py +4 -6
  3. dataset_infos.json +1 -1
README.md CHANGED
@@ -75,7 +75,8 @@ A sample from the training set is provided below:
75
 
76
  ```
77
  {
78
- 'image': '/root/.cache/huggingface/datasets/downloads/extracted/6e1e8c9052e9f3f7ecbcb4b90860668f81c1d36d86cc9606d49066f8da8bfb4f/PetImages/Cat/1.jpg',
 
79
  'label': 0
80
  }
81
  ```
@@ -85,6 +86,7 @@ A sample from the training set is provided below:
85
  The data instances have the following fields:
86
 
87
  - `image_file_path`: a `string` filepath to an image.
 
88
  - `labels`: an `int` classification label.
89
 
90
  Class Label Mappings:
 
75
 
76
  ```
77
  {
78
+ 'image_file_path': '/root/.cache/huggingface/datasets/downloads/extracted/6e1e8c9052e9f3f7ecbcb4b90860668f81c1d36d86cc9606d49066f8da8bfb4f/PetImages/Cat/1.jpg',
79
+ 'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=500x375 at 0x29CEAD71780>,
80
  'label': 0
81
  }
82
  ```
 
86
  The data instances have the following fields:
87
 
88
  - `image_file_path`: a `string` filepath to an image.
89
+ - `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]`.
90
  - `labels`: an `int` classification label.
91
 
92
  Class Label Mappings:
cats_vs_dogs.py CHANGED
@@ -50,15 +50,12 @@ class CatsVsDogs(datasets.GeneratorBasedBuilder):
50
  features=datasets.Features(
51
  {
52
  "image_file_path": datasets.Value("string"),
 
53
  "labels": datasets.features.ClassLabel(names=["cat", "dog"]),
54
  }
55
  ),
56
- supervised_keys=("image_file_path", "labels"),
57
- task_templates=[
58
- ImageClassification(
59
- image_file_path_column="image_file_path", label_column="labels", labels=["cat", "dog"]
60
- )
61
- ],
62
  homepage=_HOMEPAGE,
63
  citation=_CITATION,
64
  )
@@ -76,6 +73,7 @@ class CatsVsDogs(datasets.GeneratorBasedBuilder):
76
  if b"JFIF" in f.peek(10):
77
  yield str(i), {
78
  "image_file_path": str(filepath),
 
79
  "labels": filepath.parent.name.lower(),
80
  }
81
  continue
 
50
  features=datasets.Features(
51
  {
52
  "image_file_path": datasets.Value("string"),
53
+ "image": datasets.Image(),
54
  "labels": datasets.features.ClassLabel(names=["cat", "dog"]),
55
  }
56
  ),
57
+ supervised_keys=("image", "labels"),
58
+ task_templates=[ImageClassification(image_column="image", label_column="labels", labels=["cat", "dog"])],
 
 
 
 
59
  homepage=_HOMEPAGE,
60
  citation=_CITATION,
61
  )
 
73
  if b"JFIF" in f.peek(10):
74
  yield str(i), {
75
  "image_file_path": str(filepath),
76
+ "image": str(filepath),
77
  "labels": filepath.parent.name.lower(),
78
  }
79
  continue
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"default": {"description": "A large set of images of cats and dogs. There are 1738 corrupted images that are dropped.", "citation": "@Inproceedings (Conference){asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization,\n author = {Elson, Jeremy and Douceur, John (JD) and Howell, Jon and Saul, Jared},\n title = {Asirra: A CAPTCHA that Exploits Interest-Aligned Manual Image Categorization},\n booktitle = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},\n year = {2007},\n month = {October},\n publisher = {Association for Computing Machinery, Inc.},\n url = {https://www.microsoft.com/en-us/research/publication/asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization/},\n edition = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},\n}\n", "homepage": "https://www.microsoft.com/en-us/download/details.aspx?id=54765", "license": "", "features": {"image_file_path": {"dtype": "string", "id": null, "_type": "Value"}, "labels": {"num_classes": 2, "names": ["cat", "dog"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "image_file_path", "output": "labels"}, "task_templates": [{"task": "image-classification", "image_file_path_column": "image_file_path", "label_column": "labels", "labels": ["cat", "dog"]}], "builder_name": "cats_vs_dogs", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3701417, "num_examples": 23410, "dataset_name": "cats_vs_dogs"}}, "download_checksums": {"https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip": {"num_bytes": 824894548, "checksum": "f9553e426bd725354ed3a27e3c6920caadb55c835d1ebd880d2e56d3f1fbb22b"}}, "download_size": 824894548, "post_processing_size": null, "dataset_size": 3701417, "size_in_bytes": 828595965}}
 
1
+ {"default": {"description": "A large set of images of cats and dogs. There are 1738 corrupted images that are dropped.", "citation": "@Inproceedings (Conference){asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization,\n author = {Elson, Jeremy and Douceur, John (JD) and Howell, Jon and Saul, Jared},\n title = {Asirra: A CAPTCHA that Exploits Interest-Aligned Manual Image Categorization},\n booktitle = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},\n year = {2007},\n month = {October},\n publisher = {Association for Computing Machinery, Inc.},\n url = {https://www.microsoft.com/en-us/research/publication/asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization/},\n edition = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},\n}\n", "homepage": "https://www.microsoft.com/en-us/download/details.aspx?id=54765", "license": "", "features": {"image_file_path": {"dtype": "string", "id": null, "_type": "Value"}, "image": {"id": null, "_type": "Image"}, "labels": {"num_classes": 2, "names": ["cat", "dog"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "image", "output": "labels"}, "task_templates": [{"task": "image-classification", "image_column": "image", "label_column": "labels", "labels": ["cat", "dog"]}], "builder_name": "cats_vs_dogs", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 7503250, "num_examples": 23422, "dataset_name": "cats_vs_dogs"}}, "download_checksums": {"https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip": {"num_bytes": 824894548, "checksum": "f9553e426bd725354ed3a27e3c6920caadb55c835d1ebd880d2e56d3f1fbb22b"}}, "download_size": 824894548, "post_processing_size": null, "dataset_size": 7503250, "size_in_bytes": 832397798}}