Algorithm 2 Contrastive Sample Identification (CSI) Task |
Require: Positive video features , Positive text features , Negative text features , Negative video features
Ensure: Binary classification of fused features as matching or mismatching
1: function FindMostSimilarNegativeSample(, , )
2:
3:
4: for each in do
5:
6: if then
7:
8:
9: end if
10: end for
11: return
12: end function
13: function FuseFeatures(v, t)
14: AddEncToken(t) ▹ Prepend ‘enc_token’ to text feature
15: ▹ Input text to BERT and video feature to Cross Attention
16: return f ▹ Output from BERT corresponding to enc_token
17: end function
18: function ContrastiveSampleIdentification(, , , )
19:
20:
21:
22:
23:
24:
25:
26: Append to
27: Append and to
28: for each in do
29:
30: if is in then
31: Expect to be 1
32: else
33: Expect to be 0
34: end if
35: end for
36: end function
|