MCPcopy Create free account
hub / github.com/IgaoGuru/Sequoia / Heavy_Classifier

Class Heavy_Classifier

light_classifier.py:61–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 return x
60
61class Heavy_Classifier(torch.nn.Module):
62 def __init__(self):
63 super(Heavy_Classifier, self).__init__()
64 self.conv1 = self.conv_block(c_in = 3, c_out = 25, kernel_size = 7, stride = 1, padding = 1)
65 self.conv2 = self.conv_block(c_in = 25, c_out = 40, kernel_size = 5, stride = 1, padding = 1)
66 self.conv3 = self.conv_block(c_in = 40, c_out = 40, kernel_size = 5, stride = 1, padding = 1)
67 self.conv4 = self.conv_block(c_in = 40, c_out = 25, kernel_size = 3, stride = 1, padding = 1)
68 self.conv5 = self.conv_block(c_in = 25, c_out = 25, kernel_size = 3, stride = 1, padding = 1)
69 self.conv6 = self.conv_block(c_in = 25, c_out = 3, kernel_size = 3, stride = 1, padding = 1)
70 # 28px --> ???
71 # 32px --> 3
72 # 100px --> 48 (heavy)
73 self.bigN = 3
74 self.fc1 = nn.Linear(self.bigN, 64)
75 self.fc2 = nn.Linear(64, 9)
76 self.fc3 = nn.Linear(9, 2)
77 self.maxpool = nn.MaxPool2d(kernel_size=2, stride=2)
78
79 def conv_block(self, c_in, c_out, dropout=0.1, kernel_size=3, stride=1, **kwargs):
80 seq_block = nn.Sequential(
81 nn.Conv2d(in_channels=c_in, out_channels=c_out, kernel_size=kernel_size, **kwargs),
82 nn.BatchNorm2d(num_features=c_out),
83 nn.ReLU(),
84 nn.Dropout2d(p=dropout)
85 )
86 return seq_block
87
88 def forward(self, x):
89 x = self.conv1(x)
90 x = self.maxpool(x)
91 x = self.conv2(x)
92 x = self.conv3(x)
93 x = self.maxpool(x)
94 x = self.conv4(x)
95 x = self.conv5(x)
96 x = self.maxpool(x)
97 x = self.conv6(x)
98 x = self.maxpool(x)
99 x = x.reshape((-1, self.bigN))
100
101 x = F.relu(self.fc1(x))
102 x = F.relu(self.fc2(x))
103 x = F.relu(self.fc3(x))
104 # x = F.relu(x)
105 # x = torch.sigmoid(self.fc3(x))
106 return x
107
108class Ultra_Light_Classifier(torch.nn.Module):
109 def __init__(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected