File size: 571 Bytes
08f6473 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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)
|