Datasets:
Tasks:
Image Classification
Size:
10K - 100K
dataset uploaded by roboflow2huggingface package
Browse files- README.dataset.txt +43 -0
- README.md +73 -0
- README.roboflow.txt +19 -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 > augmented-resized640by640
|
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 the website 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,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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="trpakov/chest-xray-classification" src="https://huggingface.co/datasets/trpakov/chest-xray-classification/resolve/main/thumbnail.jpg">
|
12 |
+
</div>
|
13 |
+
|
14 |
+
### Dataset Labels
|
15 |
+
|
16 |
+
```
|
17 |
+
['PNEUMONIA', 'NORMAL']
|
18 |
+
```
|
19 |
+
|
20 |
+
|
21 |
+
### Number of Images
|
22 |
+
|
23 |
+
```json
|
24 |
+
{'test': 582, 'valid': 1165, 'train': 12230}
|
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("trpakov/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/3](https://universe.roboflow.com/mohamed-traore-2ekkp/chest-x-rays-qjmia/dataset/3?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 December 8, 2021 at 12:45 AM GMT
|
59 |
+
|
60 |
+
It includes 13977 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 |
+
The following augmentation was applied to create 3 versions of each source image:
|
68 |
+
* Random shear of between -3° to +3° horizontally and -2° to +2° vertically
|
69 |
+
* Random brigthness adjustment of between -5 and +5 percent
|
70 |
+
* Random exposure adjustment of between -5 and +5 percent
|
71 |
+
|
72 |
+
|
73 |
+
|
README.roboflow.txt
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Chest X-Rays - v3 augmented-resized640by640
|
3 |
+
==============================
|
4 |
+
|
5 |
+
This dataset was exported via roboflow.ai on December 8, 2021 at 12:45 AM GMT
|
6 |
+
|
7 |
+
It includes 13977 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 |
+
The following augmentation was applied to create 3 versions of each source image:
|
15 |
+
* Random shear of between -3° to +3° horizontally and -2° to +2° vertically
|
16 |
+
* Random brigthness adjustment of between -5 and +5 percent
|
17 |
+
* Random exposure adjustment of between -5 and +5 percent
|
18 |
+
|
19 |
+
|
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/3"
|
8 |
+
_LICENSE = "CC BY 4.0"
|
9 |
+
_CITATION = """\
|
10 |
+
|
11 |
+
"""
|
12 |
+
_CATEGORIES = ['PNEUMONIA', 'NORMAL']
|
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/trpakov/chest-xray-classification/resolve/main/data/train.zip",
|
40 |
+
"validation": "https://huggingface.co/datasets/trpakov/chest-xray-classification/resolve/main/data/valid.zip",
|
41 |
+
"test": "https://huggingface.co/datasets/trpakov/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/trpakov/chest-xray-classification/resolve/main/data/valid-mini.zip",
|
50 |
+
"validation": "https://huggingface.co/datasets/trpakov/chest-xray-classification/resolve/main/data/valid-mini.zip",
|
51 |
+
"test": "https://huggingface.co/datasets/trpakov/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:35cf2351978606f4cab089ac72fbde5939a750392b33b5c32b65ae710f71ea4c
|
3 |
+
size 20443974
|
data/train.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c6f60f5f8d379594e5105f84a2c65729c5c526b125552543c645e0062e67aed4
|
3 |
+
size 408711069
|
data/valid-mini.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:51f5b82308ea2bac7cabe8b88ca0939b6a9d7b379917839e4bc0ac66fc50753b
|
3 |
+
size 151338
|
data/valid.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:562138aa6cd5a58d99efea2e0591f15ed30383e1c63192cd1fb53997446f70f6
|
3 |
+
size 40715888
|
split_name_to_num_samples.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"test": 582, "valid": 1165, "train": 12230}
|
thumbnail.jpg
ADDED
Git LFS Details
|