檢視內神經網路架構

torchsummary

1
2
3
4
5
6
7
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = SuperPointNet_gauss2()
model = model.to(device)

# check keras-like model summary using torchsummary
from torchsummary import summary
summary(model, input_size=(1, 240, 320))

模型參數

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
   Layer (type)             Output Shape           Param #
Conv2d-1 [-1, 64, 240, 320] 640
BatchNorm2d-2 [-1, 64, 240, 320] 128
ReLU-3 [-1, 64, 240, 320] 0
Conv2d-4 [-1, 64, 240, 320] 36,928
BatchNorm2d-5 [-1, 64, 240, 320] 128
ReLU-6 [-1, 64, 240, 320] 0
double_conv-7 [-1, 64, 240, 320] 0
inconv-8 [-1, 64, 240, 320] 0
MaxPool2d-9 [-1, 64, 120, 160] 0
Conv2d-10 [-1, 64, 120, 160] 36,928
BatchNorm2d-11 [-1, 64, 120, 160] 128
ReLU-12 [-1, 64, 120, 160] 0
Conv2d-13 [-1, 64, 120, 160] 36,928
BatchNorm2d-14 [-1, 64, 120, 160] 128
ReLU-15 [-1, 64, 120, 160] 0
double_conv-16 [-1, 64, 120, 160] 0
down-17 [-1, 64, 120, 160] 0
MaxPool2d-18 [-1, 64, 60, 80] 0
Conv2d-19 [-1, 128, 60, 80] 73,856
BatchNorm2d-20 [-1, 128, 60, 80] 256
ReLU-21 [-1, 128, 60, 80] 0
Conv2d-22 [-1, 128, 60, 80] 147,584
BatchNorm2d-23 [-1, 128, 60, 80] 256
ReLU-24 [-1, 128, 60, 80] 0
double_conv-25 [-1, 128, 60, 80] 0
down-26 [-1, 128, 60, 80] 0
MaxPool2d-27 [-1, 128, 30, 40] 0
Conv2d-28 [-1, 128, 30, 40] 147,584
BatchNorm2d-29 [-1, 128, 30, 40] 256
ReLU-30 [-1, 128, 30, 40] 0
Conv2d-31 [-1, 128, 30, 40] 147,584
BatchNorm2d-32 [-1, 128, 30, 40] 256
ReLU-33 [-1, 128, 30, 40] 0
double_conv-34 [-1, 128, 30, 40] 0
down-35 [-1, 128, 30, 40] 0
Conv2d-36 [-1, 256, 30, 40] 295,168
BatchNorm2d-37 [-1, 256, 30, 40] 512
ReLU-38 [-1, 256, 30, 40] 0
Conv2d-39 [-1, 65, 30, 40] 16,705
BatchNorm2d-40 [-1, 65, 30, 40] 130
Conv2d-41 [-1, 256, 30, 40] 295,168
BatchNorm2d-42 [-1, 256, 30, 40] 512
ReLU-43 [-1, 256, 30, 40] 0
Conv2d-44 [-1, 256, 30, 40] 65,792
BatchNorm2d-45 [-1, 256, 30, 40] 512
Conv2d-46 [-1, 256, 30, 40] 65,792
Conv2d-47 [-1, 256, 30, 40] 65,792
Conv2d-48 [-1, 256, 30, 40] 65,792
LinearAttentionX-49 [-1, 256, 30, 40] 0

參考資料