Algorithm 1.
ImageGCN batch propagation algorithm.
Require: | |
graph node set V and the mini-batch B; | |
relation adjacency matrix Ar, r ∈ R; | |
input image features X (can be stored externally); | |
network depth K; | |
number of neighbors to sample for each node and each relation n. | |
Ensure: The representation of all samples in B | |
1: | B(K) ← B |
2: | for k = K · · · 1 do |
3: | B(k−1) ← B(k) |
4: | for r ∈ R do |
5: | for v ∈ B(k) do |
6: | Nr (v) ← the neighbor set of v based on Ar |
7: | n ← min(n, |Nr(v)|) |
8: | S ← random n samples from Nr(v) without replacement |
9: | B(k−1) ← B(k−1) ∪ S |
10: | end for |
11: | end for |
12: | end for |
13: | load the features H(0) for B(0) from X |
14: | for r ∈ R do |
15: | ← the sub-matrix corresponding to B(0) in the adjacency matrix Ar |
16: | end for |
17: | execute Eq. 8 with , for k = 0, · · ·, K − 1 |
18: | extract the representations of samples in B from H(K) |