MCPcopy Create free account
hub / github.com/ICTMCG/FakeSV / VideoEncoder

Class VideoEncoder

code/models/FANVM.py:40–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39
40class VideoEncoder(nn.Module):
41 def __init__(self,emb_dim,fea_dim):
42 super(VideoEncoder, self).__init__()
43
44 self.emb_dim = emb_dim
45 self.linear1 = torch.nn.Linear(self.emb_dim, self.emb_dim, bias=False)
46 self.linear2 = nn.Sequential(torch.nn.Linear(self.emb_dim, fea_dim),torch.nn.ReLU())
47
48 def forward(self, input_thumb, input_L):
49 input_ALL = torch.cat((input_L, input_thumb),1) #(bs,len+1,4096)
50 fea_A = torch.bmm(input_thumb,self.linear1(input_ALL).permute(0,2,1)) # (bs, 1, len+1)
51 fea_alpha = F.softmax(fea_A) # (bs, 1, len+1)
52 fea_V = torch.matmul(fea_alpha,input_ALL).squeeze() # (bs, 4096)
53 fea = self.linear2(fea_V)
54 return fea
55
56class ReverseLayerF(Function):
57 #@staticmethod

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected