-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
39 lines (32 loc) · 1.01 KB
/
model.py
File metadata and controls
39 lines (32 loc) · 1.01 KB
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
import torch
import torch.nn as nn
# 모델 아키텍처 정의
class HandStateNN(nn.Module):
def __init__(self, n_classes):
super(HandStateNN, self).__init__()
self.network = nn.Sequential(
nn.Linear(63, 256),
nn.ReLU(),
nn.BatchNorm1d(256),
nn.Dropout(0.1),
# nn.Linear(256, 512),
# nn.ReLU(),
# nn.BatchNorm1d(512),
# nn.Dropout(0.5),
# nn.Linear(512, 256),
# nn.ReLU(),
# nn.BatchNorm1d(256),
# nn.Dropout(0.5),
nn.Linear(256, 128),
nn.ReLU(),
nn.BatchNorm1d(128),
nn.Dropout(0.1),
nn.Linear(128, 64),
nn.ReLU(),
nn.Linear(64, n_classes)
)
def forward(self, x):
return self.network(x)
model = HandStateNN(n_classes=5)
model.load_state_dict(torch.load('./model/best_model.pth'))
model.eval()