[merger] speed up numpy conversion
This commit is contained in:
parent
456bd16a59
commit
b679aa0313
@ -56,10 +56,7 @@ class Merger(QRunnable):
|
|||||||
numpy.ndarray
|
numpy.ndarray
|
||||||
2D array, Coordinates of the bounding box for each detection. Shape: (num_detections, 4) x1, y1, x2, y2
|
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 ...")
|
logging.info("Converting to numpy ...")
|
||||||
# from IPython import embed
|
|
||||||
# embed()
|
|
||||||
dimensions = 2
|
dimensions = 2
|
||||||
key_columns = [c for c in df.columns if "key_" in c]
|
key_columns = [c for c in df.columns if "key_" in c]
|
||||||
box_columns = [c for c in df.columns if "box_" 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
|
boxcoordinates = np.stack([df[b].values for b in box_columns]).astype(np.float32).T
|
||||||
temp_v = df.visible.values
|
temp_v = df.visible.values
|
||||||
temp_k = np.stack([df[k].values for k in key_columns]).T
|
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):
|
for i, k in enumerate(temp_k):
|
||||||
temp = np.array([x(kp) for kp in k])
|
temp = np.array([x(kp) for kp in k])
|
||||||
keypoints[i, :, :] = temp
|
keypoints[i, :, :] = temp
|
||||||
|
Loading…
Reference in New Issue
Block a user