Datasets:
Tasks:
Image Classification
Size:
1K - 10K
keremberke
commited on
Commit
•
15439bd
1
Parent(s):
52dc339
dataset uploaded by roboflow2huggingface package
Browse files- README.dataset.txt +43 -0
- README.md +70 -0
- README.roboflow.txt +16 -0
- chest-xray-classification.py +103 -0
- data/test.zip +3 -0
- data/train.zip +3 -0
- data/valid-mini.zip +3 -0
- data/valid.zip +3 -0
- split_name_to_num_samples.json +1 -0
- thumbnail.jpg +3 -0
README.dataset.txt
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# undefined > resized-640by640
|
2 |
+
https://public.roboflow.ai/classification/undefined
|
3 |
+
|
4 |
+
Provided by undefined
|
5 |
+
License: CC BY 4.0
|
6 |
+
|
7 |
+
### This classification dataset is [from Kaggle](https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia) and was uploaded to Kaggle by [Paul Mooney](https://www.kaggle.com/paultimothymooney).
|
8 |
+
### It contains over 5,000 images of chest x-rays in two categories: "PNEUMONIA" and "NORMAL."
|
9 |
+
* Version 1 contains the raw images, and only has the pre-processing feature of "Auto-Orient" applied to strip out EXIF data, and ensure all images are "right side up."
|
10 |
+
* Version 2 contains the raw images with pre-processing features of "Auto-Orient" and Resize of 640 by 640 applied
|
11 |
+
* Version 3 was trained with Roboflow's model architecture for classification datasets and contains the raw images with pre-processing features of "Auto-Orient" and Resize of 640 by 640 applied + augmentations:
|
12 |
+
* Outputs per training example: 3
|
13 |
+
* Shear: ±3° Horizontal, ±2° Vertical
|
14 |
+
* Saturation: Between -5% and +5%
|
15 |
+
* Brightness: Between -5% and +5%
|
16 |
+
* Exposure: Between -5% and +5%
|
17 |
+
|
18 |
+
### Below you will find the description provided on Kaggle:
|
19 |
+
|
20 |
+
#### Context
|
21 |
+
http://www.cell.com/cell/fulltext/S0092-8674(18)30154-5
|
22 |
+
![Figure S6](https://i.imgur.com/jZqpV51.png)
|
23 |
+
Figure S6. Illustrative Examples of Chest X-Rays in Patients with Pneumonia, Related to Figure 6
|
24 |
+
The normal chest X-ray (left panel) depicts clear lungs without any areas of abnormal opacification in the image. Bacterial pneumonia (middle) typically exhibits a focal lobar consolidation, in this case in the right upper lobe (white arrows), whereas viral pneumonia (right) manifests with a more diffuse ‘‘interstitial’’ pattern in both lungs.
|
25 |
+
http://www.cell.com/cell/fulltext/S0092-8674(18)30154-5
|
26 |
+
|
27 |
+
#### Content
|
28 |
+
The dataset is organized into 3 folders (train, test, val) and contains subfolders for each image category (Pneumonia/Normal). There are 5,863 X-Ray images (JPEG) and 2 categories (Pneumonia/Normal).
|
29 |
+
|
30 |
+
Chest X-ray images (anterior-posterior) were selected from retrospective cohorts of pediatric patients of one to five years old from Guangzhou Women and Children’s Medical Center, Guangzhou. All chest X-ray imaging was performed as part of patients’ routine clinical care.
|
31 |
+
|
32 |
+
For the analysis of chest x-ray images, all chest radiographs were initially screened for quality control by removing all low quality or unreadable scans. The diagnoses for the images were then graded by two expert physicians before being cleared for training the AI system. In order to account for any grading errors, the evaluation set was also checked by a third expert.
|
33 |
+
|
34 |
+
#### Acknowledgements
|
35 |
+
Data: https://data.mendeley.com/datasets/rscbjbr9sj/2
|
36 |
+
|
37 |
+
License: CC BY 4.0
|
38 |
+
|
39 |
+
Citation: http://www.cell.com/cell/fulltext/S0092-8674(18)30154-5
|
40 |
+
![citation - latest version (Kaggle)](https://i.imgur.com/8AUJkin.png)
|
41 |
+
|
42 |
+
#### Inspiration
|
43 |
+
Automated methods to detect and classify human diseases from medical images.
|
README.md
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
task_categories:
|
3 |
+
- image-classification
|
4 |
+
tags:
|
5 |
+
- roboflow
|
6 |
+
- roboflow2huggingface
|
7 |
+
- Biology
|
8 |
+
---
|
9 |
+
|
10 |
+
<div align="center">
|
11 |
+
<img width="640" alt="keremberke/chest-xray-classification" src="https://huggingface.co/datasets/keremberke/chest-xray-classification/resolve/main/thumbnail.jpg">
|
12 |
+
</div>
|
13 |
+
|
14 |
+
### Dataset Labels
|
15 |
+
|
16 |
+
```
|
17 |
+
['NORMAL', 'PNEUMONIA']
|
18 |
+
```
|
19 |
+
|
20 |
+
|
21 |
+
### Number of Images
|
22 |
+
|
23 |
+
```json
|
24 |
+
{'train': 4077, 'test': 582, 'valid': 1165}
|
25 |
+
```
|
26 |
+
|
27 |
+
|
28 |
+
### How to Use
|
29 |
+
|
30 |
+
- Install [datasets](https://pypi.org/project/datasets/):
|
31 |
+
|
32 |
+
```bash
|
33 |
+
pip install datasets
|
34 |
+
```
|
35 |
+
|
36 |
+
- Load the dataset:
|
37 |
+
|
38 |
+
```python
|
39 |
+
from datasets import load_dataset
|
40 |
+
|
41 |
+
ds = load_dataset("keremberke/chest-xray-classification", name="full")
|
42 |
+
example = ds['train'][0]
|
43 |
+
```
|
44 |
+
|
45 |
+
### Roboflow Dataset Page
|
46 |
+
[https://universe.roboflow.com/mohamed-traore-2ekkp/chest-x-rays-qjmia/dataset/2](https://universe.roboflow.com/mohamed-traore-2ekkp/chest-x-rays-qjmia/dataset/2?ref=roboflow2huggingface)
|
47 |
+
|
48 |
+
### Citation
|
49 |
+
|
50 |
+
```
|
51 |
+
|
52 |
+
```
|
53 |
+
|
54 |
+
### License
|
55 |
+
CC BY 4.0
|
56 |
+
|
57 |
+
### Dataset Summary
|
58 |
+
This dataset was exported via roboflow.ai on March 31, 2022 at 3:11 PM GMT
|
59 |
+
|
60 |
+
It includes 5824 images.
|
61 |
+
Pneumonia are annotated in folder format.
|
62 |
+
|
63 |
+
The following pre-processing was applied to each image:
|
64 |
+
* Auto-orientation of pixel data (with EXIF-orientation stripping)
|
65 |
+
* Resize to 640x640 (Stretch)
|
66 |
+
|
67 |
+
No image augmentation techniques were applied.
|
68 |
+
|
69 |
+
|
70 |
+
|
README.roboflow.txt
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Chest X-Rays - v2 resized-640by640
|
3 |
+
==============================
|
4 |
+
|
5 |
+
This dataset was exported via roboflow.ai on March 31, 2022 at 3:11 PM GMT
|
6 |
+
|
7 |
+
It includes 5824 images.
|
8 |
+
Pneumonia are annotated in folder format.
|
9 |
+
|
10 |
+
The following pre-processing was applied to each image:
|
11 |
+
* Auto-orientation of pixel data (with EXIF-orientation stripping)
|
12 |
+
* Resize to 640x640 (Stretch)
|
13 |
+
|
14 |
+
No image augmentation techniques were applied.
|
15 |
+
|
16 |
+
|
chest-xray-classification.py
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
from datasets.tasks import ImageClassification
|
5 |
+
|
6 |
+
|
7 |
+
_HOMEPAGE = "https://universe.roboflow.com/mohamed-traore-2ekkp/chest-x-rays-qjmia/dataset/2"
|
8 |
+
_LICENSE = "CC BY 4.0"
|
9 |
+
_CITATION = """\
|
10 |
+
|
11 |
+
"""
|
12 |
+
_CATEGORIES = ['NORMAL', 'PNEUMONIA']
|
13 |
+
|
14 |
+
|
15 |
+
class CHESTXRAYCLASSIFICATIONConfig(datasets.BuilderConfig):
|
16 |
+
"""Builder Config for chest-xray-classification"""
|
17 |
+
|
18 |
+
def __init__(self, data_urls, **kwargs):
|
19 |
+
"""
|
20 |
+
BuilderConfig for chest-xray-classification.
|
21 |
+
|
22 |
+
Args:
|
23 |
+
data_urls: `dict`, name to url to download the zip file from.
|
24 |
+
**kwargs: keyword arguments forwarded to super.
|
25 |
+
"""
|
26 |
+
super(CHESTXRAYCLASSIFICATIONConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
|
27 |
+
self.data_urls = data_urls
|
28 |
+
|
29 |
+
|
30 |
+
class CHESTXRAYCLASSIFICATION(datasets.GeneratorBasedBuilder):
|
31 |
+
"""chest-xray-classification image classification dataset"""
|
32 |
+
|
33 |
+
VERSION = datasets.Version("1.0.0")
|
34 |
+
BUILDER_CONFIGS = [
|
35 |
+
CHESTXRAYCLASSIFICATIONConfig(
|
36 |
+
name="full",
|
37 |
+
description="Full version of chest-xray-classification dataset.",
|
38 |
+
data_urls={
|
39 |
+
"train": "https://huggingface.co/datasets/keremberke/chest-xray-classification/resolve/main/data/train.zip",
|
40 |
+
"validation": "https://huggingface.co/datasets/keremberke/chest-xray-classification/resolve/main/data/valid.zip",
|
41 |
+
"test": "https://huggingface.co/datasets/keremberke/chest-xray-classification/resolve/main/data/test.zip",
|
42 |
+
}
|
43 |
+
,
|
44 |
+
),
|
45 |
+
CHESTXRAYCLASSIFICATIONConfig(
|
46 |
+
name="mini",
|
47 |
+
description="Mini version of chest-xray-classification dataset.",
|
48 |
+
data_urls={
|
49 |
+
"train": "https://huggingface.co/datasets/keremberke/chest-xray-classification/resolve/main/data/valid-mini.zip",
|
50 |
+
"validation": "https://huggingface.co/datasets/keremberke/chest-xray-classification/resolve/main/data/valid-mini.zip",
|
51 |
+
"test": "https://huggingface.co/datasets/keremberke/chest-xray-classification/resolve/main/data/valid-mini.zip",
|
52 |
+
},
|
53 |
+
)
|
54 |
+
]
|
55 |
+
|
56 |
+
def _info(self):
|
57 |
+
return datasets.DatasetInfo(
|
58 |
+
features=datasets.Features(
|
59 |
+
{
|
60 |
+
"image_file_path": datasets.Value("string"),
|
61 |
+
"image": datasets.Image(),
|
62 |
+
"labels": datasets.features.ClassLabel(names=_CATEGORIES),
|
63 |
+
}
|
64 |
+
),
|
65 |
+
supervised_keys=("image", "labels"),
|
66 |
+
homepage=_HOMEPAGE,
|
67 |
+
citation=_CITATION,
|
68 |
+
license=_LICENSE,
|
69 |
+
task_templates=[ImageClassification(image_column="image", label_column="labels")],
|
70 |
+
)
|
71 |
+
|
72 |
+
def _split_generators(self, dl_manager):
|
73 |
+
data_files = dl_manager.download_and_extract(self.config.data_urls)
|
74 |
+
return [
|
75 |
+
datasets.SplitGenerator(
|
76 |
+
name=datasets.Split.TRAIN,
|
77 |
+
gen_kwargs={
|
78 |
+
"files": dl_manager.iter_files([data_files["train"]]),
|
79 |
+
},
|
80 |
+
),
|
81 |
+
datasets.SplitGenerator(
|
82 |
+
name=datasets.Split.VALIDATION,
|
83 |
+
gen_kwargs={
|
84 |
+
"files": dl_manager.iter_files([data_files["validation"]]),
|
85 |
+
},
|
86 |
+
),
|
87 |
+
datasets.SplitGenerator(
|
88 |
+
name=datasets.Split.TEST,
|
89 |
+
gen_kwargs={
|
90 |
+
"files": dl_manager.iter_files([data_files["test"]]),
|
91 |
+
},
|
92 |
+
),
|
93 |
+
]
|
94 |
+
|
95 |
+
def _generate_examples(self, files):
|
96 |
+
for i, path in enumerate(files):
|
97 |
+
file_name = os.path.basename(path)
|
98 |
+
if file_name.endswith((".jpg", ".png", ".jpeg", ".bmp", ".tif", ".tiff")):
|
99 |
+
yield i, {
|
100 |
+
"image_file_path": path,
|
101 |
+
"image": path,
|
102 |
+
"labels": os.path.basename(os.path.dirname(path)),
|
103 |
+
}
|
data/test.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7f0db6949696b314952e42d92ee9a843f34b437ae33e963b45aca62206626947
|
3 |
+
size 20443974
|
data/train.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e921cdefa8df9f07a8b53869cd590610765ac3be9559bd1e6508b9dafc1b5713
|
3 |
+
size 142185557
|
data/valid-mini.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ef69fffcc8de5008df4cd747086c77d049104b3085e1a8315d95fc8367c1878
|
3 |
+
size 152959
|
data/valid.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6923341a1591e3eda811389e134bde72e8ec97b86f5a4829767896dbe12eea63
|
3 |
+
size 40715888
|
split_name_to_num_samples.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"train": 4077, "test": 582, "valid": 1165}
|
thumbnail.jpg
ADDED
Git LFS Details
|