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
175 changes: 175 additions & 0 deletions datasets/beans/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
---
annotations_creators:
- expert-generated
language_creators:
- expert-generated
languages:
- en
licenses:
- mit
multilinguality:
- monolingual
pretty_name: Beans
size_categories:
- 1K<n<10K
source_datasets:
- original
task_categories:
- other
task_ids:
- other-other-image-classification
---

# Dataset Card for Beans

## 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:** [Beans Homepage](https://github.com/AI-Lab-Makerere/ibean/)
- **Repository:** [AI-Lab-Makerere/ibean](https://github.com/AI-Lab-Makerere/ibean/)
- **Paper:** N/A
- **Leaderboard:** N/A
- **Point of Contact:** N/A

### Dataset Summary

Beans leaf dataset with images of diseased and health leaves.

### Supported Tasks and Leaderboards

- image-classification

### Languages

English

## Dataset Structure

### Data Instances

A sample from the training set is provided below:

```
{
'image_file_path': '/root/.cache/huggingface/datasets/downloads/extracted/0aaa78294d4bf5114f58547e48d91b7826649919505379a167decb629aa92b0a/train/bean_rust/bean_rust_train.109.jpg',
'labels': 1
}
```

### 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:

```json
{
"angular_leaf_spot": 0,
"bean_rust": 1,
"healthy": 2,
}
```

### Data Splits


| |train|validation|test|
|-------------|----:|---------:|---:|
|# of examples|1034 |133 |128 |

## 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

```
@ONLINE {beansdata,
author="Makerere AI Lab",
title="Bean disease dataset",
month="January",
year="2020",
url="https://github.com/AI-Lab-Makerere/ibean/"
}
```

### Contributions

Thanks to [@nateraw](https://github.com/nateraw) for adding this dataset.
100 changes: 100 additions & 0 deletions datasets/beans/beans.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 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.
"""Beans leaf dataset with images of diseased and health leaves."""

from pathlib import Path

import datasets
from datasets.tasks import ImageClassification


_HOMEPAGE = "https://github.com/AI-Lab-Makerere/ibean/"

_CITATION = """\
@ONLINE {beansdata,
author="Makerere AI Lab",
title="Bean disease dataset",
month="January",
year="2020",
url="https://github.com/AI-Lab-Makerere/ibean/"
}
"""

_DESCRIPTION = """\
Beans is a dataset of images of beans taken in the field using smartphone
cameras. It consists of 3 classes: 2 disease classes and the healthy class.
Diseases depicted include Angular Leaf Spot and Bean Rust. Data was annotated
by experts from the National Crops Resources Research Institute (NaCRRI) in
Uganda and collected by the Makerere AI research lab.
"""

_URLS = {
"train": "https://storage.googleapis.com/ibeans/train.zip",
"validation": "https://storage.googleapis.com/ibeans/validation.zip",
"test": "https://storage.googleapis.com/ibeans/test.zip",
}

_NAMES = ["angular_leaf_spot", "bean_rust", "healthy"]


class Beans(datasets.GeneratorBasedBuilder):
"""Beans plant leaf images dataset."""

def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"image_file_path": datasets.Value("string"),
"labels": datasets.features.ClassLabel(names=sorted(tuple(_NAMES))),
}
),
supervised_keys=("image_file_path", "labels"),
homepage=_HOMEPAGE,
citation=_CITATION,
task_templates=[
ImageClassification(
image_file_path_column="image_file_path", label_column="labels", labels=sorted(tuple(_NAMES))
)
],
)

def _split_generators(self, dl_manager):
data_files = dl_manager.download_and_extract(_URLS)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={
"archive": data_files["train"],
},
),
datasets.SplitGenerator(
name=datasets.Split.VALIDATION,
gen_kwargs={
"archive": data_files["validation"],
},
),
datasets.SplitGenerator(
name=datasets.Split.TEST,
gen_kwargs={
"archive": data_files["test"],
},
),
]

def _generate_examples(self, archive):
for i, path in enumerate(Path(archive).glob("**/*")):
if path.suffix == ".jpg":
yield i, dict(image_file_path=str(path), labels=path.parent.name.lower())
1 change: 1 addition & 0 deletions datasets/beans/dataset_infos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"default": {"description": "Beans is a dataset of images of beans taken in the field using smartphone\ncameras. It consists of 3 classes: 2 disease classes and the healthy class.\nDiseases depicted include Angular Leaf Spot and Bean Rust. Data was annotated\nby experts from the National Crops Resources Research Institute (NaCRRI) in\nUganda and collected by the Makerere AI research lab.\n", "citation": "@ONLINE {beansdata,\n author=\"Makerere AI Lab\",\n title=\"Bean disease dataset\",\n month=\"January\",\n year=\"2020\",\n url=\"https://github.com/AI-Lab-Makerere/ibean/\"\n}\n", "homepage": "https://github.com/AI-Lab-Makerere/ibean/", "license": "", "features": {"image_file_path": {"dtype": "string", "id": null, "_type": "Value"}, "labels": {"num_classes": 3, "names": ["angular_leaf_spot", "bean_rust", "healthy"], "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": ["angular_leaf_spot", "bean_rust", "healthy"]}], "builder_name": "beans", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 188916, "num_examples": 1034, "dataset_name": "beans"}, "validation": {"name": "validation", "num_bytes": 24575, "num_examples": 133, "dataset_name": "beans"}, "test": {"name": "test", "num_bytes": 23022, "num_examples": 128, "dataset_name": "beans"}}, "download_checksums": {"https://storage.googleapis.com/ibeans/train.zip": {"num_bytes": 143812152, "checksum": "284fe8456ce20687f4367ae7ad94a64577e7f9fde2c2c6b1c74340ab5dc82715"}, "https://storage.googleapis.com/ibeans/validation.zip": {"num_bytes": 18504213, "checksum": "90b7aa1c26d91d9afff07a30bbc67a5ea34f1f1397f068d8675be09d7d0c602d"}, "https://storage.googleapis.com/ibeans/test.zip": {"num_bytes": 17708541, "checksum": "ca67b15d960d1e2fd9d23fd8498ce86818ead90755c630a43baf19ec4af09312"}}, "download_size": 180024906, "post_processing_size": null, "dataset_size": 236513, "size_in_bytes": 180261419}}
Binary file added datasets/beans/dummy/0.0.0/dummy_data.zip
Binary file not shown.