forked from serenayj/evoquer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassifiers.py
More file actions
40 lines (32 loc) · 948 Bytes
/
classifiers.py
File metadata and controls
40 lines (32 loc) · 948 Bytes
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
40
"""
src: https://github.com/eriklindernoren/Action-Recognition/blob/master/models.py
"""
import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
from torch.autograd import Variable
class AcClassifier(nn.Module):
def __init__(self, in_features, num_classes, latent_dim):
super(AcClassifier, self).__init__()
self.final = nn.Sequential(
nn.Linear(in_features, latent_dim),
nn.BatchNorm1d(latent_dim, momentum=0.01),
nn.Linear(latent_dim, num_classes),
nn.Softmax(dim=-1),
)
def forward(self, x):
x = self.final(x)
return x
class ObjClassifier(nn.Module):
def __init__(self, in_features, num_classes, latent_dim):
super(ObjClassifier, self).__init__()
self.final = nn.Sequential(
nn.Linear(in_features, latent_dim),
nn.BatchNorm1d(latent_dim, momentum=0.01),
nn.Linear(latent_dim, num_classes),
nn.Softmax(dim=-1),
)
def forward(self, x):
x = self.final(x)
return x