Skip to content

Conversation

@leadroletroy
Copy link

In the last version of the code, the algorithm to find the best persons and cameras combination during the person association stage allows to turn off too many cameras.
This is due to the fact that cameras are turned off at three places :

  1. in persons_combinations(), if nobody's detected is one view, the camera is turned off
  2. in best_persons_and_cameras_combination(), the main function we're looking at, many combinations are created randomly turning off n_cams_off cameras at each iteration while n_cams - nb_cams_off >= min_cameras_for_triangulation
  3. in triangulate_comb(), if the confidence score is below the threshold, supplementary cameras can be turned off.
    The only constraint ensuring that there are enough active cameras is in (2), but it doesn't take into account the cameras that were off at step (1) nor the ones that are turned off at step (3). This result in triangulation with 2, 1 or even 0 cameras and thus incoherent results.

For example, with a 12-cameras setup is get this output for Pose2Sim.personAssociation(), when min_cameras_for_triangulation = 3 :

Final reprojection error = 33.03 with 10 cams off and comb [array([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan])]
--> Mean reprojection error for RHip point on all frames is 97.8 px, which roughly corresponds to 515.1 mm. 
--> In average, 11.83 cameras had to be excluded to reach the demanded 20 px error threshold after excluding points with likelihood below 0.3.

I still don't understand how it is possible to get a triangulation error with all cameras off (nan)...
No error is raised until I run Pose2Sim.trinagulation() and get :

Person 0: Less than 10 valid frames in a row. Deleting person.
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
File ~/anaconda3/envs/pose2sim_orig/lib/python3.10/site-packages/Pose2Sim/triangulation.py:954, in triangulate_all(config_dict)
    951         non_interp_frames.append([])
    953 if np.all(np.diff(np.array(f_range_trimmed))==0):
--> [954](https://vscode-remote+ssh-002dremote-002bm3202-002d07.vscode-resource.vscode-cdn.net/home/lea/trampo/MODELS_2D3D/Pose2Sim/~/anaconda3/envs/pose2sim_orig/lib/python3.10/site-packages/Pose2Sim/triangulation.py:954)     raise Exception('No persons have been triangulated. Please check your calibration and your synchronization, or the triangulation parameters in Config.toml.')
    956 # Recap message
    957 recap_triangulate(config_dict, error_tot, nb_cams_excluded_tot, keypoints_names, cam_excluded_count, interp_frames, non_interp_frames, f_range_trimmed, f_range, trc_paths)

Exception: No persons have been triangulated. Please check your calibration and your synchronization, or the triangulation parameters in Config.toml.

With my fix, the personAssociation fails directly as expected, meaning that the mean reprojection error is way above the threshold.

Final reprojection error = 453.43 with 9 cams off and comb [array([nan, nan,  0., nan,  0.,  0., nan, nan, nan, nan, nan, nan])]
--> Mean reprojection error for RHip point on all frames is 371.0 px, which roughly corresponds to 1953.9 mm. 
--> In average, 10.49 cameras had to be excluded to reach the demanded 20 px error threshold after excluding points with likelihood below 0.3.

@davidpagnon
Copy link
Collaborator

Hi Léa,

Thanks for your well-documented pull request! It makes sense but it is a bit technical, so before merging it, I'll have to dive into it and test it--and as you point out, I'll have to figure out why you can have a result while all cameras are disabled.

Also, out of interest, how do you have so many excluded cameras? Is the participant hiding so as not to be seen by any of them?

@leadroletroy
Copy link
Author

Hi David,

Thanks for your quick answer. I'm currently using a public dataset of figure skating. The participant moves a lot and is not always seen by all cameras. Plus, I have a doubt about the calibration file. All that could explain why the triangulation can't succeed with >2 cameras.

@davidpagnon
Copy link
Collaborator

That would be my guess, I would expect, one, maybe two cameras to be excluded, but not more.
Moreover, 12 cameras is quite a lot, I doubt you'll get results any better than with 8 :)
Keep me updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants