open-mmlab / mmskeleton

A OpenMMLAB toolbox for human pose estimation, skeleton-based action recognition, and action synthesis.
Apache License 2.0
2.92k stars 1.03k forks source link

A question about the adjacency matrix in origin_stgcn_repo/net/utils/graph.py #406

Open Pinocchioo opened 3 years ago

Pinocchioo commented 3 years ago

In paper "Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition" , there are three Paetition Strategies, and you apply no.3 K=3 Spatial configuration. In code (origin_stgcn_repo/net/utils/graph.py ) Class: Graph, function: get_adjacency, Spatial configuration make the adjacency matrix A is divided into three parts: A[0], A[1], A[2] by np.stack(). I don't know what the mean of this operation : A.append(a_root + a_close). Why you add a_root and a_close while hop == 1.According to this operation, A divided into: (1) A[0] = a_root(hop==0); (2) A[1] = a_root(hop == 1) + a_close(hop == 0); (3) A[2] = a_further(hop == 1). I don't understand why the sets of Centripetal point are equal: a_root(hop==1) + a_close(hop==1). image I don't know if anyone understands why? I hope someone can help me and answer it if you understand. Thank you very much.

henbucuoshanghai commented 2 years ago

for hop in valid_hop: a_root = np.zeros((self.num_node, self.num_node)) a_close = np.zeros((self.num_node, self.num_node)) a_further = np.zeros((self.num_node, self.num_node)) for i in range(self.num_node): for j in range(self.num_node): if self.hop_dis[j, i] == hop: if self.hop_dis[j, self.center] == self.hop_dis[ i, self.center]: a_root[j, i] = normalize_adjacency[j, i] elif self.hop_dis[j, self.center] > self.hop_dis[ i, self.center]: a_close[j, i] = normalize_adjacency[j, i] else: a_further[j, i] = normalize_adjacency[j, i] if hop == 0: A.append(a_root) else: A.append(a_root + a_close) A.append(a_further)

henbucuoshanghai commented 2 years ago

me too,why A is got by this way?

yjxiong commented 2 years ago

Note that there is a condition on hop != 0 when A.append(a_root + a_close) is executed. Depending on the value of hop in the outer loop, a_root may contain the nodes that have the same distance to the "body center" node, these nodes are either: 1) the "self" which obviously has a hop distance of 0 to "self"; or 2) the neighboring nodes that happen to have the same hop distance as the "self" to the "body center". You can see that the latter type of nodes will have non-zero hop distance to "self". The definition of Centripetal group is neighbors that are closer to the body center than the self, which includes < and = in terms of hop distance to the body center node.

Thus it is represented by a_root + a_close, meaning neighbor nodes with the specified hop distance to self which have the same or lower hop distance to the center node than self.