-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
76 lines (64 loc) · 2.12 KB
/
test.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
from model import Simple3DCNN, Simple3DCNN_SimCLR, VoxVGG, VoxVGG_SimCLR, VoxResNet, VoxResNet_SimCLR
import torch
from torchvision import models
def net_simple_test():
net = Simple3DCNN(class_nums=3)
net.eval()
test_input = torch.randn(2, 1, 100, 100, 100)
test_output = net(test_input)
print(test_output.shape)
assert test_output.shape == torch.Size([2, 3])
def net_simplesimclr_test():
net = Simple3DCNN_SimCLR(out_dim=1024)
net.eval()
test_input = torch.randn(2, 1, 100, 100, 100)
test_output = net(test_input)
print(test_output.shape)
assert test_output.shape == torch.Size([2, 1024])
def net_voxvgg_test():
net = VoxVGG(class_nums=5)
net.eval()
test_input = torch.randn(2, 1, 100, 100, 100)
test_output = net(test_input)
print(test_output.shape)
assert test_output.shape == torch.Size([2, 5])
def net_voxvggsimclr_test():
net = VoxVGG_SimCLR(out_dim=1024)
net.eval()
test_input = torch.randn(2, 1, 100, 100, 100)
test_output = net(test_input)
print(test_output.shape)
assert test_output.shape == torch.Size([2, 1024])
def net_voxresnet_test():
net = VoxResNet(class_nums=5)
net.eval()
test_input = torch.randn(2, 1, 100, 100, 100)
test_output = net(test_input)
print(test_output.shape)
assert test_output.shape == torch.Size([2, 5])
def net_voxresnetsimclr_test():
net = VoxResNet_SimCLR(out_dim=1024)
net.eval()
test_input = torch.randn(2, 1, 100, 100, 100)
test_output = net(test_input)
print(test_output.shape)
assert test_output.shape == torch.Size([2, 1024])
net_simple_test()
net_simplesimclr_test()
net_voxvgg_test()
net_voxvggsimclr_test()
net_voxresnet_test()
net_voxresnetsimclr_test()
from util import Util
print("voxvgg")
Util.cal_paramters(VoxVGG(class_nums=3))
print("voxresnet")
Util.cal_paramters(VoxResNet(class_nums=3))
print("simple3dcnn")
Util.cal_paramters(Simple3DCNN(class_nums=3))
print("simple3dcnn_simclr")
Util.cal_paramters(Simple3DCNN_SimCLR(128))
print("resnet18")
Util.cal_paramters(models.resnet18())
print("resnet50")
Util.cal_paramters(models.resnet50())