Fix n_cams_off > min_cams_for_triangulation in personAssociation #203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 :
persons_combinations(), if nobody's detected is one view, the camera is turned offbest_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_triangulationtriangulate_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 :
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 :
With my fix, the personAssociation fails directly as expected, meaning that the mean reprojection error is way above the threshold.