-
Notifications
You must be signed in to change notification settings - Fork 2
/
task_blood3.py
107 lines (97 loc) · 3.27 KB
/
task_blood3.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"""
difference than task_blood2.py:
"mll": "/lustre/groups/labs/marr/qscd01/datasets/240416_MLL23",
"""
from torchvision import transforms
from domainlab.tasks.task_folder_mk import mk_task_folder
from domainlab.tasks.utils_task import ImSize
IMG_SIZE = 224
trans = transforms.Compose(
[
transforms.Resize((IMG_SIZE, IMG_SIZE)),
transforms.RandomResizedCrop(IMG_SIZE, scale=(0.7, 1.0)),
transforms.RandomHorizontalFlip(),
transforms.ColorJitter(0.3, 0.3, 0.3, 0.3),
transforms.RandomGrayscale(),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
]
)
trans_te = transforms.Compose(
[
transforms.Resize((IMG_SIZE, IMG_SIZE)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
]
)
TASK = mk_task_folder(
extensions={"acevedo": "jpg", "matek": "tiff", "mll": "tif"},
list_str_y=[
"basophil",
"erythroblast",
"metamyelocyte",
"myeloblast",
"neutrophil_band",
"promyelocyte",
"eosinophil",
"lymphocyte_typical",
"monocyte",
"myelocyte",
"neutrophil_segmented",
],
dict_domain_folder_name2class={
"acevedo": {
"basophil": "basophil",
"erythroblast": "erythroblast",
"metamyelocyte": "metamyelocyte",
"neutrophil_band": "neutrophil_band",
"promyelocyte": "promyelocyte",
"eosinophil": "eosinophil",
"lymphocyte_typical": "lymphocyte_typical",
"monocyte": "monocyte",
"myelocyte": "myelocyte",
"neutrophil_segmented": "neutrophil_segmented",
},
"matek": {
"basophil": "basophil",
"erythroblast": "erythroblast",
"metamyelocyte": "metamyelocyte",
"myeloblast": "myeloblast",
"neutrophil_band": "neutrophil_band",
"promyelocyte": "promyelocyte",
"eosinophil": "eosinophil",
"lymphocyte_typical": "lymphocyte_typical",
"monocyte": "monocyte",
"myelocyte": "myelocyte",
"neutrophil_segmented": "neutrophil_segmented",
},
"mll": {
"basophil": "basophil",
"normoblast":"erythroblast",
"metamyelocyte": "metamyelocyte",
"myeloblast": "myeloblast",
"neutrophil_band": "neutrophil_band",
"promyelocyte": "promyelocyte",
"eosinophil": "eosinophil",
"lymphocyte": "lymphocyte_typical",
"monocyte": "monocyte",
"myelocyte": "myelocyte",
"neutrophil_segmented": "neutrophil_segmented",
},
},
dict_domain_img_trans={
"acevedo": trans,
"mll": trans,
"matek": trans,
},
img_trans_te=trans_te,
isize=ImSize(3, IMG_SIZE, IMG_SIZE),
dict_domain2imgroot={
"matek": "/lustre/groups/labs/marr/qscd01/datasets/armingruber/_Domains/Matek_cropped",
"mll": "/lustre/groups/labs/marr/qscd01/datasets/240416_MLL23",
"acevedo": "/lustre/groups/labs/marr/qscd01/datasets/armingruber/_Domains/Acevedo_cropped",
},
taskna="blood_mon_eos_bas",
)
def get_task(na=None):
return TASK