Skip to content

Commit

Permalink
renamed multiperson parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienCoppee committed Oct 24, 2024
1 parent 987e54e commit e3108bb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ sports2d --help
sports2d --show_graphs False --time_range 0 2.1 --result_dir path_to_result_dir
```
``` cmd
sports2d --multiperson false --mode lightweight --det_frequency 50
sports2d --multi_person false --mode lightweight --det_frequency 50
```
- Run with a toml configuration file:
``` cmd
Expand All @@ -165,7 +165,7 @@ sports2d --help
### Too slow for you?

**Quick fixes:**
- Use `--multiperson false`: Can be used if one single person is present in the video. Otherwise, persons' IDs may be mixed up.
- Use `--multi_person false`: Can be used if one single person is present in the video. Otherwise, persons' IDs may be mixed up.
- Use `--mode lightweight`: Will use a lighter version of RTMPose, which is faster but less accurate.
- Use `--det_frequency 50`: Will detect poses only every 50 frames, and track keypoints inbetween, which is faster.

Expand Down
2 changes: 1 addition & 1 deletion Sports2D/Demo/Config_demo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ input_size = [1280, 720] # [W, H]. Lower resolution will be faster but less prec


[process]
multiperson = true # Multiperson involves tracking: will be faster if false
multi_person = true # Multi-person involves tracking: will be faster if false
show_realtime_results = true
save_vid = true
save_img = true
Expand Down
10 changes: 5 additions & 5 deletions Sports2D/Sports2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
sports2d --video_input webcam
- Run with custom parameters (all non specified are set to default):
sports2d --show_plots False --time_range 0 2.1 --result_dir path_to_result_dir
sports2d --multiperson false --mode lightweight --det_frequency 50
sports2d --multi_person false --mode lightweight --det_frequency 50
- Run with a toml configuration file:
sports2d --config path_to_config.toml
Expand Down Expand Up @@ -129,7 +129,7 @@
'webcam_id': 0,
'input_size': [1280, 720]
},
'process': {'multiperson': True,
'process': {'multi_person': True,
'show_realtime_results': True,
'save_vid': True,
'save_img': True,
Expand Down Expand Up @@ -206,7 +206,7 @@
'mode': ["m", "light, balanced, or performance. balanced if not specified"],
'det_frequency': ["f", "Run person detection only every N frames, and inbetween track previously detected bounding boxes. keypoint detection is still run on all frames.\n\
Equal to or greater than 1, can be as high as you want in simple uncrowded cases. Much faster, but might be less accurate. 1 if not specified: detection runs on all frames"],
'multiperson': ["M", "Multiperson involves tracking: will be faster if set to false. true if not specified"],
'multi_person': ["M", "Multi-person involves tracking: will be faster if set to false. true if not specified"],
'tracking_mode': ["", "sports2d or rtmlib. sports2d is generally much more accurate and comparable in speed. sports2d if not specified"],
'input_size': ["", "width, height. 1280, 720 if not specified. Lower resolution will be faster but less precise"],
'keypoint_likelihood_threshold': ["", "Detected keypoints are not retained if likelihood is below this threshold. 0.3 if not specified"],
Expand Down Expand Up @@ -327,7 +327,7 @@ def get_leaf_keys(config, prefix=''):

def update_nested_dict(config, key_path, value):
'''
Update a nested dictionary based on a key path string like 'process.multiperson'.
Update a nested dictionary based on a key path string like 'process.multi_person'.
'''

keys = key_path.split('.')
Expand Down Expand Up @@ -435,7 +435,7 @@ def main():
sports2d --video_input webcam
- Run with custom parameters (all non specified are set to default):
sports2d --show_plots False --time_range 0 2.1 --result_dir path_to_result_dir
sports2d --multiperson false --mode lightweight --det_frequency 50
sports2d --multi_person false --mode lightweight --det_frequency 50
- Run with a toml configuration file:
sports2d --config path_to_config.toml
'''
Expand Down
10 changes: 5 additions & 5 deletions Sports2D/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ def process_fun(config_dict, video_file, frame_range, frame_rate, result_dir):
input_size = config_dict.get('project').get('input_size')

# Process settings
tracking = config_dict.get('process').get('multiperson')
multi_person = config_dict.get('process').get('multi_person')
show_realtime_results = config_dict.get('process').get('show_realtime_results')
save_vid = config_dict.get('process').get('save_vid')
save_img = config_dict.get('process').get('save_img')
Expand Down Expand Up @@ -1123,11 +1123,11 @@ def process_fun(config_dict, video_file, frame_range, frame_rate, result_dir):


# Set up pose tracker
tracking_rtmlib = True if (tracking_mode == 'rtmlib' and tracking) else False
tracking_rtmlib = True if (tracking_mode == 'rtmlib' and multi_person) else False
pose_tracker = setup_pose_tracker(det_frequency, mode, tracking_rtmlib)
logging.info(f'Pose tracking set up for BodyWithFeet model in {mode} mode.')
logging.info(f'Persons are detected every {det_frequency} frames and tracked inbetween. Multi-person is {"" if tracking else "not "}selected.')
logging.info(f"Parameters: {f'{tracking_mode=}, ' if tracking else ''}{keypoint_likelihood_threshold=}, {average_likelihood_threshold=}, {keypoint_number_threshold=}")
logging.info(f'Persons are detected every {det_frequency} frames and tracked inbetween. Multi-person is {"" if multi_person else "not "}selected.')
logging.info(f"Parameters: {f'{tracking_mode=}, ' if multi_person else ''}{keypoint_likelihood_threshold=}, {average_likelihood_threshold=}, {keypoint_number_threshold=}")


# Process video or webcam feed
Expand Down Expand Up @@ -1164,7 +1164,7 @@ def process_fun(config_dict, video_file, frame_range, frame_rate, result_dir):
keypoints, scores = pose_tracker(frame)

# Track persons
if tracking: # multi-person
if multi_person:
if tracking_rtmlib:
keypoints, scores = sort_people_rtmlib(pose_tracker, keypoints, scores)
else:
Expand Down

0 comments on commit e3108bb

Please sign in to comment.