Datasets:

Languages:
English
ArXiv:
License:
admin commited on
Commit
a3f2883
1 Parent(s): d482319
Files changed (3) hide show
  1. .gitignore +2 -0
  2. HEp2.py +99 -0
  3. README.md +49 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ rename.sh
2
+ test.py
HEp2.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ import datasets
4
+ from datasets.tasks import ImageClassification
5
+
6
+
7
+ _HOMEPAGE = (
8
+ f"https://www.modelscope.cn/datasets/MuGeminorum/{os.path.basename(__file__)[:-3]}"
9
+ )
10
+
11
+ _URL = f"{_HOMEPAGE}/resolve/master/images.zip"
12
+
13
+ _NAMES = ["Centromere", "Golgi", "Homogeneous", "NuMem", "Nucleolar", "Speckled"]
14
+
15
+
16
+ class HEp2(datasets.GeneratorBasedBuilder):
17
+ def _info(self):
18
+ return datasets.DatasetInfo(
19
+ features=datasets.Features(
20
+ {
21
+ "image": datasets.Image(),
22
+ "label": datasets.features.ClassLabel(names=_NAMES),
23
+ }
24
+ ),
25
+ supervised_keys=("image", "label"),
26
+ homepage=_HOMEPAGE,
27
+ license="mit",
28
+ version="0.0.1",
29
+ task_templates=[
30
+ ImageClassification(
31
+ task="image-classification",
32
+ image_column="image",
33
+ label_column="label",
34
+ )
35
+ ],
36
+ )
37
+
38
+ def _ground_truth(self, id):
39
+ if id < 2495:
40
+ return "Homogeneous"
41
+
42
+ elif id < 5326:
43
+ return "Speckled"
44
+
45
+ elif id < 7924:
46
+ return "Nucleolar"
47
+
48
+ elif id < 10665:
49
+ return "Centromere"
50
+
51
+ elif id < 12873:
52
+ return "NuMem"
53
+
54
+ else:
55
+ return "Golgi"
56
+
57
+ def _split_generators(self, dl_manager):
58
+ data_files = dl_manager.download_and_extract(_URL)
59
+ files = dl_manager.iter_files([data_files])
60
+ dataset = []
61
+ for path in files:
62
+ file_name = os.path.basename(path)
63
+ if file_name.endswith(".png"):
64
+ dataset.append(
65
+ {
66
+ "image": path,
67
+ "label": self._ground_truth(int(file_name.split(".")[0])),
68
+ }
69
+ )
70
+
71
+ random.shuffle(dataset)
72
+ data_count = len(dataset)
73
+ p80 = int(data_count * 0.8)
74
+ p90 = int(data_count * 0.9)
75
+
76
+ return [
77
+ datasets.SplitGenerator(
78
+ name=datasets.Split.TRAIN,
79
+ gen_kwargs={
80
+ "files": dataset[:p80],
81
+ },
82
+ ),
83
+ datasets.SplitGenerator(
84
+ name=datasets.Split.VALIDATION,
85
+ gen_kwargs={
86
+ "files": dataset[p80:p90],
87
+ },
88
+ ),
89
+ datasets.SplitGenerator(
90
+ name=datasets.Split.TEST,
91
+ gen_kwargs={
92
+ "files": dataset[p90:],
93
+ },
94
+ ),
95
+ ]
96
+
97
+ def _generate_examples(self, files):
98
+ for i, path in enumerate(files):
99
+ yield i, path
README.md CHANGED
@@ -1,3 +1,52 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ task_categories:
4
+ - image-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - biology
9
+ - medical
10
+ pretty_name: HEp-2 Cell
11
+ size_categories:
12
+ - 10K<n<100K
13
  ---
14
+
15
+ # Dataset card for "MuGeminorum/HEp2"
16
+ The HEp-2 (Human Epithelial type 2) dataset is a widely used benchmark in the field of medical image analysis, especially for the task of antinuclear antibody (ANA) pattern classification. The dataset contains microscopic images of HEp-2 cells stained with fluorescence, demonstrating multiple patterns of autoantibody binding associated with various autoimmune diseases. The HEp-2 dataset is utilized by researchers and practitioners to develop and evaluate algorithms for automated ANA pattern recognition to aid in the diagnosis of autoimmune diseases. The intricate patterns in this dataset test the robustness of computational models, making it a valuable resource for advancing the understanding of autoimmune diseases and the development of advanced medical image analysis techniques.
17
+
18
+ ## Usage
19
+ ```python
20
+ from datasets import load_dataset
21
+
22
+ data = load_dataset("MuGeminorum/HEp2")
23
+ trainset = data["train"]
24
+ validset = data["validation"]
25
+ testset = data["test"]
26
+ labels = testset.features["label"].names
27
+
28
+ for item in trainset:
29
+ print("image: ", item["image"])
30
+ print("label name: " + labels[item["label"]])
31
+
32
+ for item in validset:
33
+ print("image: ", item["image"])
34
+ print("label name: " + labels[item["label"]])
35
+
36
+ for item in testset:
37
+ print("image: ", item["image"])
38
+ print("label name: " + labels[item["label"]])
39
+ ```
40
+
41
+ ## Maintenance
42
+ ```bash
43
+ GIT_LFS_SKIP_SMUDGE=1 git clone git@hf.co:datasets/MuGeminorum/HEp2
44
+ cd HEp2
45
+ ```
46
+
47
+ ## Mirror
48
+ <https://www.modelscope.cn/datasets/MuGeminorum/HEp2>
49
+
50
+ ## Reference
51
+ [1] [Chapter III ‐ Classifying Cell Images Using Deep Learning Models](https://github.com/MuGeminorum/Medical_Image_Computing/wiki/Chapter-III-%E2%80%90-Classifying-Cell-Images-Using-Deep-Learning-Models)<br>
52
+ [2] <a href="https://arxiv.org/pdf/1504.02531v1.pdf">HEp-2 Cell Image Classification with Deep Convolutional Neural Networks</a>