Skip to content

Commit 412baf8

Browse files
committed
update
1 parent 796874f commit 412baf8

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

fmpose/animals/models/graph_frames.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

fmpose/models/graph_frames.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ def __init__(self,
2626
self.dilation = dilation # 1
2727
self.seqlen = pad # 1
2828
self.get_edge(layout)
29-
self.hop_dis = get_hop_distance(self.num_node, self.edge, max_hop=max_hop) # [17,17], 相邻位1,本身为0,其他为inf
29+
self.hop_dis = get_hop_distance(self.num_node, self.edge, max_hop=max_hop) # [17,17], adjacent=1, self=0, others=inf
3030

3131
# get distance of each node to center
32-
self.dist_center = self.get_distance_to_center(layout) # dist_center 各个节点到joint7的距离s
32+
self.dist_center = self.get_distance_to_center(layout) # dist_center: distance from each node to joint 7
3333
self.get_adjacency(strategy)
3434

3535
def get_distance_to_center(self,layout):
@@ -54,7 +54,7 @@ def graph_link_between_frames(self,base):
5454
:param base:
5555
:return:
5656
"""
57-
return [((front) + i*self.num_node_each, (back)+ i*self.num_node_each) for i in range(self.seqlen) for (front, back) in base] # 把每一帧的关节点都连接起来
57+
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.
5858

5959

6060
def basic_layout(self,neighbour_base, sym_base):
@@ -162,16 +162,16 @@ def get_adjacency(self, strategy):
162162
else:
163163
raise ValueError("Do Not Exist This Strategy")
164164

165-
def get_hop_distance(num_node, edge, max_hop=1): # 建立邻接矩阵,相邻则置0
165+
def get_hop_distance(num_node, edge, max_hop=1): # Build adjacency matrix; neighbors set to 1.
166166
A = np.zeros((num_node, num_node))
167167
for i, j in edge:
168168
A[j, i] = 1
169169
A[i, j] = 1
170170
# compute hop steps
171171
hop_dis = np.zeros((num_node, num_node)) + np.inf
172-
transfer_mat = [np.linalg.matrix_power(A, d) for d in range(max_hop + 1)]# GET [I,A]; matrix_power计算矩阵次方 0次方对角线全1,1次方不动
172+
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)
173173
arrive_mat = (np.stack(transfer_mat) > 0) # [2,17,17]
174-
for d in range(max_hop, -1, -1): # preserve A(i,j) = 1 while A(i,i) = 0 相邻为1 对角为0
174+
for d in range(max_hop, -1, -1): # preserve A(i,j)=1 while A(i,i)=0; neighbors=1, diagonal=0
175175
hop_dis[arrive_mat[d]] = d
176176
return hop_dis
177177

0 commit comments

Comments
 (0)