FedEFM / data /med /dataset.py
nghiacblk5's picture
Upload 10609 files
08f6473 verified
import pickle
import os
import random
import numpy as np
d = {'1': 1, '2': 2, '3': 3, '4':4, '5': 0, '6': 1, '7': 2, '8': 3, '9':4, '10': 0, '11': 5}
test_pkl = os.listdir("test")
test = [os.path.join(".", "test", i) for i in test_pkl]
t = []
for i in test:
if "ani" in i:
label = 2
elif "pt" in i:
label = 1
elif 'hepatic' in i:
label = 0
elif 'VESSEL' in i:
label = 3
elif 'kidney' in i:
label = 4
else: label = 5
t.append((i,label))
with open('gaia/test/test.pkl'.format(i), 'wb') as f:
pickle.dump(t, f, pickle.HIGHEST_PROTOCOL)