-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
35 lines (31 loc) · 1.14 KB
/
model.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
import torch.nn
class FishermanModel(torch.nn.Module):
def __init__(self, out_features):
super().__init__()
self.out_features = out_features
self.alex_net = torch.nn.Sequential(
torch.nn.Conv2d(3, 96, 11, 4),
torch.nn.ReLU(),
torch.nn.MaxPool2d(3, 2),
torch.nn.Conv2d(96, 256, 5, stride=1, padding=2),
torch.nn.ReLU(),
torch.nn.MaxPool2d(3, 2),
torch.nn.Conv2d(256, 384, 3, stride=1, padding=1),
torch.nn.ReLU(),
torch.nn.Conv2d(384, 384, 3, stride=1, padding=1),
torch.nn.ReLU(),
torch.nn.Conv2d(384, 256, 3, stride=1, padding=1),
torch.nn.ReLU(),
torch.nn.MaxPool2d(3, 2),
torch.nn.Dropout2d(0.5),
torch.nn.Flatten(),
torch.nn.Linear(9216, 4096),
torch.nn.ReLU(),
torch.nn.Dropout2d(0.5),
torch.nn.Linear(4096, 4096),
torch.nn.ReLU(),
torch.nn.Linear(4096, out_features),
torch.nn.Softmax(dim=1),
)
def forward(self, x):
return self.alex_net(x)