Skip to content

Commit

Permalink
Faster and more robust multi-person analysis (#85)
Browse files Browse the repository at this point in the history
* tests synchro

* draft

* further draft

* affinity ok

* proposals okay, need to incorporate in Pose2Sim+tests

* will transfer sorting across frames in triangulation in next commit

* Lasts tests need to be done but seems to work pretty well

* should all work smoothly

* update readme

* last checks

* fixed linting issues

* getting tired of being forgetful
  • Loading branch information
davidpagnon authored Mar 31, 2024
1 parent 5ddef52 commit 19efec2
Show file tree
Hide file tree
Showing 16 changed files with 1,825 additions and 1,342 deletions.
3 changes: 0 additions & 3 deletions Pose2Sim/Pose2Sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,6 @@ def synchronization(config=None):
start = time.time()
currentDateAndTime = datetime.now()
project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
seq_name = os.path.basename(project_dir)
frame_range = config_dict.get('project').get('frame_range')
frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]

logging.info("\n\n---------------------------------------------------------------------")
logging.info("Camera synchronization")
Expand Down
58 changes: 32 additions & 26 deletions Pose2Sim/S00_Demo_Session/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@


[project]
# multi_person = false # true for trials with multiple participants. If false, only the main person in scene is analyzed (and it run much faster).
nb_persons_to_detect = 2 # checked only if multi_person is selected
frame_rate = 120 # fps
multi_person = false # If false, only the main person in scene is analyzed.
frame_rate = 60 # fps
frame_range = [] # For example [10,300], or [] for all frames
## N.B.: If you want a time range instead, use frame_range = time_range * frame_rate
## For example if you want to analyze from 0.1 to 2 seconds with a 60 fps frame rate,
Expand All @@ -31,6 +30,26 @@ exclude_from_batch = [] # List of trials to be excluded from batch analysis, ['<
# Take heart, calibration is not that complicated once you get the hang of it!


[pose]
pose_framework = 'openpose' # 'openpose', 'mediapipe', 'alphapose', 'deeplabcut'
pose_model = 'BODY_25B' #With openpose: BODY_25B, BODY_25, BODY_135, COCO, MPII
#With mediapipe: BLAZEPOSE.
#With alphapose: HALPE_26, HALPE_68, HALPE_136, COCO_133.
#With deeplabcut: CUSTOM. See example at the end of the file.
# What follows has not been implemented yet
overwrite_pose = false
openpose_path = '' # only checked if OpenPose is used


[synchronization]
display_corr = true # true or false (lowercase)
reset_sync = true # Recalculate synchronization even if already done
# id_kpt = [10] # keypoint ID, to be found in skeleton.py. Example RWrist' BLAZEPOSE 16, BODY_25B 10, BODY_25 4 ; 'LWrist' BLAZEPOSE 15, BODY_25B 9, BODY_25 7
# weights_kpt = [1] # Only taken into account if you have several keypoints (Currently only one keypoint is supported).
sync_frame_range = [] # For example [0,150], or [] for all frames (default)
# limit synchronization search (to the beginning or to the end of the capture for example)


[calibration]
calibration_type = 'convert' # 'convert' or 'calculate'

Expand Down Expand Up @@ -90,30 +109,17 @@ calibration_type = 'convert' # 'convert' or 'calculate'
# Coming soon!


[pose]
pose_framework = 'openpose' # 'openpose', 'mediapipe', 'alphapose', 'deeplabcut'
pose_model = 'BODY_25B' #With openpose: BODY_25B, BODY_25, BODY_135, COCO, MPII
#With mediapipe: BLAZEPOSE.
#With alphapose: HALPE_26, HALPE_68, HALPE_136, COCO_133.
#With deeplabcut: CUSTOM. See example at the end of the file.
# What follows has not been implemented yet
overwrite_pose = false
openpose_path = '' # only checked if OpenPose is used


[synchronization]
# COMING SOON!
reset_sync = true # Recalculate synchronization even if already done
speed_kind = 'y' # 'y' showed best performance.
id_kpt = [10] # number from keypoint name in skeleton.py. RWrist' BLAZEPOSE 16, BODY_25B 10, BODY_25 4 ; 'LWrist' BLAZEPOSE 15, BODY_25B 9, BODY_25 7
weights_kpt = [1] # Only taken into account if you have several keypoints (Currently only one keypoint is supported).


[personAssociation]
tracked_keypoint = 'Neck' # If the neck is not detected by the pose_model, check skeleton.py
# and choose a stable point for tracking the person of interest (e.g., 'right_shoulder' with BLAZEPOSE)
reproj_error_threshold_association = 20 # px
likelihood_threshold_association = 0.3
likelihood_threshold_association = 0.3

[personAssociation.single_person]
reproj_error_threshold_association = 20 # px
tracked_keypoint = 'Neck' # If the neck is not detected by the pose_model, check skeleton.py
# and choose a stable point for tracking the person of interest (e.g., 'right_shoulder' with BLAZEPOSE)

[personAssociation.multi_person]
reconstruction_error_threshold = 0.1 # 0.1 = 10 cm
min_affinity = 0.2 # affinity below which a correspondence is ignored


[triangulation]
Expand Down
Loading

0 comments on commit 19efec2

Please sign in to comment.