sports2d 0.8.7__tar.gz → 0.8.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {sports2d-0.8.7 → sports2d-0.8.9}/PKG-INFO +6 -4
  2. {sports2d-0.8.7 → sports2d-0.8.9}/README.md +5 -3
  3. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Demo/Config_demo.toml +1 -1
  4. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Sports2D.py +40 -3
  5. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/process.py +86 -68
  6. {sports2d-0.8.7 → sports2d-0.8.9}/sports2d.egg-info/PKG-INFO +6 -4
  7. {sports2d-0.8.7 → sports2d-0.8.9}/.github/workflows/continuous-integration.yml +0 -0
  8. {sports2d-0.8.7 → sports2d-0.8.9}/.github/workflows/joss_pdf.yml +0 -0
  9. {sports2d-0.8.7 → sports2d-0.8.9}/.github/workflows/publish-on-release.yml +0 -0
  10. {sports2d-0.8.7 → sports2d-0.8.9}/.gitignore +0 -0
  11. {sports2d-0.8.7 → sports2d-0.8.9}/CITATION.cff +0 -0
  12. {sports2d-0.8.7 → sports2d-0.8.9}/Content/Demo_plots.png +0 -0
  13. {sports2d-0.8.7 → sports2d-0.8.9}/Content/Demo_results.png +0 -0
  14. {sports2d-0.8.7 → sports2d-0.8.9}/Content/Demo_terminal.png +0 -0
  15. {sports2d-0.8.7 → sports2d-0.8.9}/Content/Person_selection.png +0 -0
  16. {sports2d-0.8.7 → sports2d-0.8.9}/Content/Video_tuto_Sports2D_Colab.png +0 -0
  17. {sports2d-0.8.7 → sports2d-0.8.9}/Content/joint_convention.png +0 -0
  18. {sports2d-0.8.7 → sports2d-0.8.9}/Content/paper.bib +0 -0
  19. {sports2d-0.8.7 → sports2d-0.8.9}/Content/paper.md +0 -0
  20. {sports2d-0.8.7 → sports2d-0.8.9}/Content/sports2d_blender.gif +0 -0
  21. {sports2d-0.8.7 → sports2d-0.8.9}/Content/sports2d_opensim.gif +0 -0
  22. {sports2d-0.8.7 → sports2d-0.8.9}/LICENSE +0 -0
  23. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Demo/demo.mp4 +0 -0
  24. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Sports2D.ipynb +0 -0
  25. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Utilities/__init__.py +0 -0
  26. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Utilities/common.py +0 -0
  27. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Utilities/filter.py +0 -0
  28. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/Utilities/tests.py +0 -0
  29. {sports2d-0.8.7 → sports2d-0.8.9}/Sports2D/__init__.py +0 -0
  30. {sports2d-0.8.7 → sports2d-0.8.9}/pyproject.toml +0 -0
  31. {sports2d-0.8.7 → sports2d-0.8.9}/setup.cfg +0 -0
  32. {sports2d-0.8.7 → sports2d-0.8.9}/sports2d.egg-info/SOURCES.txt +0 -0
  33. {sports2d-0.8.7 → sports2d-0.8.9}/sports2d.egg-info/dependency_links.txt +0 -0
  34. {sports2d-0.8.7 → sports2d-0.8.9}/sports2d.egg-info/entry_points.txt +0 -0
  35. {sports2d-0.8.7 → sports2d-0.8.9}/sports2d.egg-info/requires.txt +0 -0
  36. {sports2d-0.8.7 → sports2d-0.8.9}/sports2d.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sports2d
3
- Version: 0.8.7
3
+ Version: 0.8.9
4
4
  Summary: Compute 2D human pose and angles from a video or a webcam.
5
5
  Author-email: David Pagnon <contact@david-pagnon.com>
6
6
  Maintainer-email: David Pagnon <contact@david-pagnon.com>
@@ -163,7 +163,8 @@ pip install .
163
163
 
164
164
  #### Full install
165
165
 
166
- > Only needed if you want to run inverse kinematics (`--do_ik True`).
166
+ > **N.B.:** Only needed if you want to run inverse kinematics (`--do_ik True`).\
167
+ > **N.B.:** If you already have a Pose2Sim conda environment, you can skip this step. Just run `conda activate Pose2Sim` and `pip install sports2d`.
167
168
 
168
169
  - Install Anaconda or [Miniconda](https://docs.conda.io/en/latest/miniconda.html):\
169
170
  Open an Anaconda prompt and create a virtual environment:
@@ -424,7 +425,7 @@ sports2d --video_input demo.mp4 other_video.mp4 --time_range 1.2 2.7 0 3.5
424
425
  #### Use a custom pose estimation model:
425
426
  - Retrieve hand motion:
426
427
  ``` cmd
427
- sports2d --pose_model WholeBody
428
+ sports2d --pose_model whole_body
428
429
  ```
429
430
  - Use any custom (deployed) MMPose model
430
431
  ``` cmd
@@ -488,7 +489,7 @@ sports2d --help
488
489
  'do_ik': ["", "do inverse kinematics. false if not specified"],
489
490
  'use_augmentation': ["", "Use LSTM marker augmentation. false if not specified"],
490
491
  'feet_on_floor': ["", "offset marker augmentation results so that feet are at floor level. true if not specified"],
491
- 'use_contacts_muscles': ["", "Use model with contact spheres and muscles. false if not specified"],
492
+ 'use_simple_model': ["", "IK 10+ times faster, but no muscles or flexible spine. false if not specified"],
492
493
  'participant_mass': ["", "mass of the participant in kg or none. Defaults to 70 if not provided. No influence on kinematics (motion), only on kinetics (forces)"],
493
494
  'close_to_zero_speed_m': ["","Sum for all keypoints: about 50 px/frame or 0.2 m/frame"],
494
495
  'tracking_mode': ["", "'sports2d' or 'deepsort'. 'deepsort' is slower, harder to parametrize but can be more robust if correctly tuned"],
@@ -569,6 +570,7 @@ Will be much faster, with no impact on accuracy. However, the installation takes
569
570
 
570
571
  2. Finally, install ONNX Runtime with GPU support:
571
572
  ```
573
+ pip uninstall onnxruntime
572
574
  pip install onnxruntime-gpu
573
575
  ```
574
576
 
@@ -120,7 +120,8 @@ pip install .
120
120
 
121
121
  #### Full install
122
122
 
123
- > Only needed if you want to run inverse kinematics (`--do_ik True`).
123
+ > **N.B.:** Only needed if you want to run inverse kinematics (`--do_ik True`).\
124
+ > **N.B.:** If you already have a Pose2Sim conda environment, you can skip this step. Just run `conda activate Pose2Sim` and `pip install sports2d`.
124
125
 
125
126
  - Install Anaconda or [Miniconda](https://docs.conda.io/en/latest/miniconda.html):\
126
127
  Open an Anaconda prompt and create a virtual environment:
@@ -381,7 +382,7 @@ sports2d --video_input demo.mp4 other_video.mp4 --time_range 1.2 2.7 0 3.5
381
382
  #### Use a custom pose estimation model:
382
383
  - Retrieve hand motion:
383
384
  ``` cmd
384
- sports2d --pose_model WholeBody
385
+ sports2d --pose_model whole_body
385
386
  ```
386
387
  - Use any custom (deployed) MMPose model
387
388
  ``` cmd
@@ -445,7 +446,7 @@ sports2d --help
445
446
  'do_ik': ["", "do inverse kinematics. false if not specified"],
446
447
  'use_augmentation': ["", "Use LSTM marker augmentation. false if not specified"],
447
448
  'feet_on_floor': ["", "offset marker augmentation results so that feet are at floor level. true if not specified"],
448
- 'use_contacts_muscles': ["", "Use model with contact spheres and muscles. false if not specified"],
449
+ 'use_simple_model': ["", "IK 10+ times faster, but no muscles or flexible spine. false if not specified"],
449
450
  'participant_mass': ["", "mass of the participant in kg or none. Defaults to 70 if not provided. No influence on kinematics (motion), only on kinetics (forces)"],
450
451
  'close_to_zero_speed_m': ["","Sum for all keypoints: about 50 px/frame or 0.2 m/frame"],
451
452
  'tracking_mode': ["", "'sports2d' or 'deepsort'. 'deepsort' is slower, harder to parametrize but can be more robust if correctly tuned"],
@@ -526,6 +527,7 @@ Will be much faster, with no impact on accuracy. However, the installation takes
526
527
 
527
528
  2. Finally, install ONNX Runtime with GPU support:
528
529
  ```
530
+ pip uninstall onnxruntime
529
531
  pip install onnxruntime-gpu
530
532
  ```
531
533
 
@@ -152,7 +152,7 @@ filter_type = 'butterworth' # butterworth, gaussian, LOESS, median
152
152
  do_ik = false # Do scaling and inverse kinematics?
153
153
  use_augmentation = false # true or false (lowercase) # Set to true if you want to use the model with augmented markers
154
154
  feet_on_floor = false # true or false (lowercase) # Set to false if you want to use the model with feet not on the floor (e.g. running, jumping, etc.)
155
- use_contacts_muscles = true # true or false (lowercase) # If true, contact spheres and muscles are added to the model
155
+ use_simple_model = false # true or false # >10 times faster IK if true. No muscles, no constraints (eg stiff spine and shoulders, no patella)
156
156
  participant_mass = [55.0, 67.0] # kg # defaults to 70 if not provided. No influence on kinematics (motion), only on kinetics (forces)
157
157
  right_left_symmetry = true # true or false (lowercase) # Set to false only if you have good reasons to think the participant is not symmetrical (e.g. prosthetic limb)
158
158
 
@@ -151,7 +151,44 @@ DEFAULT_CONFIG = {'base': {'video_input': ['demo.mp4'],
151
151
  'deepsort_params': """{'max_age':30, 'n_init':3, 'nms_max_overlap':0.8, 'max_cosine_distance':0.3, 'nn_budget':200, 'max_iou_distance':0.8, 'embedder_gpu': True, 'embedder':'torchreid'}""",
152
152
  'keypoint_likelihood_threshold': 0.3,
153
153
  'average_likelihood_threshold': 0.5,
154
- 'keypoint_number_threshold': 0.3
154
+ 'keypoint_number_threshold': 0.3,
155
+ 'CUSTOM': { 'name': 'Hip',
156
+ 'id': 19,
157
+ 'children': [{'name': 'RHip',
158
+ 'id': 12,
159
+ 'children': [{'name': 'RKnee',
160
+ 'id': 14,
161
+ 'children': [{'name': 'RAnkle',
162
+ 'id': 16,
163
+ 'children': [{'name': 'RBigToe',
164
+ 'id': 21,
165
+ 'children': [{'name': 'RSmallToe', 'id': 23}]},
166
+ {'name': 'RHeel', 'id': 25}]}]}]},
167
+ {'name': 'LHip',
168
+ 'id': 11,
169
+ 'children': [{'name': 'LKnee',
170
+ 'id': 13,
171
+ 'children': [{'name': 'LAnkle',
172
+ 'id': 15,
173
+ 'children': [{'name': 'LBigToe',
174
+ 'id': 20,
175
+ 'children': [{'name': 'LSmallToe', 'id': 22}]},
176
+ {'name': 'LHeel', 'id': 24}]}]}]},
177
+ {'name': 'Neck',
178
+ 'id': 18,
179
+ 'children': [{'name': 'Head',
180
+ 'id': 17,
181
+ 'children': [{'name': 'Nose', 'id': 0}]},
182
+ {'name': 'RShoulder',
183
+ 'id': 6,
184
+ 'children': [{'name': 'RElbow',
185
+ 'id': 8,
186
+ 'children': [{'name': 'RWrist', 'id': 10}]}]},
187
+ {'name': 'LShoulder',
188
+ 'id': 5,
189
+ 'children': [{'name': 'LElbow',
190
+ 'id': 7,
191
+ 'children': [{'name': 'LWrist', 'id': 9}]}]}]}]}
155
192
  },
156
193
  'px_to_meters_conversion': {
157
194
  'to_meters': True,
@@ -206,7 +243,7 @@ DEFAULT_CONFIG = {'base': {'video_input': ['demo.mp4'],
206
243
  'kinematics':{'do_ik': False,
207
244
  'use_augmentation': False,
208
245
  'feet_on_floor': False,
209
- 'use_contacts_muscles': True,
246
+ 'use_simple_model ': True,
210
247
  'participant_mass': [55.0, 67.0],
211
248
  'right_left_symmetry': True,
212
249
  'default_height': 1.70,
@@ -260,7 +297,7 @@ CONFIG_HELP = {'config': ["C", "path to a toml configuration file"],
260
297
  'do_ik': ["", "do inverse kinematics. false if not specified"],
261
298
  'use_augmentation': ["", "Use LSTM marker augmentation. false if not specified"],
262
299
  'feet_on_floor': ["", "offset marker augmentation results so that feet are at floor level. true if not specified"],
263
- 'use_contacts_muscles': ["", "Use model with contact spheres and muscles. false if not specified"],
300
+ 'use_simple_model ': ["", ">10 times faster IK if true. No muscles, no constraints (eg stiff spine and shoulders, no patella). false if not specified"],
264
301
  'participant_mass': ["", "mass of the participant in kg or none. Defaults to 70 if not provided. No influence on kinematics (motion), only on kinetics (forces)"],
265
302
  'close_to_zero_speed_m': ["","Sum for all keypoints: about 50 px/frame or 0.2 m/frame"],
266
303
  'tracking_mode': ["", "'sports2d' or 'deepsort'. 'deepsort' is slower, harder to parametrize but can be more robust if correctly tuned"],
@@ -59,14 +59,13 @@ import ast
59
59
  import copy
60
60
  import shutil
61
61
  import os
62
+ import re
62
63
  from importlib.metadata import version
63
- from functools import partial
64
64
  from datetime import datetime
65
65
  import itertools as it
66
66
  from tqdm import tqdm
67
67
  from collections import defaultdict
68
68
  from anytree import RenderTree
69
- from anytree.importer import DictImporter
70
69
 
71
70
  import numpy as np
72
71
  import pandas as pd
@@ -76,7 +75,7 @@ import matplotlib.pyplot as plt
76
75
  from matplotlib.widgets import Slider, Button
77
76
  from matplotlib import patheffects
78
77
 
79
- from rtmlib import PoseTracker, BodyWithFeet, Wholebody, Body, Custom
78
+ from rtmlib import PoseTracker, BodyWithFeet, Wholebody, Body, Hand, Custom
80
79
  from deep_sort_realtime.deepsort_tracker import DeepSort
81
80
 
82
81
  from Sports2D.Utilities import filter
@@ -193,6 +192,79 @@ def setup_video(video_file_path, save_vid, vid_output_path):
193
192
  return cap, out_vid, cam_width, cam_height, fps
194
193
 
195
194
 
195
+ def setup_model_class_mode(pose_model, mode, config_dict={}):
196
+ '''
197
+
198
+ '''
199
+
200
+ if pose_model.upper() in ('HALPE_26', 'BODY_WITH_FEET'):
201
+ model_name = 'HALPE_26'
202
+ ModelClass = BodyWithFeet # 26 keypoints(halpe26)
203
+ logging.info(f"Using HALPE_26 model (body and feet) for pose estimation in {mode} mode.")
204
+ elif pose_model.upper() in ('COCO_133', 'WHOLE_BODY', 'WHOLE_BODY_WRIST'):
205
+ model_name = 'COCO_133'
206
+ ModelClass = Wholebody
207
+ logging.info(f"Using COCO_133 model (body, feet, hands, and face) for pose estimation in {mode} mode.")
208
+ elif pose_model.upper() in ('COCO_17', 'BODY'):
209
+ model_name = 'COCO_17'
210
+ ModelClass = Body
211
+ logging.info(f"Using COCO_17 model (body) for pose estimation in {mode} mode.")
212
+ elif pose_model.upper() =='HAND':
213
+ model_name = 'HAND_21'
214
+ ModelClass = Hand
215
+ logging.info(f"Using HAND_21 model for pose estimation in {mode} mode.")
216
+ elif pose_model.upper() =='FACE':
217
+ model_name = 'FACE_106'
218
+ logging.info(f"Using FACE_106 model for pose estimation in {mode} mode.")
219
+ elif pose_model.upper() =='ANIMAL':
220
+ model_name = 'ANIMAL2D_17'
221
+ logging.info(f"Using ANIMAL2D_17 model for pose estimation in {mode} mode.")
222
+ else:
223
+ model_name = pose_model.upper()
224
+ logging.info(f"Using model {model_name} for pose estimation in {mode} mode.")
225
+ try:
226
+ pose_model = eval(model_name)
227
+ except:
228
+ try: # from Config.toml
229
+ from anytree.importer import DictImporter
230
+ model_name = pose_model.upper()
231
+ pose_model = DictImporter().import_(config_dict.get('pose').get(pose_model))
232
+ if pose_model.id == 'None':
233
+ pose_model.id = None
234
+ logging.info(f"Using model {model_name} for pose estimation.")
235
+ except:
236
+ raise NameError(f'{pose_model} not found in skeletons.py nor in Config.toml')
237
+
238
+ # Manually select the models if mode is a dictionary rather than 'lightweight', 'balanced', or 'performance'
239
+ if not mode in ['lightweight', 'balanced', 'performance'] or 'ModelClass' not in locals():
240
+ try:
241
+ from functools import partial
242
+ try:
243
+ mode = ast.literal_eval(mode)
244
+ except: # if within single quotes instead of double quotes when run with sports2d --mode """{dictionary}"""
245
+ mode = mode.strip("'").replace('\n', '').replace(" ", "").replace(",", '", "').replace(":", '":"').replace("{", '{"').replace("}", '"}').replace('":"/',':/').replace('":"\\',':\\')
246
+ mode = re.sub(r'"\[([^"]+)",\s?"([^"]+)\]"', r'[\1,\2]', mode) # changes "[640", "640]" to [640,640]
247
+ mode = json.loads(mode)
248
+ det_class = mode.get('det_class')
249
+ det = mode.get('det_model')
250
+ det_input_size = mode.get('det_input_size')
251
+ pose_class = mode.get('pose_class')
252
+ pose = mode.get('pose_model')
253
+ pose_input_size = mode.get('pose_input_size')
254
+
255
+ ModelClass = partial(Custom,
256
+ det_class=det_class, det=det, det_input_size=det_input_size,
257
+ pose_class=pose_class, pose=pose, pose_input_size=pose_input_size)
258
+ logging.info(f"Using model {model_name} with the following custom parameters: {mode}.")
259
+
260
+ except (json.JSONDecodeError, TypeError):
261
+ logging.warning("Invalid mode. Must be 'lightweight', 'balanced', 'performance', or '''{dictionary}''' of parameters within triple quotes. Make sure input_sizes are within square brackets.")
262
+ logging.warning('Using the default "balanced" mode.')
263
+ mode = 'balanced'
264
+
265
+ return pose_model, ModelClass, mode
266
+
267
+
196
268
  def setup_backend_device(backend='auto', device='auto'):
197
269
  '''
198
270
  Set up the backend and device for the pose tracker based on the availability of hardware acceleration.
@@ -1427,74 +1499,15 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1427
1499
  cv2.namedWindow(f'{video_file} Sports2D', cv2.WINDOW_NORMAL + cv2.WINDOW_KEEPRATIO)
1428
1500
  cv2.setWindowProperty(f'{video_file} Sports2D', cv2.WND_PROP_ASPECT_RATIO, cv2.WINDOW_FULLSCREEN)
1429
1501
 
1502
+
1430
1503
  # Select the appropriate model based on the model_type
1431
1504
  logging.info('\nEstimating pose...')
1432
- if pose_model.upper() in ('HALPE_26', 'BODY_WITH_FEET'):
1433
- model_name = 'HALPE_26'
1434
- ModelClass = BodyWithFeet # 26 keypoints(halpe26)
1435
- logging.info(f"Using HALPE_26 model (body and feet) for pose estimation.")
1436
- elif pose_model.upper() in ('COCO_133', 'WHOLE_BODY', 'WHOLE_BODY_WRIST'):
1437
- model_name = 'COCO_133'
1438
- ModelClass = Wholebody
1439
- logging.info(f"Using COCO_133 model (body, feet, hands, and face) for pose estimation.")
1440
- elif pose_model.upper() in ('COCO_17', 'BODY'):
1441
- model_name = 'COCO_17'
1442
- ModelClass = Body
1443
- logging.info(f"Using COCO_17 model (body) for pose estimation.")
1444
- elif pose_model.upper() =='HAND':
1445
- model_name = 'HAND_21'
1446
- ModelClass = Hand
1447
- logging.info(f"Using HAND_21 model for pose estimation.")
1448
- elif pose_model.upper() =='FACE':
1449
- model_name = 'FACE_106'
1450
- logging.info(f"Using FACE_106 model for pose estimation.")
1451
- elif pose_model.upper() =='ANIMAL':
1452
- model_name = 'ANIMAL2D_17'
1453
- logging.info(f"Using ANIMAL2D_17 model for pose estimation.")
1454
- else:
1455
- model_name = pose_model.upper()
1456
- logging.info(f"Using model {model_name} for pose estimation.")
1457
1505
  pose_model_name = pose_model
1458
- try:
1459
- pose_model = eval(model_name)
1460
- except:
1461
- try: # from Config.toml
1462
- pose_model = DictImporter().import_(config_dict.get('pose').get(pose_model))
1463
- if pose_model.id == 'None':
1464
- pose_model.id = None
1465
- except:
1466
- raise NameError(f'{pose_model} not found in skeletons.py nor in Config.toml')
1467
-
1506
+ pose_model, ModelClass, mode = setup_model_class_mode(pose_model, mode, config_dict)
1507
+
1468
1508
  # Select device and backend
1469
1509
  backend, device = setup_backend_device(backend=backend, device=device)
1470
1510
 
1471
- # Manually select the models if mode is a dictionary rather than 'lightweight', 'balanced', or 'performance'
1472
- if not mode in ['lightweight', 'balanced', 'performance']:
1473
- try:
1474
- try:
1475
- mode = ast.literal_eval(mode)
1476
- except: # if within single quotes instead of double quotes when run with sports2d --mode """{dictionary}"""
1477
- mode = mode.strip("'").replace('\n', '').replace(" ", "").replace(",", '", "').replace(":", '":"').replace("{", '{"').replace("}", '"}').replace('":"/',':/').replace('":"\\',':\\')
1478
- mode = re.sub(r'"\[([^"]+)",\s?"([^"]+)\]"', r'[\1,\2]', mode) # changes "[640", "640]" to [640,640]
1479
- mode = json.loads(mode)
1480
- det_class = mode.get('det_class')
1481
- det = mode.get('det_model')
1482
- det_input_size = mode.get('det_input_size')
1483
- pose_class = mode.get('pose_class')
1484
- pose = mode.get('pose_model')
1485
- pose_input_size = mode.get('pose_input_size')
1486
-
1487
- ModelClass = partial(Custom,
1488
- det_class=det_class, det=det, det_input_size=det_input_size,
1489
- pose_class=pose_class, pose=pose, pose_input_size=pose_input_size,
1490
- backend=backend, device=device)
1491
-
1492
- except (json.JSONDecodeError, TypeError):
1493
- logging.warning("Invalid mode. Must be 'lightweight', 'balanced', 'performance', or '''{dictionary}''' of parameters within triple quotes. Make sure input_sizes are within square brackets.")
1494
- logging.warning('Using the default "balanced" mode.')
1495
- mode = 'balanced'
1496
-
1497
-
1498
1511
  # Skip pose estimation or set it up:
1499
1512
  if load_trc_px:
1500
1513
  if not '_px' in str(load_trc_px):
@@ -1524,9 +1537,14 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1524
1537
  # Set up pose tracker
1525
1538
  try:
1526
1539
  pose_tracker = setup_pose_tracker(ModelClass, det_frequency, mode, False, backend, device)
1527
- except:
1528
- logging.error('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
1529
- raise ValueError('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
1540
+ except: # for multi-threading
1541
+ try:
1542
+ import time
1543
+ time.sleep(3)
1544
+ pose_tracker = setup_pose_tracker(ModelClass, det_frequency, mode, False, backend, device)
1545
+ except:
1546
+ logging.error('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
1547
+ raise ValueError('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
1530
1548
 
1531
1549
  if tracking_mode not in ['deepsort', 'sports2d']:
1532
1550
  logging.warning(f"Tracking mode {tracking_mode} not recognized. Using sports2d method.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sports2d
3
- Version: 0.8.7
3
+ Version: 0.8.9
4
4
  Summary: Compute 2D human pose and angles from a video or a webcam.
5
5
  Author-email: David Pagnon <contact@david-pagnon.com>
6
6
  Maintainer-email: David Pagnon <contact@david-pagnon.com>
@@ -163,7 +163,8 @@ pip install .
163
163
 
164
164
  #### Full install
165
165
 
166
- > Only needed if you want to run inverse kinematics (`--do_ik True`).
166
+ > **N.B.:** Only needed if you want to run inverse kinematics (`--do_ik True`).\
167
+ > **N.B.:** If you already have a Pose2Sim conda environment, you can skip this step. Just run `conda activate Pose2Sim` and `pip install sports2d`.
167
168
 
168
169
  - Install Anaconda or [Miniconda](https://docs.conda.io/en/latest/miniconda.html):\
169
170
  Open an Anaconda prompt and create a virtual environment:
@@ -424,7 +425,7 @@ sports2d --video_input demo.mp4 other_video.mp4 --time_range 1.2 2.7 0 3.5
424
425
  #### Use a custom pose estimation model:
425
426
  - Retrieve hand motion:
426
427
  ``` cmd
427
- sports2d --pose_model WholeBody
428
+ sports2d --pose_model whole_body
428
429
  ```
429
430
  - Use any custom (deployed) MMPose model
430
431
  ``` cmd
@@ -488,7 +489,7 @@ sports2d --help
488
489
  'do_ik': ["", "do inverse kinematics. false if not specified"],
489
490
  'use_augmentation': ["", "Use LSTM marker augmentation. false if not specified"],
490
491
  'feet_on_floor': ["", "offset marker augmentation results so that feet are at floor level. true if not specified"],
491
- 'use_contacts_muscles': ["", "Use model with contact spheres and muscles. false if not specified"],
492
+ 'use_simple_model': ["", "IK 10+ times faster, but no muscles or flexible spine. false if not specified"],
492
493
  'participant_mass': ["", "mass of the participant in kg or none. Defaults to 70 if not provided. No influence on kinematics (motion), only on kinetics (forces)"],
493
494
  'close_to_zero_speed_m': ["","Sum for all keypoints: about 50 px/frame or 0.2 m/frame"],
494
495
  'tracking_mode': ["", "'sports2d' or 'deepsort'. 'deepsort' is slower, harder to parametrize but can be more robust if correctly tuned"],
@@ -569,6 +570,7 @@ Will be much faster, with no impact on accuracy. However, the installation takes
569
570
 
570
571
  2. Finally, install ONNX Runtime with GPU support:
571
572
  ```
573
+ pip uninstall onnxruntime
572
574
  pip install onnxruntime-gpu
573
575
  ```
574
576
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes