-
Notifications
You must be signed in to change notification settings - Fork 1
/
cnn_architectures.py
68 lines (63 loc) · 3.31 KB
/
cnn_architectures.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
class Architectures():
'''Helper class that returns python dictionary containing
shapes for CNN layers
'''
def xsmall(kernel_size, n_classes):
return {'conv1' : [kernel_size, kernel_size, 1, 32],
'conv2' : [kernel_size, kernel_size, 32, 64],
'conv3' : [kernel_size, kernel_size, 64, 128],
'conv4' : [kernel_size, kernel_size, 128, 128],
'conv5' : [kernel_size, kernel_size, 128, 128],
'conv5_1' : [kernel_size, kernel_size, 128, 256],
'conv5_2' : [kernel_size, kernel_size, 256, 256],
'fc1' : [0, 2048],
'fc2' : [2048, n_classes],
}
def fat_shallow(kernel_size, n_classes):
return {'conv1' : [kernel_size, kernel_size, 1, 64],
'conv2' : [kernel_size, kernel_size, 64, 128],
'conv3' : [kernel_size, kernel_size, 128, 256],
'conv4' : [kernel_size, kernel_size, 256, 512],
'conv4_1' : [kernel_size, kernel_size, 256, 512],
'fc1' : [0, 2048],
'fc1_1' : [2048, 2048],
'fc2' : [2048, n_classes],
}
def slim_deep(kernel_size, n_classes):
return {'conv1' : [kernel_size, kernel_size, 1, 32],
'conv2' : [kernel_size, kernel_size, 32, 64],
'conv3' : [kernel_size, kernel_size, 64, 64],
'conv4' : [kernel_size, kernel_size, 64, 64],
'conv5' : [kernel_size, kernel_size, 64, 64],
'conv6' : [kernel_size, kernel_size, 64, 64],
'conv7' : [kernel_size, kernel_size, 64, 64],
'conv8' : [kernel_size, kernel_size, 64, 64],
'conv9' : [kernel_size, kernel_size, 64, 64],
'fc1' : [0, 2048],
'fc2' : [2048, n_classes],
}
def vgg16_skipped(kernel_size, n_classes):
return {'conv1_1' : [kernel_size, kernel_size, 1, 64],
'conv2_1' : [kernel_size, kernel_size, 64, 128],
'conv3_1' : [kernel_size, kernel_size, 128, 256],
'conv4_1' : [kernel_size, kernel_size, 256, 512],
'conv5_1' : [kernel_size, kernel_size, 512, 512],
'fc1' : [kernel_size*kernel_size*512, 4096],
'fc2' : [4096, n_classes]}
def vgg16(self):
return {'conv1_1' : [kernel_size, kernel_size, 1, 64],
'conv1_2' : [kernel_size, kernel_size, 64, 64],
'conv2_1' : [kernel_size, kernel_size, 64, 128],
'conv2_2' : [kernel_size, kernel_size, 128, 128],
'conv3_1' : [kernel_size, kernel_size, 128, 256],
'conv3_2' : [kernel_size, kernel_size, 256, 256],
'conv3_3' : [kernel_size, kernel_size, 256, 256],
'conv4_1' : [kernel_size, kernel_size, 256, 512],
'conv4_2' : [kernel_size, kernel_size, 512, 512],
'conv4_3' : [kernel_size, kernel_size, 512, 512],
'conv5_1' : [kernel_size, kernel_size, 512, 512],
'conv5_2' : [kernel_size, kernel_size, 512, 512],
'conv5_3' : [kernel_size, kernel_size, 512, 512],
'fc1' : [kernel_size*kernel_size*512, 4096],
'fc2' : [4096, 4096],
'fc3' : [4096, n_classes]}