tsaddev commited on
Commit
54362f5
·
1 Parent(s): a3527fc

Update app/Hackathon_setup/exp_recognition_model.py

Browse files
app/Hackathon_setup/exp_recognition_model.py CHANGED
@@ -18,8 +18,7 @@ logger = logging.get_logger("transformers")
18
  classes = {0: 'ANGER', 1: 'DISGUST', 2: 'FEAR', 3: 'HAPPINESS', 4: 'NEUTRAL', 5: 'SADNESS', 6: 'SURPRISE'}
19
 
20
  # Example Network
21
- class facExpRec(torch.nn.Module):
22
- def __init__(self, out_features=7):
23
  super().__init__()
24
 
25
  self.conv1 = self.convlayer(in_channels=1, out_channels=64, kernel_size=3)
@@ -28,19 +27,14 @@ class facExpRec(torch.nn.Module):
28
  self.conv4 = self.convlayer(in_channels=512, out_channels=512, kernel_size=3, max_pool=1)
29
 
30
  self.fc1 = self.fclayer(512, 256)
31
- self.fc2 = self.fclayer(256, 512)
32
- self.last = nn.Sequential(
33
- nn.Linear(512, 256),
34
- nn.ReLU(),
35
- nn.Linear(256, 7)
36
- )
37
 
38
  def convlayer(self, in_channels, out_channels, kernel_size, max_pool=2):
39
  return nn.Sequential(
40
  nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=1),
41
  nn.BatchNorm2d(out_channels),
42
  nn.ReLU(),
43
- nn.Dropout2d(),
44
  nn.MaxPool2d(kernel_size=max_pool),
45
  )
46
 
@@ -48,7 +42,7 @@ class facExpRec(torch.nn.Module):
48
  return nn.Sequential(
49
  nn.Linear(in_features, out_features),
50
  nn.BatchNorm1d(out_features),
51
- nn.Dropout1d(0.4),
52
  nn.ReLU(),
53
  )
54
 
@@ -61,7 +55,6 @@ class facExpRec(torch.nn.Module):
61
  x = x.view(-1, 512)
62
  x = self.fc1(x)
63
  x = self.fc2(x)
64
- x = self.last(x)
65
  return x
66
 
67
  # Sample Helper function
 
18
  classes = {0: 'ANGER', 1: 'DISGUST', 2: 'FEAR', 3: 'HAPPINESS', 4: 'NEUTRAL', 5: 'SADNESS', 6: 'SURPRISE'}
19
 
20
  # Example Network
21
+ def __init__(self, out_features=7):
 
22
  super().__init__()
23
 
24
  self.conv1 = self.convlayer(in_channels=1, out_channels=64, kernel_size=3)
 
27
  self.conv4 = self.convlayer(in_channels=512, out_channels=512, kernel_size=3, max_pool=1)
28
 
29
  self.fc1 = self.fclayer(512, 256)
30
+ self.fc2 = nn.Linear(256, 7)
 
 
 
 
 
31
 
32
  def convlayer(self, in_channels, out_channels, kernel_size, max_pool=2):
33
  return nn.Sequential(
34
  nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=1),
35
  nn.BatchNorm2d(out_channels),
36
  nn.ReLU(),
37
+ # nn.Dropout2d(),
38
  nn.MaxPool2d(kernel_size=max_pool),
39
  )
40
 
 
42
  return nn.Sequential(
43
  nn.Linear(in_features, out_features),
44
  nn.BatchNorm1d(out_features),
45
+ # nn.Dropout1d(0.4),
46
  nn.ReLU(),
47
  )
48
 
 
55
  x = x.view(-1, 512)
56
  x = self.fc1(x)
57
  x = self.fc2(x)
 
58
  return x
59
 
60
  # Sample Helper function