wenwenyu / PICK-pytorch

Code for the paper "PICK: Processing Key Information Extraction from Documents using Improved Graph Learning-Convolutional Networks" (ICPR 2020)
https://arxiv.org/abs/2004.07464
MIT License
556 stars 193 forks source link

在图卷积中,将节点的特征信息直接和节点间的关联特征直接相加?这么做是不是有点粗暴? #12

Closed cos0sin0 closed 4 years ago

cos0sin0 commented 4 years ago

# update hidden features between nodes, (B, N, N, in_dim) H = F.relu(x_i + x_j + alpha + self.bias_h)

wenwenyu commented 4 years ago

@cos0sin0 此处得到的结果是节点之间的hidden features,完整实现是

x_i = torch.einsum('bijd, dk->bijk', x_i, self.w_vi) x_j = torch.einsum('bijd, dk->bijk', x_j, self.w_vj)

update hidden features between nodes, (B, N, N, in_dim)

H = F.relu(x_i + x_j + alpha + self.bias_h)

节点特征和关系特征在相加之前,节点特征做了特征变换,对应paper中的公式(10)。hidden features代表的含义在paper中定义为节点之间的视觉特征和关系特征之和,即是在node-edge-node三元组上聚合特征,而聚合的操作当然有很多方式,我们只是采用了最简单的sum方式。而得到的hidden features是为了通过图卷积操作更新节点特征。

cos0sin0 commented 4 years ago

哦哦,明白了,非常感谢