-
Notifications
You must be signed in to change notification settings - Fork 1
/
classificationArch.py
146 lines (113 loc) · 4.12 KB
/
classificationArch.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import torch.nn as nn
import torch.nn.functional as F
class classArch(nn.Module):
def __init__(self):
super(classArch,self).__init__()
self.conv1 = nn.Conv2d(3,32,3,stride=1,padding=1)
self.conv1Batch = nn.BatchNorm2d(32)
self.conv2 = nn.Conv2d(32,64,3,padding=1)
self.conv2Batch = nn.BatchNorm2d(64)
self.conv3 = nn.Conv2d(64,128,3,padding=1)
self.conv3Batch = nn.BatchNorm2d(128)
# self.conv4 = nn.Conv2d(128,64,1,padding=1)
self.conv4 = nn.Conv2d(128,64,1)
self.conv4Batch = nn.BatchNorm2d(64)
self.conv5 = nn.Conv2d(64,128,3,padding=1)
self.conv5Batch = nn.BatchNorm2d(128)
self.conv6 = nn.Conv2d(128,256,3,padding=1)
self.conv6Batch = nn.BatchNorm2d(256)
# self.conv7 = nn.Conv2d(256,128,1,padding=1)
self.conv7 = nn.Conv2d(256,128,1)
self.conv7Batch = nn.BatchNorm2d(128)
self.conv8 = nn.Conv2d(128,256,3,padding=1)
self.conv8Batch = nn.BatchNorm2d(256)
self.conv9 = nn.Conv2d(256,512,3,padding=1)
self.conv9Batch = nn.BatchNorm2d(512)
# self.conv10 = nn.Conv2d(512,256,1,padding=1)
self.conv10 = nn.Conv2d(512,256,1)
self.conv10Batch = nn.BatchNorm2d(256)
self.conv11 = nn.Conv2d(256,512,3,padding=1)
self.conv11Batch = nn.BatchNorm2d(512)
# self.conv12 = nn.Conv2d(512,256,1,padding=1)
self.conv12 = nn.Conv2d(512,256,1)
self.conv12Batch = nn.BatchNorm2d(256)
self.conv13 = nn.Conv2d(256,512,3,padding=1)
self.conv13Batch = nn.BatchNorm2d(512)
self.conv14 = nn.Conv2d(512,1024,3,padding=1)
self.conv14Batch = nn.BatchNorm2d(1024)
# self.conv15 = nn.Conv2d(1024,512,1,padding=1)
self.conv15 = nn.Conv2d(1024,512,1)
self.conv15Batch = nn.BatchNorm2d(512)
self.conv16 = nn.Conv2d(512,1024,3,padding=1)
self.conv16Batch = nn.BatchNorm2d(1024)
# self.conv17 = nn.Conv2d(1024,512,1,padding=1)
self.conv17 = nn.Conv2d(1024,512,1)
self.conv17Batch = nn.BatchNorm2d(512)
self.conv18 = nn.Conv2d(512,1024,3,padding=1)
self.conv18Batch = nn.BatchNorm2d(1024)
self.conv19 = nn.Conv2d(1024,1000,1)
def forward(self,x):
x = self.conv1(x)
x = F.leaky_relu(x,0.1)
x = self.conv1Batch(x)
x = F.max_pool2d(x,2,2)
x = self.conv2(x)
x = F.leaky_relu(x,0.1)
x = self.conv2Batch(x)
x = F.max_pool2d(x,2,2)
x = self.conv3(x)
x = F.leaky_relu(x,0.1)
x = self.conv3Batch(x)
x = self.conv4(x)
x = F.leaky_relu(x,0.1)
x = self.conv4Batch(x)
x = self.conv5(x)
x = F.leaky_relu(x,0.1)
x = self.conv5Batch(x)
x = F.max_pool2d(x,2,2)
x = self.conv6(x)
x = F.leaky_relu(x,0.1)
x = self.conv6Batch(x)
x = self.conv7(x)
x = F.leaky_relu(x,0.1)
x = self.conv7Batch(x)
x = self.conv8(x)
x = F.leaky_relu(x,0.1)
x = self.conv8Batch(x)
x = F.max_pool2d(x,2,2)
x = self.conv9(x)
x = F.leaky_relu(x,0.1)
x = self.conv9Batch(x)
x = self.conv10(x)
x = F.leaky_relu(x,0.1)
x = self.conv10Batch(x)
x = self.conv11(x)
x = F.leaky_relu(x,0.1)
x = self.conv11Batch(x)
x = self.conv12(x)
x = F.leaky_relu(x,0.1)
x = self.conv12Batch(x)
x = self.conv13(x)
x = F.leaky_relu(x,0.1)
x = self.conv13Batch(x)
x = F.max_pool2d(x,2,2)
x = self.conv14(x)
x = F.leaky_relu(x,0.1)
x = self.conv14Batch(x)
x = self.conv15(x)
x = F.leaky_relu(x,0.1)
x = self.conv15Batch(x)
x = self.conv16(x)
x = F.leaky_relu(x,0.1)
x = self.conv16Batch(x)
x = self.conv17(x)
x = F.leaky_relu(x,0.1)
x = self.conv17Batch(x)
x = self.conv18(x)
x = F.leaky_relu(x,0.1)
x = self.conv18Batch(x)
x = self.conv19(x)
x = F.leaky_relu(x,0.1)
x = F.avg_pool2d(x,7,1)
x = x.view(-1,1000)
return x