MCPcopy Create free account
hub / github.com/KerenLab/CellSighter / Model

Class Model

model.py:6–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class Model(nn.Module):
7 def __init__(self, input_len, num_classes):
8 super(Model, self).__init__()
9 self.model = models.resnet50(num_classes=num_classes)
10 self.model.conv1 = torch.nn.Conv2d(input_len, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
11
12 ##Weights init
13 nn.init.kaiming_normal_(self.model.conv1.weight, mode='fan_out', nonlinearity='relu')
14
15 self.softmax = nn.Softmax(dim=1)
16
17 def forward(self, x):
18 x = self.model(x)
19 if not self.training:
20 x = self.softmax(x)
21 return x

Callers 2

eval.pyFile · 0.90
train.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected