[merger] speed up numpy conversion

This commit is contained in:
Jan Grewe 2025-01-28 09:33:19 +01:00
parent 456bd16a59
commit b679aa0313

View File

@ -56,10 +56,7 @@ class Merger(QRunnable):
numpy.ndarray
2D array, Coordinates of the bounding box for each detection. Shape: (num_detections, 4) x1, y1, x2, y2
"""
x = lambda kp: np.array([float(kpp) for kpp in kp[1:-1].split(",")])
logging.info("Converting to numpy ...")
# from IPython import embed
# embed()
dimensions = 2
key_columns = [c for c in df.columns if "key_" in c]
box_columns = [c for c in df.columns if "box_" in c]
@ -68,6 +65,7 @@ class Merger(QRunnable):
boxcoordinates = np.stack([df[b].values for b in box_columns]).astype(np.float32).T
temp_v = df.visible.values
temp_k = np.stack([df[k].values for k in key_columns]).T
x = lambda kp: np.array([float(kpp) for kpp in kp[1:-1].split(",")])
for i, k in enumerate(temp_k):
temp = np.array([x(kp) for kp in k])
keypoints[i, :, :] = temp