yrcong / STTran

Spatial-Temporal Transformer for Dynamic Scene Graph Generation, ICCV2021
MIT License
187 stars 34 forks source link

关于模型 #11

Closed ZihaoZheng98 closed 2 years ago

ZihaoZheng98 commented 3 years ago

嗨 ,又打扰你了,想请教一下关于论文模型的部分,,,,老师让我明天向他汇报,,看代码应该是来不及了,麻烦您了!! 我知道模型的大概过程是首先使用self attention得到每个帧中,关系的上下文表示。然后得到T个大X,每个大X看论文应该是 K(t)1936,然后按照论文中的说法是u个frame,那就是 Z = uK(t)*1936.然后再decoder阶段,是如何对Z做attention的呢? 总结的话 有三个疑问: 一个是 Z如何和Ef相加,是将Ei与所有K(t)相加吗? 第二个是如何对Z做attention?是将每个帧中所有x^k_t融合成一个表示还是怎么做attention?第三个是,我最常见到的transformer decoder都是K和V一致,这里采用Q和K一致是基于什么考虑呢?

yrcong commented 3 years ago

最近在出差😂

1.在temporal decoder中 u个frame的relationships被组合成一个batch,在来自相同帧的relationships上加上相同的frame encoding。

  1. Z相当于一个sequence,由来自不同帧的relationships组成。When you have for example 3 relations (in the first frame) and 5 relations (in the second frame), the attention weight matrix will be 8x8 (window length=2).
  2. 一般的decoder中的attention通常已经不是self-attention而是cross-attention。但是对于我们的idea,还是来自不同帧的relationships之间做self attention,因此Q与K保持一致。