Speed up preprocessing.

This commit is contained in:
Daniel
2024-11-29 16:19:06 +01:00
parent 93d4611a91
commit 1b5e0c44e3
4 changed files with 24 additions and 21 deletions
+2 -1
View File
@@ -199,7 +199,8 @@ class TopDown:
# See: /mmpose/models/pose_estimators/topdown.py - add_pred_to_datasample()
th, tw = region.shape[:2]
bw, bh = [p.box[2] - p.box[0], p.box[3] - p.box[1]]
kp[:, :2] = kp[:, :2] / np.array([tw, th]) * np.array([bw, bh])
kp[:, :2] /= np.array([tw, th])
kp[:, :2] *= np.array([bw, bh])
kp[:, :2] += np.array([p.box[0] + bw / 2, p.box[1] + bh / 2])
kp[:, :2] -= 0.5 * np.array([bw, bh])