CrosNNCLR:用于自监督动作表示的跨视图最近邻对比学习框架
1. CrosNNCLR算法伪代码
CrosNNCLR是一种用于自监督动作表示学习的方法,其核心算法的伪代码如下:
# Query, Key: encoder network
# N: batch size
# MB: memory bank(queue)
# t: temperature
for x in loader:
x1, x2 = aug(x), aug(x) # random augmentation
z1, z2 = Query(x1), Key(x2) # obtain the encoded features
h1, h2, mb = normalize(z1), normalize(z2), normalize(MB) # l2-normalize
NN1 = NN(h1, mb) # cross-view the nearest neighbor index
NN2 = NN(h2, mb) # cross-view the nearest neighbor index
loss = L(NN1, h2, h1)/2 + L(NN2, h1, h2)/2 # Loss_CrosNNCLR
loss.backward() # back-propagate
update([Query.params, Key.params]) # SGD update
update_queue(MB, z2)
def L(nn, c, d, t=0.07):
logits_cd = mm(c,
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



