-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add Beans Dataset #2809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Beans Dataset #2809
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5a6a1dc
:sparkles: add beans dataset
nateraw 9fa1d98
:lipstick: style
nateraw dabc6b0
:art: use str instead of as_posix
nateraw 8a8d686
:bug: fix dummy data
nateraw ea1352e
:memo: Update beans dataset card
nateraw 1bcc082
:fire: remove unnecessary label encoding
nateraw 0455ce8
Apply suggestions from code review
lhoestq 2743951
style
lhoestq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) | ||
lhoestq marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| ], | ||
| ) | ||
|
|
||
| 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()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.