@@ -28,10 +28,10 @@ def __init__(self,
2828 self .dilation = dilation # 1
2929 self .seqlen = pad # 1
3030 self .get_edge (layout )
31- self .hop_dis = get_hop_distance (self .num_node , self .edge , max_hop = max_hop ) # [17,17], 相邻位1,本身为0,其他为inf
31+ self .hop_dis = get_hop_distance (self .num_node , self .edge , max_hop = max_hop ) # [17,17], adjacent=1, self=0, others=inf
3232
3333 # get distance of each node to center
34- self .dist_center = self .get_distance_to_center (layout ) # dist_center 各个节点到joint7的距离s
34+ self .dist_center = self .get_distance_to_center (layout ) # dist_center: distance from each node to joint 7
3535 self .get_adjacency (strategy )
3636
3737 def get_distance_to_center (self ,layout ):
@@ -78,7 +78,7 @@ def graph_link_between_frames(self,base):
7878 :param base:
7979 :return:
8080 """
81- return [((front ) + i * self .num_node_each , (back )+ i * self .num_node_each ) for i in range (self .seqlen ) for (front , back ) in base ] # 把每一帧的关节点都连接起来
81+ return [((front ) + i * self .num_node_each , (back )+ i * self .num_node_each ) for i in range (self .seqlen ) for (front , back ) in base ] # Connect joints across frames.
8282
8383
8484 def basic_layout (self ,neighbour_base , sym_base ):
@@ -274,16 +274,16 @@ def get_adjacency(self, strategy):
274274 else :
275275 raise ValueError ("Do Not Exist This Strategy" )
276276
277- def get_hop_distance (num_node , edge , max_hop = 1 ): # 建立邻接矩阵,相邻则置0
277+ def get_hop_distance (num_node , edge , max_hop = 1 ): # Build adjacency matrix; neighbors set to 1.
278278 A = np .zeros ((num_node , num_node ))
279279 for i , j in edge :
280280 A [j , i ] = 1
281281 A [i , j ] = 1
282282 # compute hop steps
283283 hop_dis = np .zeros ((num_node , num_node )) + np .inf
284- transfer_mat = [np .linalg .matrix_power (A , d ) for d in range (max_hop + 1 )]# GET [I,A]; matrix_power计算矩阵次方 0次方对角线全1,1次方不动
284+ transfer_mat = [np .linalg .matrix_power (A , d ) for d in range (max_hop + 1 )]# GET [I, A]; matrix_power computes powers (0th -> identity, 1st -> A)
285285 arrive_mat = (np .stack (transfer_mat ) > 0 ) # [2,17,17]
286- for d in range (max_hop , - 1 , - 1 ): # preserve A(i,j) = 1 while A(i,i) = 0 相邻为1 对角为0
286+ for d in range (max_hop , - 1 , - 1 ): # preserve A(i,j)= 1 while A(i,i)=0; neighbors=1, diagonal=0
287287 hop_dis [arrive_mat [d ]] = d
288288 return hop_dis
289289
0 commit comments