Run skelda tests with new implementation.
This commit is contained in:
644
media/RESULTS.md
644
media/RESULTS.md
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
@ -8,10 +9,12 @@ import numpy as np
|
|||||||
import tqdm
|
import tqdm
|
||||||
|
|
||||||
import test_triangulate
|
import test_triangulate
|
||||||
import triangulate_poses
|
|
||||||
import utils_2d_pose
|
import utils_2d_pose
|
||||||
from skelda import evals, utils_pose
|
from skelda import evals, utils_pose
|
||||||
|
|
||||||
|
sys.path.append("/SimplePoseTriangulation/swig/")
|
||||||
|
import spt
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
|
|
||||||
# dataset_use = "panoptic"
|
# dataset_use = "panoptic"
|
||||||
@ -316,12 +319,27 @@ def main():
|
|||||||
# Print a dataset sample for debugging
|
# Print a dataset sample for debugging
|
||||||
print(labels[0])
|
print(labels[0])
|
||||||
|
|
||||||
|
minscores = {
|
||||||
|
# Choose this depending on the fraction of invalid/missing persons
|
||||||
|
# A higher value reduces the number of proposals
|
||||||
|
"panoptic": 0.94,
|
||||||
|
"human36m": 0.94,
|
||||||
|
"mvor": 0.86,
|
||||||
|
"campus": 0.96,
|
||||||
|
"shelf": 0.96,
|
||||||
|
"ikeaasm": 0.89,
|
||||||
|
"tsinghua": 0.96,
|
||||||
|
"human36m_wb": 0.94,
|
||||||
|
"koarob": 0.91,
|
||||||
|
}
|
||||||
|
minscore = minscores.get(dataset_use, 0.95)
|
||||||
|
|
||||||
print("\nRunning predictions ...")
|
print("\nRunning predictions ...")
|
||||||
all_poses = []
|
all_poses = []
|
||||||
all_ids = []
|
all_ids = []
|
||||||
all_paths = []
|
all_paths = []
|
||||||
times = []
|
times = []
|
||||||
last_poses_3d = np.array([])
|
triangulator = spt.Triangulator(min_score=minscore)
|
||||||
old_scene = ""
|
old_scene = ""
|
||||||
for label in tqdm.tqdm(labels):
|
for label in tqdm.tqdm(labels):
|
||||||
images_2d = []
|
images_2d = []
|
||||||
@ -329,7 +347,7 @@ def main():
|
|||||||
if old_scene != label.get("scene", ""):
|
if old_scene != label.get("scene", ""):
|
||||||
# Reset last poses if scene changes
|
# Reset last poses if scene changes
|
||||||
old_scene = label.get("scene", "")
|
old_scene = label.get("scene", "")
|
||||||
last_poses_3d = np.array([])
|
triangulator.reset()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
@ -366,28 +384,20 @@ def main():
|
|||||||
time_2d = time.time() - start
|
time_2d = time.time() - start
|
||||||
print("2D time:", time_2d)
|
print("2D time:", time_2d)
|
||||||
|
|
||||||
minscores = {
|
|
||||||
# Choose this depending on the fraction of invalid/missing persons
|
|
||||||
# A higher value reduces the number of proposals
|
|
||||||
"panoptic": 0.94,
|
|
||||||
"human36m": 0.94,
|
|
||||||
"mvor": 0.86,
|
|
||||||
"campus": 0.96,
|
|
||||||
"shelf": 0.96,
|
|
||||||
"ikeaasm": 0.89,
|
|
||||||
"tsinghua": 0.96,
|
|
||||||
"human36m_wb": 0.94,
|
|
||||||
}
|
|
||||||
minscore = minscores.get(dataset_use, 0.95)
|
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
if sum(np.sum(p) for p in poses_2d) == 0:
|
if sum(np.sum(p) for p in poses_2d) == 0:
|
||||||
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
||||||
poses2D = np.zeros([len(images_2d), 1, len(joint_names_3d), 3])
|
poses2D = np.zeros([len(images_2d), 1, len(joint_names_3d), 3])
|
||||||
else:
|
else:
|
||||||
poses3D = triangulate_poses.get_3d_pose(
|
cameras = spt.convert_cameras(label["cameras"])
|
||||||
poses_2d, label["cameras"], roomparams, joint_names_2d, last_poses_3d, minscore
|
roomp = [roomparams["room_center"], roomparams["room_size"]]
|
||||||
|
poses_3d = triangulator.triangulate_poses(
|
||||||
|
poses_2d, cameras, roomp, joint_names_2d
|
||||||
)
|
)
|
||||||
|
poses3D = np.array(poses_3d)
|
||||||
|
if len(poses3D) == 0:
|
||||||
|
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
||||||
|
|
||||||
poses2D = []
|
poses2D = []
|
||||||
for cam in label["cameras"]:
|
for cam in label["cameras"]:
|
||||||
poses_2d, _ = utils_pose.project_poses(poses3D, cam)
|
poses_2d, _ = utils_pose.project_poses(poses3D, cam)
|
||||||
@ -401,7 +411,6 @@ def main():
|
|||||||
drop_few_limbs=(dataset_use != "mvor"),
|
drop_few_limbs=(dataset_use != "mvor"),
|
||||||
)
|
)
|
||||||
poses3D = add_missing_joints(poses3D, joint_names_3d)
|
poses3D = add_missing_joints(poses3D, joint_names_3d)
|
||||||
last_poses_3d = poses3D
|
|
||||||
|
|
||||||
time_3d = time.time() - start
|
time_3d = time.time() - start
|
||||||
print("3D time:", time_3d)
|
print("3D time:", time_3d)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
@ -9,10 +10,12 @@ import matplotlib
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import draw_utils
|
import draw_utils
|
||||||
import triangulate_poses
|
|
||||||
import utils_2d_pose
|
import utils_2d_pose
|
||||||
from skelda import utils_pose
|
from skelda import utils_pose
|
||||||
|
|
||||||
|
sys.path.append("/SimplePoseTriangulation/swig/")
|
||||||
|
import spt
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
|
|
||||||
filepath = os.path.dirname(os.path.realpath(__file__)) + "/"
|
filepath = os.path.dirname(os.path.realpath(__file__)) + "/"
|
||||||
@ -437,7 +440,7 @@ def main():
|
|||||||
poses_2d = utils_2d_pose.get_2d_pose(kpt_model, images_2d)
|
poses_2d = utils_2d_pose.get_2d_pose(kpt_model, images_2d)
|
||||||
poses_2d = update_keypoints(poses_2d, joint_names_2d)
|
poses_2d = update_keypoints(poses_2d, joint_names_2d)
|
||||||
print("2D time:", time.time() - stime)
|
print("2D time:", time.time() - stime)
|
||||||
# print(np.array(poses_2d).round(3).tolist())
|
# print([np.array(p).round(6).tolist() for p in poses_2d])
|
||||||
|
|
||||||
fig1 = draw_utils.show_poses2d(
|
fig1 = draw_utils.show_poses2d(
|
||||||
poses_2d, np.array(images_2d), joint_names_2d, "2D detections"
|
poses_2d, np.array(images_2d), joint_names_2d, "2D detections"
|
||||||
@ -454,11 +457,19 @@ def main():
|
|||||||
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
||||||
poses2D = np.zeros([len(images_2d), 1, len(joint_names_3d), 3])
|
poses2D = np.zeros([len(images_2d), 1, len(joint_names_3d), 3])
|
||||||
else:
|
else:
|
||||||
|
cameras = spt.convert_cameras(camparams)
|
||||||
|
roomp = [roomparams["room_center"], roomparams["room_size"]]
|
||||||
|
triangulator = spt.Triangulator(min_score=0.95)
|
||||||
|
|
||||||
stime = time.time()
|
stime = time.time()
|
||||||
poses3D = triangulate_poses.get_3d_pose(
|
poses_3d = triangulator.triangulate_poses(
|
||||||
poses_2d, camparams, roomparams, joint_names_2d
|
poses_2d, cameras, roomp, joint_names_2d
|
||||||
)
|
)
|
||||||
|
poses3D = np.array(poses_3d)
|
||||||
|
if len(poses3D) == 0:
|
||||||
|
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
||||||
print("3D time:", time.time() - stime)
|
print("3D time:", time.time() - stime)
|
||||||
|
|
||||||
poses2D = []
|
poses2D = []
|
||||||
for cam in camparams:
|
for cam in camparams:
|
||||||
poses_2d, _ = utils_pose.project_poses(poses3D, cam)
|
poses_2d, _ = utils_pose.project_poses(poses3D, cam)
|
||||||
|
|||||||
Reference in New Issue
Block a user