Some fixes. Updated benchmarks.
This commit is contained in:
626
media/RESULTS.md
626
media/RESULTS.md
File diff suppressed because it is too large
Load Diff
@ -384,7 +384,7 @@ def main():
|
|||||||
poses3D = np.zeros([1, len(joint_names_3d), 4]).tolist()
|
poses3D = np.zeros([1, len(joint_names_3d), 4]).tolist()
|
||||||
else:
|
else:
|
||||||
spt_cameras = spt.convert_cameras(label["cameras"])
|
spt_cameras = spt.convert_cameras(label["cameras"])
|
||||||
roomparams = [label["room_center"], label["room_size"]]
|
roomparams = [label["room_size"], label["room_center"]]
|
||||||
poses3D = triangulator.triangulate_poses(
|
poses3D = triangulator.triangulate_poses(
|
||||||
poses_2d, spt_cameras, roomparams, joint_names_2d
|
poses_2d, spt_cameras, roomparams, joint_names_2d
|
||||||
)
|
)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param poses_2d List of shape [views, persons, joints, 3], containing the 2D poses.
|
* @param poses_2d List of shape [views, persons, joints, 3], containing the 2D poses.
|
||||||
* @param cameras List of cameras.
|
* @param cameras List of cameras.
|
||||||
* @param roomparams Room parameters (room center, room size).
|
* @param roomparams Room parameters (room size, room center).
|
||||||
* @param joint_names List of 2D joint names.
|
* @param joint_names List of 2D joint names.
|
||||||
*
|
*
|
||||||
* @return List of shape [persons, joints, 4], containing the 3D poses.
|
* @return List of shape [persons, joints, 4], containing the 3D poses.
|
||||||
|
|||||||
@ -925,8 +925,8 @@ std::pair<cv::Mat, float> TriangulatorInternal::triangulate_and_score(
|
|||||||
{
|
{
|
||||||
mean[j] *= inv_num_vis;
|
mean[j] *= inv_num_vis;
|
||||||
}
|
}
|
||||||
const std::array<float, 3> ¢er = roomparams[0];
|
const std::array<float, 3> &size = roomparams[0];
|
||||||
const std::array<float, 3> &size = roomparams[1];
|
const std::array<float, 3> ¢er = roomparams[1];
|
||||||
for (int j = 0; j < 3; ++j)
|
for (int j = 0; j < 3; ++j)
|
||||||
{
|
{
|
||||||
if (mean[j] > center[j] + size[j] / 2.0 ||
|
if (mean[j] > center[j] + size[j] / 2.0 ||
|
||||||
@ -1061,9 +1061,7 @@ std::vector<std::tuple<cv::Point3d, cv::Mat, std::vector<int>>> TriangulatorInte
|
|||||||
{
|
{
|
||||||
float max_center_dist_sq = 0.6 * 0.6;
|
float max_center_dist_sq = 0.6 * 0.6;
|
||||||
float max_joint_avg_dist = 0.3;
|
float max_joint_avg_dist = 0.3;
|
||||||
|
|
||||||
size_t num_pairs = all_pairs.size();
|
size_t num_pairs = all_pairs.size();
|
||||||
size_t num_joints = all_scored_poses[0].first.rows;
|
|
||||||
|
|
||||||
// Calculate pose centers
|
// Calculate pose centers
|
||||||
std::vector<cv::Point3d> centers;
|
std::vector<cv::Point3d> centers;
|
||||||
@ -1071,6 +1069,8 @@ std::vector<std::tuple<cv::Point3d, cv::Mat, std::vector<int>>> TriangulatorInte
|
|||||||
for (size_t i = 0; i < num_pairs; ++i)
|
for (size_t i = 0; i < num_pairs; ++i)
|
||||||
{
|
{
|
||||||
const cv::Mat &pose_3d = all_scored_poses[i].first;
|
const cv::Mat &pose_3d = all_scored_poses[i].first;
|
||||||
|
size_t num_joints = pose_3d.rows;
|
||||||
|
|
||||||
cv::Point3d center(0, 0, 0);
|
cv::Point3d center(0, 0, 0);
|
||||||
size_t num_valid = 0;
|
size_t num_valid = 0;
|
||||||
for (size_t j = 0; j < num_joints; ++j)
|
for (size_t j = 0; j < num_joints; ++j)
|
||||||
@ -1102,6 +1102,8 @@ std::vector<std::tuple<cv::Point3d, cv::Mat, std::vector<int>>> TriangulatorInte
|
|||||||
for (size_t i = 0; i < num_pairs; ++i)
|
for (size_t i = 0; i < num_pairs; ++i)
|
||||||
{
|
{
|
||||||
const cv::Mat &pose_3d = all_scored_poses[i].first;
|
const cv::Mat &pose_3d = all_scored_poses[i].first;
|
||||||
|
size_t num_joints = pose_3d.rows;
|
||||||
|
|
||||||
const cv::Point3d ¢er = centers[i];
|
const cv::Point3d ¢er = centers[i];
|
||||||
float best_dist = std::numeric_limits<float>::infinity();
|
float best_dist = std::numeric_limits<float>::infinity();
|
||||||
int best_group = -1;
|
int best_group = -1;
|
||||||
@ -1512,7 +1514,7 @@ void TriangulatorInternal::filter_poses(
|
|||||||
{
|
{
|
||||||
// Check if the mean position is outside the room boundaries
|
// Check if the mean position is outside the room boundaries
|
||||||
if (mean[j] > room_half_size[j] + room_center[j] ||
|
if (mean[j] > room_half_size[j] + room_center[j] ||
|
||||||
mean[j] < -room_half_size[j] - room_center[j])
|
mean[j] < -room_half_size[j] + room_center[j])
|
||||||
{
|
{
|
||||||
outside = true;
|
outside = true;
|
||||||
break;
|
break;
|
||||||
@ -1522,7 +1524,7 @@ void TriangulatorInternal::filter_poses(
|
|||||||
{
|
{
|
||||||
// Check if any limb is too far outside the room
|
// Check if any limb is too far outside the room
|
||||||
if (maxs[j] > room_half_size[j] + room_center[j] + wdist ||
|
if (maxs[j] > room_half_size[j] + room_center[j] + wdist ||
|
||||||
mins[j] < -room_half_size[j] - room_center[j] - wdist)
|
mins[j] < -room_half_size[j] + room_center[j] - wdist)
|
||||||
{
|
{
|
||||||
outside = true;
|
outside = true;
|
||||||
break;
|
break;
|
||||||
@ -1540,8 +1542,8 @@ void TriangulatorInternal::filter_poses(
|
|||||||
size_t found_limbs = 0;
|
size_t found_limbs = 0;
|
||||||
for (size_t j = 0; j < core_limbs_idx.size(); ++j)
|
for (size_t j = 0; j < core_limbs_idx.size(); ++j)
|
||||||
{
|
{
|
||||||
size_t start_idx = core_limbs_idx[j][0];
|
size_t start_idx = core_joint_idx[core_limbs_idx[j][0]];
|
||||||
size_t end_idx = core_limbs_idx[j][1];
|
size_t end_idx = core_joint_idx[core_limbs_idx[j][1]];
|
||||||
|
|
||||||
float *joint_start_ptr = pose.ptr<float>(start_idx);
|
float *joint_start_ptr = pose.ptr<float>(start_idx);
|
||||||
float *joint_end_ptr = pose.ptr<float>(end_idx);
|
float *joint_end_ptr = pose.ptr<float>(end_idx);
|
||||||
@ -1565,8 +1567,8 @@ void TriangulatorInternal::filter_poses(
|
|||||||
int total_limbs = 0;
|
int total_limbs = 0;
|
||||||
for (size_t j = 0; j < core_limbs_idx.size(); ++j)
|
for (size_t j = 0; j < core_limbs_idx.size(); ++j)
|
||||||
{
|
{
|
||||||
size_t start_idx = core_limbs_idx[j][0];
|
size_t start_idx = core_joint_idx[core_limbs_idx[j][0]];
|
||||||
size_t end_idx = core_limbs_idx[j][1];
|
size_t end_idx = core_joint_idx[core_limbs_idx[j][1]];
|
||||||
|
|
||||||
float *joint_start_ptr = pose.ptr<float>(start_idx);
|
float *joint_start_ptr = pose.ptr<float>(start_idx);
|
||||||
float *joint_end_ptr = pose.ptr<float>(end_idx);
|
float *joint_end_ptr = pose.ptr<float>(end_idx);
|
||||||
@ -1727,7 +1729,7 @@ void TriangulatorInternal::add_missing_joints(
|
|||||||
if (adjacents.find(adname) != adjacents.end())
|
if (adjacents.find(adname) != adjacents.end())
|
||||||
{
|
{
|
||||||
// Joint is missing; attempt to estimate its position based on adjacent joints
|
// Joint is missing; attempt to estimate its position based on adjacent joints
|
||||||
std::array<float, 3> adjacent_position;
|
std::array<float, 3> adjacent_position = {0.0f, 0.0f, 0.0f};
|
||||||
size_t adjacent_count = 0;
|
size_t adjacent_count = 0;
|
||||||
|
|
||||||
const std::vector<std::string> &adjacent_joint_names = adjacents[adname];
|
const std::vector<std::string> &adjacent_joint_names = adjacents[adname];
|
||||||
|
|||||||
@ -26,7 +26,7 @@ def main():
|
|||||||
print("")
|
print("")
|
||||||
|
|
||||||
# Load input data
|
# Load input data
|
||||||
roomparams = [[0, 0, 1.0], [4.8, 6.0, 2.0]]
|
roomparams = [[4.8, 6.0, 2.0], [0, 0, 1.0]]
|
||||||
joint_names = [
|
joint_names = [
|
||||||
"nose",
|
"nose",
|
||||||
"eye_left",
|
"eye_left",
|
||||||
@ -70,7 +70,7 @@ def main():
|
|||||||
print("")
|
print("")
|
||||||
|
|
||||||
# Load input data
|
# Load input data
|
||||||
roomparams = [[0, -0.5, 1.2], [5.6, 6.4, 2.4]]
|
roomparams = [[5.6, 6.4, 2.4], [0, -0.5, 1.2]]
|
||||||
cpath = "/SimplePoseTriangulation/data/p1/sample.json"
|
cpath = "/SimplePoseTriangulation/data/p1/sample.json"
|
||||||
ppath = "/SimplePoseTriangulation/tests/poses_p1.json"
|
ppath = "/SimplePoseTriangulation/tests/poses_p1.json"
|
||||||
with open(cpath, "r") as file:
|
with open(cpath, "r") as file:
|
||||||
|
|||||||
Reference in New Issue
Block a user