Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 177 additions & 0 deletions datasets/cats_vs_dogs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
---
annotations_creators:
- crowdsourced
language_creators:
- crowdsourced
languages:
- en
licenses:
- unknown
multilinguality:
- monolingual
pretty_name: Cats-vs-Dogs
size_categories:
- 10K<n<100K
source_datasets:
- original
task_categories:
- other
task_ids:
- other-other-image-classification
---

# Dataset Card for Cats Vs. Dogs

## Table of Contents
- [Table of Contents](#table-of-contents)
- [Dataset Description](#dataset-description)
- [Dataset Summary](#dataset-summary)
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
- [Languages](#languages)
- [Dataset Structure](#dataset-structure)
- [Data Instances](#data-instances)
- [Data Fields](#data-fields)
- [Data Splits](#data-splits)
- [Dataset Creation](#dataset-creation)
- [Curation Rationale](#curation-rationale)
- [Source Data](#source-data)
- [Annotations](#annotations)
- [Personal and Sensitive Information](#personal-and-sensitive-information)
- [Considerations for Using the Data](#considerations-for-using-the-data)
- [Social Impact of Dataset](#social-impact-of-dataset)
- [Discussion of Biases](#discussion-of-biases)
- [Other Known Limitations](#other-known-limitations)
- [Additional Information](#additional-information)
- [Dataset Curators](#dataset-curators)
- [Licensing Information](#licensing-information)
- [Citation Information](#citation-information)
- [Contributions](#contributions)

## Dataset Description

- **Homepage:** [Cats vs Dogs Dataset](https://www.microsoft.com/en-us/download/details.aspx?id=54765)
- **Repository:** N/A
- **Paper:** [Paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2007/10/CCS2007.pdf)
- **Leaderboard:** N/A
- **Point of Contact:** N/A

### Dataset Summary

A large set of images of cats and dogs. There are 1738 corrupted images that are dropped.

### Supported Tasks and Leaderboards

- image-classification

### Languages

English

## Dataset Structure

### Data Instances

A sample from the training set is provided below:

```
{
'image': '/root/.cache/huggingface/datasets/downloads/extracted/6e1e8c9052e9f3f7ecbcb4b90860668f81c1d36d86cc9606d49066f8da8bfb4f/PetImages/Cat/1.jpg',
'label': 0
}
```

### Data Fields

The data instances have the following fields:

- `image_file_path`: a `string` filepath to an image.
- `labels`: an `int` classification label.

Class Label Mappings:

```
{
"cat": 0,
"dog": 1,
}
```

### Data Splits


| | train |
|---------------|------:|
| # of examples | 23410 |

## Dataset Creation

### Curation Rationale

[More Information Needed]

### Source Data

#### Initial Data Collection and Normalization

[More Information Needed]

#### Who are the source language producers?

[More Information Needed]

### Annotations

#### Annotation process

[More Information Needed]

#### Who are the annotators?

[More Information Needed]

### Personal and Sensitive Information

[More Information Needed]

## Considerations for Using the Data

### Social Impact of Dataset

[More Information Needed]

### Discussion of Biases

[More Information Needed]

### Other Known Limitations

[More Information Needed]

## Additional Information

### Dataset Curators

[More Information Needed]

### Licensing Information

[More Information Needed]

### Citation Information

```
@Inproceedings (Conference){asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization,
author = {Elson, Jeremy and Douceur, John (JD) and Howell, Jon and Saul, Jared},
title = {Asirra: A CAPTCHA that Exploits Interest-Aligned Manual Image Categorization},
booktitle = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
year = {2007},
month = {October},
publisher = {Association for Computing Machinery, Inc.},
url = {https://www.microsoft.com/en-us/research/publication/asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization/},
edition = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
}
```

### Contributions

Thanks to [@nateraw](https://github.com/nateraw) for adding this dataset.
82 changes: 82 additions & 0 deletions datasets/cats_vs_dogs/cats_vs_dogs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# coding=utf-8
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The Microsoft Cats vs. Dogs dataset"""

from pathlib import Path
from typing import List

import datasets
from datasets.tasks import ImageClassification


logger = datasets.logging.get_logger(__name__)

_URL = "https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip"

_HOMEPAGE = "https://www.microsoft.com/en-us/download/details.aspx?id=54765"

_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,
author = {Elson, Jeremy and Douceur, John (JD) and Howell, Jon and Saul, Jared},
title = {Asirra: A CAPTCHA that Exploits Interest-Aligned Manual Image Categorization},
booktitle = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
year = {2007},
month = {October},
publisher = {Association for Computing Machinery, Inc.},
url = {https://www.microsoft.com/en-us/research/publication/asirra-a-captcha-that-exploits-interest-aligned-manual-image-categorization/},
edition = {Proceedings of 14th ACM Conference on Computer and Communications Security (CCS)},
}
"""


class CatsVsDogs(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"image_file_path": datasets.Value("string"),
"labels": datasets.features.ClassLabel(names=["cat", "dog"]),
}
),
supervised_keys=("image_file_path", "labels"),
task_templates=[
ImageClassification(
image_file_path_column="image_file_path", label_column="labels", labels=["Cat", "Dog"]
)
],
homepage=_HOMEPAGE,
citation=_CITATION,
)

def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
images_path = Path(dl_manager.download_and_extract(_URL)) / "PetImages"
return [
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"images_path": images_path}),
]

def _generate_examples(self, images_path):
logger.info("generating examples from = %s", images_path)
for i, filepath in enumerate(images_path.glob("**/*.jpg")):
with filepath.open("rb") as f:
if b"JFIF" in f.peek(10):
yield str(i), {
"image_file_path": str(filepath),
"labels": filepath.parent.name.lower(),
}
continue
filepath.unlink()
1 change: 1 addition & 0 deletions datasets/cats_vs_dogs/dataset_infos.json
Original file line number Diff line number Diff line change
@@ -0,0 +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}}
Binary file added datasets/cats_vs_dogs/dummy/0.0.0/dummy_data.zip
Binary file not shown.