update hit.py
Browse files
hit.py
CHANGED
@@ -83,10 +83,10 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
83 |
"gender": datasets.Value("string"),
|
84 |
"mri_seg": datasets.Value("int64"),
|
85 |
"mri_labels": datasets.Sequence(datasets.Sequence(datasets.Value("int64"))),
|
86 |
-
"mri_seg_dict": datasets.Sequence(datasets.Sequence(datasets.Value("float"))),
|
87 |
"resolution": datasets.Value("double"),
|
88 |
"center": datasets.Value("double"),
|
89 |
-
"smpl_dict": datasets.Sequence(datasets.Sequence(datasets.Value("double"))),
|
90 |
"dataset_name": datasets.Value("string"),
|
91 |
"subject_ID": datasets.Value("string")
|
92 |
# These are the features of your dataset like images, labels ...
|
@@ -164,14 +164,12 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
164 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
165 |
# List all files in the path .gz
|
166 |
print(f"file path {filepath}")
|
167 |
-
"""file_paths = []
|
168 |
-
for root, dirs, files in os.walk(filepath):
|
169 |
-
for file in files:
|
170 |
-
if file.endswith('.gz'):
|
171 |
-
file_paths.append(file)"""
|
172 |
for subject_path in filepath:
|
173 |
with gzip.open(subject_path, 'rb') as f:
|
174 |
data = pickle.load(f)
|
175 |
key = data['subject_ID']
|
|
|
|
|
176 |
print(key)
|
|
|
177 |
yield key, data
|
|
|
83 |
"gender": datasets.Value("string"),
|
84 |
"mri_seg": datasets.Value("int64"),
|
85 |
"mri_labels": datasets.Sequence(datasets.Sequence(datasets.Value("int64"))),
|
86 |
+
#"mri_seg_dict": datasets.Sequence(datasets.Sequence(datasets.Value("float"))),
|
87 |
"resolution": datasets.Value("double"),
|
88 |
"center": datasets.Value("double"),
|
89 |
+
#"smpl_dict": datasets.Sequence(datasets.Sequence(datasets.Value("double"))),
|
90 |
"dataset_name": datasets.Value("string"),
|
91 |
"subject_ID": datasets.Value("string")
|
92 |
# These are the features of your dataset like images, labels ...
|
|
|
164 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
165 |
# List all files in the path .gz
|
166 |
print(f"file path {filepath}")
|
|
|
|
|
|
|
|
|
|
|
167 |
for subject_path in filepath:
|
168 |
with gzip.open(subject_path, 'rb') as f:
|
169 |
data = pickle.load(f)
|
170 |
key = data['subject_ID']
|
171 |
+
del data['mri_seg_dict']
|
172 |
+
del data['smpl_dict']
|
173 |
print(key)
|
174 |
+
print(data.keys())
|
175 |
yield key, data
|