-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.py
35 lines (32 loc) · 941 Bytes
/
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
import torch.nn as nn
class SteeringModel(nn.Module):
def __init__(self):
super().__init__()
self.conv_layers = nn.Sequential(
nn.Conv2d(3, 24, 5, 2), # 3 channels for RGB
nn.ELU(),
nn.Conv2d(24, 36, 5, 2),
nn.ELU(),
nn.Conv2d(36, 48, 5, 2),
nn.ELU(),
nn.Conv2d(48, 64, 3),
nn.ELU(),
nn.Conv2d(64, 64, 3),
nn.ELU(),
)
self.flatten = nn.Flatten()
self.linear_layers = nn.Sequential(
nn.Linear(64 * 1 * 18, 100),
nn.ELU(),
nn.Linear(100, 50),
nn.ELU(),
nn.Linear(50, 10),
nn.ELU(),
nn.Linear(10, 1)
)
def forward(self, x):
conv = self.conv_layers(x)
flattened = self.flatten(conv)
out = self.linear_layers(flattened)
return out