-
Notifications
You must be signed in to change notification settings - Fork 1
/
evaluate.py
39 lines (33 loc) · 984 Bytes
/
evaluate.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
import torch
import monai
def get_predection(x, y, model):
model.eval()
y = torch.tensor(y).unsqueeze(0)
y = monai.transforms.spatial.functional.resize(
y,
out_size=(256, 256, 80),
mode="nearest",
align_corners=None,
dtype=None,
input_ndim=3,
anti_aliasing=False,
anti_aliasing_sigma=None,
lazy=False,
transform_info=None
).squeeze(0).numpy()
x = monai.transforms.spatial.functional.resize(
x,
out_size=(256, 256, 80),
mode="nearest",
align_corners=None,
dtype=None,
input_ndim=3,
anti_aliasing=False,
anti_aliasing_sigma=None,
lazy=False,
transform_info=None
)
with torch.no_grad():
pred = model(x)
pred = torch.sigmoid(pred).squeeze(0).numpy()
return pred, y