mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-25 01:42:36 +08:00
Merge 14e7ca7dc8 into 3086026401
This commit is contained in:
commit
99d297aa79
@ -252,6 +252,10 @@ class KeypointDraw:
|
|||||||
|
|
||||||
Y = [keypoints[idx1][0], keypoints[idx2][0]]
|
Y = [keypoints[idx1][0], keypoints[idx2][0]]
|
||||||
X = [keypoints[idx1][1], keypoints[idx2][1]]
|
X = [keypoints[idx1][1], keypoints[idx2][1]]
|
||||||
|
|
||||||
|
if math.isnan(X[0]) or math.isnan(X[1]) or math.isnan(Y[0]) or math.isnan(Y[1]):
|
||||||
|
continue
|
||||||
|
|
||||||
mX, mY = (X[0] + X[1]) / 2, (Y[0] + Y[1]) / 2
|
mX, mY = (X[0] + X[1]) / 2, (Y[0] + Y[1]) / 2
|
||||||
length = math.sqrt((X[0] - X[1]) ** 2 + (Y[0] - Y[1]) ** 2)
|
length = math.sqrt((X[0] - X[1]) ** 2 + (Y[0] - Y[1]) ** 2)
|
||||||
|
|
||||||
@ -269,6 +273,8 @@ class KeypointDraw:
|
|||||||
for i in range(18):
|
for i in range(18):
|
||||||
if scores is not None and scores[i] < threshold:
|
if scores is not None and scores[i] < threshold:
|
||||||
continue
|
continue
|
||||||
|
if math.isnan(keypoints[i][0]) or math.isnan(keypoints[i][1]):
|
||||||
|
continue
|
||||||
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
||||||
if 0 <= x < W and 0 <= y < H:
|
if 0 <= x < W and 0 <= y < H:
|
||||||
self.draw.circle(canvas, (x, y), 4, self.colors[i % len(self.colors)], thickness=-1)
|
self.draw.circle(canvas, (x, y), 4, self.colors[i % len(self.colors)], thickness=-1)
|
||||||
@ -278,6 +284,8 @@ class KeypointDraw:
|
|||||||
for i in range(18, 24):
|
for i in range(18, 24):
|
||||||
if scores is not None and scores[i] < threshold:
|
if scores is not None and scores[i] < threshold:
|
||||||
continue
|
continue
|
||||||
|
if math.isnan(keypoints[i][0]) or math.isnan(keypoints[i][1]):
|
||||||
|
continue
|
||||||
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
||||||
if 0 <= x < W and 0 <= y < H:
|
if 0 <= x < W and 0 <= y < H:
|
||||||
self.draw.circle(canvas, (x, y), 4, self.colors[i % len(self.colors)], thickness=-1)
|
self.draw.circle(canvas, (x, y), 4, self.colors[i % len(self.colors)], thickness=-1)
|
||||||
@ -291,6 +299,9 @@ class KeypointDraw:
|
|||||||
if scores[idx1] < threshold or scores[idx2] < threshold:
|
if scores[idx1] < threshold or scores[idx2] < threshold:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if math.isnan(keypoints[idx1][0]) or math.isnan(keypoints[idx1][1]) or math.isnan(keypoints[idx2][0]) or math.isnan(keypoints[idx2][1]):
|
||||||
|
continue
|
||||||
|
|
||||||
x1, y1 = int(keypoints[idx1][0]), int(keypoints[idx1][1])
|
x1, y1 = int(keypoints[idx1][0]), int(keypoints[idx1][1])
|
||||||
x2, y2 = int(keypoints[idx2][0]), int(keypoints[idx2][1])
|
x2, y2 = int(keypoints[idx2][0]), int(keypoints[idx2][1])
|
||||||
|
|
||||||
@ -305,6 +316,8 @@ class KeypointDraw:
|
|||||||
for i in range(92, 113):
|
for i in range(92, 113):
|
||||||
if scores is not None and scores[i] < threshold:
|
if scores is not None and scores[i] < threshold:
|
||||||
continue
|
continue
|
||||||
|
if math.isnan(keypoints[i][0]) or math.isnan(keypoints[i][1]):
|
||||||
|
continue
|
||||||
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
||||||
if x > eps and y > eps and 0 <= x < W and 0 <= y < H:
|
if x > eps and y > eps and 0 <= x < W and 0 <= y < H:
|
||||||
self.draw.circle(canvas, (x, y), 4, (0, 0, 255), thickness=-1)
|
self.draw.circle(canvas, (x, y), 4, (0, 0, 255), thickness=-1)
|
||||||
@ -318,6 +331,9 @@ class KeypointDraw:
|
|||||||
if scores[idx1] < threshold or scores[idx2] < threshold:
|
if scores[idx1] < threshold or scores[idx2] < threshold:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if math.isnan(keypoints[idx1][0]) or math.isnan(keypoints[idx1][1]) or math.isnan(keypoints[idx2][0]) or math.isnan(keypoints[idx2][1]):
|
||||||
|
continue
|
||||||
|
|
||||||
x1, y1 = int(keypoints[idx1][0]), int(keypoints[idx1][1])
|
x1, y1 = int(keypoints[idx1][0]), int(keypoints[idx1][1])
|
||||||
x2, y2 = int(keypoints[idx2][0]), int(keypoints[idx2][1])
|
x2, y2 = int(keypoints[idx2][0]), int(keypoints[idx2][1])
|
||||||
|
|
||||||
@ -332,6 +348,8 @@ class KeypointDraw:
|
|||||||
for i in range(113, 134):
|
for i in range(113, 134):
|
||||||
if scores is not None and i < len(scores) and scores[i] < threshold:
|
if scores is not None and i < len(scores) and scores[i] < threshold:
|
||||||
continue
|
continue
|
||||||
|
if math.isnan(keypoints[i][0]) or math.isnan(keypoints[i][1]):
|
||||||
|
continue
|
||||||
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
||||||
if x > eps and y > eps and 0 <= x < W and 0 <= y < H:
|
if x > eps and y > eps and 0 <= x < W and 0 <= y < H:
|
||||||
self.draw.circle(canvas, (x, y), 4, (0, 0, 255), thickness=-1)
|
self.draw.circle(canvas, (x, y), 4, (0, 0, 255), thickness=-1)
|
||||||
@ -342,6 +360,8 @@ class KeypointDraw:
|
|||||||
for i in range(24, 92):
|
for i in range(24, 92):
|
||||||
if scores is not None and scores[i] < threshold:
|
if scores is not None and scores[i] < threshold:
|
||||||
continue
|
continue
|
||||||
|
if math.isnan(keypoints[i][0]) or math.isnan(keypoints[i][1]):
|
||||||
|
continue
|
||||||
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
x, y = int(keypoints[i][0]), int(keypoints[i][1])
|
||||||
if x > eps and y > eps and 0 <= x < W and 0 <= y < H:
|
if x > eps and y > eps and 0 <= x < W and 0 <= y < H:
|
||||||
self.draw.circle(canvas, (x, y), face_point_size, (255, 255, 255), thickness=-1)
|
self.draw.circle(canvas, (x, y), face_point_size, (255, 255, 255), thickness=-1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user