yourusername
commited on
Commit
•
df4232b
0
Parent(s):
:tada: init
Browse files- README.md +168 -0
- cats_vs_dogs.py +83 -0
- dataset_infos.json +1 -0
README.md
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
pretty_name: Cats and Dogs
|
13 |
+
size_categories:
|
14 |
+
- 10K<n<100K
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- other
|
19 |
+
task_ids:
|
20 |
+
- other-other-image-classification
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for Cats Vs. Dogs
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Table of Contents](#table-of-contents)
|
27 |
+
- [Dataset Description](#dataset-description)
|
28 |
+
- [Dataset Summary](#dataset-summary)
|
29 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
30 |
+
- [Languages](#languages)
|
31 |
+
- [Dataset Structure](#dataset-structure)
|
32 |
+
- [Data Instances](#data-instances)
|
33 |
+
- [Data Fields](#data-fields)
|
34 |
+
- [Data Splits](#data-splits)
|
35 |
+
- [Dataset Creation](#dataset-creation)
|
36 |
+
- [Curation Rationale](#curation-rationale)
|
37 |
+
- [Source Data](#source-data)
|
38 |
+
- [Annotations](#annotations)
|
39 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
40 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
41 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
42 |
+
- [Discussion of Biases](#discussion-of-biases)
|
43 |
+
- [Other Known Limitations](#other-known-limitations)
|
44 |
+
- [Additional Information](#additional-information)
|
45 |
+
- [Dataset Curators](#dataset-curators)
|
46 |
+
- [Licensing Information](#licensing-information)
|
47 |
+
- [Citation Information](#citation-information)
|
48 |
+
- [Contributions](#contributions)
|
49 |
+
|
50 |
+
## Dataset Description
|
51 |
+
|
52 |
+
- **Homepage:**[Cats vs Dogs Dataset](https://www.microsoft.com/en-us/download/details.aspx?id=54765)
|
53 |
+
- **Repository:** N/A
|
54 |
+
- **Paper:**[Paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2007/10/CCS2007.pdf)
|
55 |
+
- **Leaderboard:** N/A
|
56 |
+
- **Point of Contact:** N/A
|
57 |
+
|
58 |
+
### Dataset Summary
|
59 |
+
|
60 |
+
A large set of images of cats and dogs. There are 1738 corrupted images that are dropped.
|
61 |
+
|
62 |
+
### Supported Tasks and Leaderboards
|
63 |
+
|
64 |
+
- image-classification
|
65 |
+
|
66 |
+
### Languages
|
67 |
+
|
68 |
+
English
|
69 |
+
|
70 |
+
## Dataset Structure
|
71 |
+
|
72 |
+
### Data Instances
|
73 |
+
|
74 |
+
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 |
+
```
|
82 |
+
|
83 |
+
### Data Fields
|
84 |
+
|
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 |
+
### Data Splits
|
91 |
+
|
92 |
+
|
93 |
+
| name |train|
|
94 |
+
|----------|----:|
|
95 |
+
|cats_and_dogs|23410|
|
96 |
+
|
97 |
+
## Dataset Creation
|
98 |
+
|
99 |
+
### Curation Rationale
|
100 |
+
|
101 |
+
[More Information Needed]
|
102 |
+
|
103 |
+
### Source Data
|
104 |
+
|
105 |
+
#### Initial Data Collection and Normalization
|
106 |
+
|
107 |
+
[More Information Needed]
|
108 |
+
|
109 |
+
#### Who are the source language producers?
|
110 |
+
|
111 |
+
[More Information Needed]
|
112 |
+
|
113 |
+
### Annotations
|
114 |
+
|
115 |
+
#### Annotation process
|
116 |
+
|
117 |
+
[More Information Needed]
|
118 |
+
|
119 |
+
#### Who are the annotators?
|
120 |
+
|
121 |
+
[More Information Needed]
|
122 |
+
|
123 |
+
### Personal and Sensitive Information
|
124 |
+
|
125 |
+
[More Information Needed]
|
126 |
+
|
127 |
+
## Considerations for Using the Data
|
128 |
+
|
129 |
+
### Social Impact of Dataset
|
130 |
+
|
131 |
+
[More Information Needed]
|
132 |
+
|
133 |
+
### Discussion of Biases
|
134 |
+
|
135 |
+
[More Information Needed]
|
136 |
+
|
137 |
+
### Other Known Limitations
|
138 |
+
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
## Additional Information
|
142 |
+
|
143 |
+
### Dataset Curators
|
144 |
+
|
145 |
+
[More Information Needed]
|
146 |
+
|
147 |
+
### Licensing Information
|
148 |
+
|
149 |
+
[More Information Needed]
|
150 |
+
|
151 |
+
### Citation Information
|
152 |
+
|
153 |
+
```
|
154 |
+
@Inproceedings (Conference){asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization,
|
155 |
+
author = {Elson, Jeremy and Douceur, John (JD) and Howell, Jon and Saul, Jared},
|
156 |
+
title = {Asirra: A CAPTCHA that Exploits Interest-Aligned Manual Image Categorization},
|
157 |
+
booktitle = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
|
158 |
+
year = {2007},
|
159 |
+
month = {October},
|
160 |
+
publisher = {Association for Computing Machinery, Inc.},
|
161 |
+
url = {https://www.microsoft.com/en-us/research/publication/asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization/},
|
162 |
+
edition = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
|
163 |
+
}
|
164 |
+
```
|
165 |
+
|
166 |
+
### Contributions
|
167 |
+
|
168 |
+
Thanks to [@nateraw](https://github.com/nateraw) for adding this dataset.
|
cats_vs_dogs.py
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
"""The Microsoft Cats vs. Dogs dataset"""
|
16 |
+
|
17 |
+
from pathlib import Path
|
18 |
+
from typing import List
|
19 |
+
|
20 |
+
import datasets
|
21 |
+
from datasets.tasks import ImageClassification
|
22 |
+
|
23 |
+
|
24 |
+
logger = datasets.logging.get_logger(__name__)
|
25 |
+
|
26 |
+
_URL = "https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip"
|
27 |
+
|
28 |
+
_HOMEPAGE = "https://www.microsoft.com/en-us/download/details.aspx?id=54765"
|
29 |
+
|
30 |
+
_DESCRIPTION = "A large set of images of cats and dogs. There are 1738 corrupted images that are dropped."
|
31 |
+
|
32 |
+
_CITATION = """\
|
33 |
+
@Inproceedings (Conference){asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization,
|
34 |
+
author = {Elson, Jeremy and Douceur, John (JD) and Howell, Jon and Saul, Jared},
|
35 |
+
title = {Asirra: A CAPTCHA that Exploits Interest-Aligned Manual Image Categorization},
|
36 |
+
booktitle = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
|
37 |
+
year = {2007},
|
38 |
+
month = {October},
|
39 |
+
publisher = {Association for Computing Machinery, Inc.},
|
40 |
+
url = {https://www.microsoft.com/en-us/research/publication/asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization/},
|
41 |
+
edition = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
|
42 |
+
}
|
43 |
+
"""
|
44 |
+
|
45 |
+
|
46 |
+
class CatsVsDogs(datasets.GeneratorBasedBuilder):
|
47 |
+
def _info(self):
|
48 |
+
return datasets.DatasetInfo(
|
49 |
+
description=_DESCRIPTION,
|
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 |
+
)
|
65 |
+
|
66 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
67 |
+
images_path = Path(dl_manager.download_and_extract(_URL)) / "PetImages"
|
68 |
+
return [
|
69 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"images_path": images_path}),
|
70 |
+
]
|
71 |
+
|
72 |
+
def _generate_examples(self, images_path):
|
73 |
+
logger.info("generating examples from = %s", images_path)
|
74 |
+
labels = self.info.features["labels"]
|
75 |
+
for i, filepath in enumerate(images_path.glob("**/*.jpg")):
|
76 |
+
with filepath.open("rb") as f:
|
77 |
+
if b"JFIF" not in f.peek(10):
|
78 |
+
filepath.unlink()
|
79 |
+
continue
|
80 |
+
yield str(i), {
|
81 |
+
"image_file_path": str(filepath),
|
82 |
+
"labels": labels.encode_example(filepath.parent.name.lower()),
|
83 |
+
}
|
dataset_infos.json
ADDED
@@ -0,0 +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}}
|