ziq commited on
Commit
80f22f7
·
1 Parent(s): 4a1fec0

Update rsna-atd.py

Browse files
Files changed (1) hide show
  1. rsna-atd.py +30 -30
rsna-atd.py CHANGED
@@ -33,27 +33,27 @@ class RSNAATD(datasets.GeneratorBasedBuilder):
33
  description=_DESCRIPTION,
34
  features=datasets.Features(
35
  {
36
- "test": datasets.Value("string"),
37
- # "patient_id": datasets.Value("int64"),
38
- # "series_id": datasets.Value("int64"),
39
- # "image": datasets.Array3D(shape=(None, 512, 512), dtype="uint8"),
40
- # "mask": datasets.Array3D(shape=(None, 512, 512), dtype="uint8"),
41
- # "aortic_hu": datasets.Value("float64"),
42
- # "incomplete_organ": datasets.Value("int64"),
43
- # "bowel_healthy": datasets.Value("int64"),
44
- # "bowel_injury": datasets.Value("int64"),
45
- # "extravasation_healthy": datasets.Value("int64"),
46
- # "extravasation_injury": datasets.Value("int64"),
47
- # "kidney_healthy": datasets.Value("int64"),
48
- # "kidney_low": datasets.Value("int64"),
49
- # "kidney_high": datasets.Value("int64"),
50
- # "liver_healthy": datasets.Value("int64"),
51
- # "liver_low": datasets.Value("int64"),
52
- # "liver_high": datasets.Value("int64"),
53
- # "spleen_healthy": datasets.Value("int64"),
54
- # "spleen_low": datasets.Value("int64"),
55
- # "spleen_high": datasets.Value("int64"),
56
- # "any_injury": datasets.Value("int64"),
57
  }
58
  ),
59
  supervised_keys=None,
@@ -62,8 +62,8 @@ class RSNAATD(datasets.GeneratorBasedBuilder):
62
  )
63
 
64
  def _split_generators(self, dl_manager):
65
- train_images = dl_manager.download(f"{_DATA}images.zip")
66
- train_masks = dl_manager.download(f"{_DATA}masks.zip")
67
 
68
  metadata = dl_manager.download(f"{_DATA}metadata.csv")
69
  train_images = dl_manager.iter_files(train_images)
@@ -86,13 +86,13 @@ class RSNAATD(datasets.GeneratorBasedBuilder):
86
  # "test": images
87
  # }
88
  # return
89
- for i, image in enumerate(images):
90
- # image_path = Path(image).name
91
- # test = hkl.load(image_path)
92
- yield i, {
93
- "test": image
94
- }
95
- return
96
  for idx, (data, image_path, mask_path) in enumerate(zip(df.to_numpy(), images, masks)):
97
  image_path = Path(image_path) / data[0]
98
  mask_path = Path(mask_path) / data[0]
 
33
  description=_DESCRIPTION,
34
  features=datasets.Features(
35
  {
36
+ # "test": datasets.Value("string"),
37
+ "patient_id": datasets.Value("int64"),
38
+ "series_id": datasets.Value("int64"),
39
+ "image": datasets.Array3D(shape=(None, 512, 512), dtype="uint8"),
40
+ "mask": datasets.Array3D(shape=(None, 512, 512), dtype="uint8"),
41
+ "aortic_hu": datasets.Value("float64"),
42
+ "incomplete_organ": datasets.Value("int64"),
43
+ "bowel_healthy": datasets.Value("int64"),
44
+ "bowel_injury": datasets.Value("int64"),
45
+ "extravasation_healthy": datasets.Value("int64"),
46
+ "extravasation_injury": datasets.Value("int64"),
47
+ "kidney_healthy": datasets.Value("int64"),
48
+ "kidney_low": datasets.Value("int64"),
49
+ "kidney_high": datasets.Value("int64"),
50
+ "liver_healthy": datasets.Value("int64"),
51
+ "liver_low": datasets.Value("int64"),
52
+ "liver_high": datasets.Value("int64"),
53
+ "spleen_healthy": datasets.Value("int64"),
54
+ "spleen_low": datasets.Value("int64"),
55
+ "spleen_high": datasets.Value("int64"),
56
+ "any_injury": datasets.Value("int64"),
57
  }
58
  ),
59
  supervised_keys=None,
 
62
  )
63
 
64
  def _split_generators(self, dl_manager):
65
+ train_images = dl_manager.download_and_extract(f"{_DATA}images.zip")
66
+ train_masks = dl_manager.download_and_extract(f"{_DATA}masks.zip")
67
 
68
  metadata = dl_manager.download(f"{_DATA}metadata.csv")
69
  train_images = dl_manager.iter_files(train_images)
 
86
  # "test": images
87
  # }
88
  # return
89
+ # for i, image in enumerate(images):
90
+ # # image_path = Path(image).name
91
+ # # test = hkl.load(image_path)
92
+ # yield i, {
93
+ # "test": image
94
+ # }
95
+ # return
96
  for idx, (data, image_path, mask_path) in enumerate(zip(df.to_numpy(), images, masks)):
97
  image_path = Path(image_path) / data[0]
98
  mask_path = Path(mask_path) / data[0]