alkzar90 commited on
Commit
f01b9e2
1 Parent(s): 0eb57e5

add object detection config

Browse files
Files changed (1) hide show
  1. NIH-Chest-X-ray-dataset.py +24 -7
NIH-Chest-X-ray-dataset.py CHANGED
@@ -51,10 +51,10 @@ _REPO = "https://huggingface.co/datasets/alkzar90/NIH-Chest-X-ray-dataset/resolv
51
 
52
 
53
  _IMAGE_URLS = [
54
- f"{_REPO}/images/images_001.zip",
55
- f"{_REPO}/images/images_003.zip",
56
- f"{_REPO}/images/images_004.zip",
57
- f"{_REPO}/images/images_005.zip"
58
  #'https://huggingface.co/datasets/alkzar90/NIH-Chest-X-ray-dataset/resolve/main/dummy/0.0.0/images_001.tar.gz',
59
  #'https://huggingface.co/datasets/alkzar90/NIH-Chest-X-ray-dataset/resolve/main/dummy/0.0.0/images_002.tar.gz'
60
  ]
@@ -90,7 +90,7 @@ _NAMES = list(_LABEL2IDX.keys())
90
 
91
 
92
  class ChestXray14Config(datasets.BuilderConfig):
93
- """allala"""
94
 
95
  def __init__(self, name, **kwargs):
96
  super(ChestXray14Config, self).__init__(
@@ -103,7 +103,7 @@ class ChestXray14Config(datasets.BuilderConfig):
103
 
104
 
105
  class ChestXray14(datasets.GeneratorBasedBuilder):
106
- """NIH Image Chest X-ray dataset."""
107
 
108
 
109
  BUILDER_CONFIGS = [
@@ -121,11 +121,28 @@ class ChestXray14(datasets.GeneratorBasedBuilder):
121
  num_classes=len(_NAMES),
122
  names=_NAMES
123
  )
124
- )
125
  }
126
  )
127
  keys = ("image", "labels")
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  return datasets.DatasetInfo(
130
  description=_DESCRIPTION,
131
  features=features,
 
51
 
52
 
53
  _IMAGE_URLS = [
54
+ f"{_REPO}/images/images_001.zip"
55
+ # f"{_REPO}/images/images_003.zip",
56
+ # f"{_REPO}/images/images_004.zip",
57
+ # f"{_REPO}/images/images_005.zip"
58
  #'https://huggingface.co/datasets/alkzar90/NIH-Chest-X-ray-dataset/resolve/main/dummy/0.0.0/images_001.tar.gz',
59
  #'https://huggingface.co/datasets/alkzar90/NIH-Chest-X-ray-dataset/resolve/main/dummy/0.0.0/images_002.tar.gz'
60
  ]
 
90
 
91
 
92
  class ChestXray14Config(datasets.BuilderConfig):
93
+ """NIH Image Chest X-ray14 configuration."""
94
 
95
  def __init__(self, name, **kwargs):
96
  super(ChestXray14Config, self).__init__(
 
103
 
104
 
105
  class ChestXray14(datasets.GeneratorBasedBuilder):
106
+ """NIH Image Chest X-ray14 dataset."""
107
 
108
 
109
  BUILDER_CONFIGS = [
 
121
  num_classes=len(_NAMES),
122
  names=_NAMES
123
  )
124
+ ),
125
  }
126
  )
127
  keys = ("image", "labels")
128
 
129
+ if self.config.name == "object-detection":
130
+ features = datasets.Features(
131
+ {
132
+ "image_id": datasets.Value("string"),
133
+ "patient_id": datasets.Value("int32"),
134
+ "image": datasets.Image(),
135
+ "width": datasets.Value("int32"),
136
+ "height": datasets.Value("int32"),
137
+ }
138
+ object_dict = {
139
+ "image_id": datasets.Value("string"),
140
+ "area": datasets.Value("int64"),
141
+ "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
142
+ }
143
+ features["objects"] = [object_dict]
144
+ keys = ("image", "objects")
145
+
146
  return datasets.DatasetInfo(
147
  description=_DESCRIPTION,
148
  features=features,