sports2d 0.5.6__py3-none-any.whl → 0.6.1__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: sports2d
3
- Version: 0.5.6
3
+ Version: 0.6.1
4
4
  Summary: Detect pose and compute 2D joint angles from a video.
5
5
  Home-page: https://github.com/davidpagnon/Sports2D
6
6
  Author: David Pagnon
@@ -33,7 +33,7 @@ Requires-Dist: opencv-python
33
33
  Requires-Dist: matplotlib
34
34
  Requires-Dist: PyQt5
35
35
  Requires-Dist: statsmodels
36
- Requires-Dist: rtmlib
36
+ Requires-Dist: rtmlib_pose2sim
37
37
  Requires-Dist: openvino
38
38
  Requires-Dist: tqdm
39
39
  Requires-Dist: imageio_ffmpeg
@@ -96,7 +96,8 @@ If you need 3D research-grade markerless joint kinematics, consider using severa
96
96
  2. [Go further](#go-further)
97
97
  1. [Too slow for you?](#too-slow-for-you)
98
98
  2. [What you need is what you get](#what-you-need-is-what-you-get)
99
- 3. [How it works](#how-it-works)
99
+ 3. [All the parameters](#all-the-parameters)
100
+ 4. [How it works](#how-it-works)
100
101
  3. [How to cite and how to contribute](#how-to-cite-and-how-to-contribute)
101
102
 
102
103
  <br>
@@ -160,12 +161,13 @@ The Demo video is voluntarily challenging to demonstrate the robustness of the p
160
161
  - One person walking in the sagittal plane
161
162
  - One person doing jumping jacks in the frontal plane. This person then performs a flip while being backlit, both of which are challenging for the pose detection algorithm
162
163
  - One tiny person flickering in the background who needs to be ignored
164
+ - The first person is starting high and ending low on the image, which messes up the automatic floor angle calculation. You can set it up manually with the parameter `--floor_angle 0`
163
165
 
164
166
  <br>
165
167
 
166
168
  ### Play with the parameters
167
169
 
168
- For a full list of the available parameters, check the [Config_Demo.toml](https://github.com/davidpagnon/Sports2D/blob/main/Sports2D/Demo/Config_demo.toml) file or type:
170
+ For a full list of the available parameters, see [this section](#all-the-parameters) of the documentation, check the [Config_Demo.toml](https://github.com/davidpagnon/Sports2D/blob/main/Sports2D/Demo/Config_demo.toml) file, or type:
169
171
  ``` cmd
170
172
  sports2d --help
171
173
  ```
@@ -208,7 +210,7 @@ Note that it does not take distortions into account, and that it will be less ac
208
210
  sports2d --show_graphs False --time_range 1.2 2.7 --result_dir path_to_result_dir --slowmo_factor 4
209
211
  ```
210
212
  ``` cmd
211
- sports2d --multiperson false --mode lightweight --det_frequency 50
213
+ sports2d --multiperson false --pose_model Body --mode lightweight --det_frequency 50
212
214
  ```
213
215
  <br>
214
216
 
@@ -234,7 +236,16 @@ Note that it does not take distortions into account, and that it will be less ac
234
236
 
235
237
  **Quick fixes:**
236
238
  - Use ` --save_vid false --save_img false --show_realtime_results false`: Will not save images or videos, and will not display the results in real time.
237
- - Use `--mode lightweight`: Will use a lighter version of RTMPose, which is faster but less accurate.
239
+ - Use `--mode lightweight`: Will use a lighter version of RTMPose, which is faster but less accurate.\
240
+ Note that any detection and pose models can be used (first [deploy them with MMPose](https://mmpose.readthedocs.io/en/latest/user_guides/how_to_deploy.html#onnx) if you do not have their .onnx or .zip files), with the following formalism:
241
+ ```
242
+ --mode """{'det_class':'YOLOX',
243
+ 'det_model':'https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/onnx_sdk/yolox_nano_8xb8-300e_humanart-40f6f0d0.zip',
244
+ 'det_input_size':[416,416],
245
+ 'pose_class':'RTMPose',
246
+ 'pose_model':'https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/onnx_sdk/rtmpose-t_simcc-body7_pt-body7_420e-256x192-026a1439_20230504.zip',
247
+ 'pose_input_size':[192,256]}"""
248
+ ```
238
249
  - Use `--det_frequency 50`: Will detect poses only every 50 frames, and track keypoints in between, which is faster.
239
250
  - Use `--multiperson false`: Can be used if one single person is present in the video. Otherwise, persons' IDs may be mixed up.
240
251
  - Use `--load_trc <path_to_file_px.trc>`: Will use pose estimation results from a file. Useful if you want to use different parameters for pixel to meter conversion or angle calculation without running detection and pose estimation all over.
@@ -278,9 +289,9 @@ Will be much faster, with no impact on accuracy. However, the installation takes
278
289
  <br>
279
290
 
280
291
  #### Customize your output:
281
- - Choose whether you want video, images, trc pose file, angle mot file, and real-time display:
292
+ - Choose whether you want video, images, trc pose file, angle mot file, real-time display, and plots:
282
293
  ```cmd
283
- sports2d --save_vid false --save_img true --save_pose false --save_angles true --show_realtime_results false
294
+ sports2d --save_vid false --save_img true --save_pose false --save_angles true --show_realtime_results false --show_graphs false
284
295
  ```
285
296
  - Choose which angles you need:
286
297
  ```cmd
@@ -355,6 +366,82 @@ sports2d --time_range 1.2 2.7 --ik true --person_orientation front none left
355
366
 
356
367
  <br>
357
368
 
369
+
370
+ ### All the parameters
371
+
372
+ Have a look at the [Config_Demo.toml](https://github.com/davidpagnon/Sports2D/blob/main/Sports2D/Demo/Config_demo.toml) file or type for a full list of the available parameters:
373
+
374
+ ``` cmd
375
+ sports2d --help
376
+ ```
377
+
378
+ ```
379
+ ['config': "C", "path to a toml configuration file"],
380
+
381
+ 'video_input': ["i", "webcam, or video_path.mp4, or video1_path.avi video2_path.mp4 ... Beware that images won't be saved if paths contain non ASCII characters"],
382
+ 'person_height': ["H", "height of the person in meters. 1.70 if not specified"],
383
+ 'load_trc': ["", "load trc file to avaid running pose estimation again. false if not specified"],
384
+ 'compare': ["", "visually compare motion with trc file. false if not specified"],
385
+ 'webcam_id': ["w", "webcam ID. 0 if not specified"],
386
+ 'time_range': ["t", "start_time end_time. In seconds. Whole video if not specified. start_time1 end_time1 start_time2 end_time2 ... if multiple videos with different time ranges"],
387
+ 'video_dir': ["d", "current directory if not specified"],
388
+ 'result_dir': ["r", "current directory if not specified"],
389
+ 'show_realtime_results': ["R", "show results in real-time. true if not specified"],
390
+ 'display_angle_values_on': ["a", '"body", "list", "body" "list", or "none". body list if not specified'],
391
+ 'show_graphs': ["G", "show plots of raw and processed results. true if not specified"],
392
+ 'joint_angles': ["j", '"Right ankle" "Left ankle" "Right knee" "Left knee" "Right hip" "Left hip" "Right shoulder" "Left shoulder" "Right elbow" "Left elbow" if not specified'],
393
+ 'segment_angles': ["s", '"Right foot" "Left foot" "Right shank" "Left shank" "Right thigh" "Left thigh" "Pelvis" "Trunk" "Shoulders" "Head" "Right arm" "Left arm" "Right forearm" "Left forearm" if not specified'],
394
+ 'save_vid': ["V", "save processed video. true if not specified"],
395
+ 'save_img': ["I", "save processed images. true if not specified"],
396
+ 'save_pose': ["P", "save pose as trc files. true if not specified"],
397
+ 'calculate_angles': ["c", "calculate joint and segment angles. true if not specified"],
398
+ 'save_angles': ["A", "save angles as mot files. true if not specified"],
399
+ 'slowmo_factor': ["", "slow-motion factor. For a video recorded at 240 fps and exported to 30 fps, it would be 240/30 = 8. 1 if not specified"],
400
+ 'pose_model': ["p", "only body_with_feet is available for now. body_with_feet if not specified"],
401
+ 'mode': ["m", "light, balanced, or performance. balanced if not specified"],
402
+ '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\
403
+ 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"],
404
+ 'to_meters': ["M", "convert pixels to meters. true if not specified"],
405
+
406
+ 'backend': ["", "Backend for pose estimation can be 'auto', 'cpu', 'cuda', 'mps' (for MacOS), or 'rocm' (for AMD GPUs)"],
407
+ 'device': ["", "Device for pose estimatino can be 'auto', 'openvino', 'onnxruntime', 'opencv'"],
408
+ 'calib_on_person_id': ["", "person ID to calibrate on. 0 if not specified"],
409
+ 'floor_angle': ["", "angle of the floor. 'auto' if not specified"],
410
+ 'xy_origin': ["", "origin of the xy plane. 'auto' if not specified"],
411
+ 'calib_file': ["", "path to calibration file. '' if not specified, eg no calibration file"],
412
+ 'save_calib': ["", "save calibration file. true if not specified"],
413
+ 'do_ik': ["", "do inverse kinematics. false if not specified"],
414
+ 'osim_setup_path': ["", "path to OpenSim setup. '../OpenSim_setup' if not specified"],
415
+ 'person_orientation': ["", "front, back, left, right, auto, or none. 'front none left' if not specified. If 'auto', will be either left or right depending on the direction of the motion."],
416
+ 'close_to_zero_speed_m': ["","Sum for all keypoints: about 50 px/frame or 0.2 m/frame"],
417
+ 'multiperson': ["", "multiperson 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"],
418
+ 'input_size': ["", "width, height. 1280, 720 if not specified. Lower resolution will be faster but less precise"],
419
+ 'keypoint_likelihood_threshold': ["", "detected keypoints are not retained if likelihood is below this threshold. 0.3 if not specified"],
420
+ 'average_likelihood_threshold': ["", "detected persons are not retained if average keypoint likelihood is below this threshold. 0.5 if not specified"],
421
+ 'keypoint_number_threshold': ["", "detected persons are not retained if number of detected keypoints is below this threshold. 0.3 if not specified, i.e., i.e., 30 percent"],
422
+ 'fastest_frames_to_remove_percent': ["", "Frames with high speed are considered as outliers. Defaults to 0.1"],
423
+ 'close_to_zero_speed_px': ["", "Sum for all keypoints: about 50 px/frame or 0.2 m/frame. Defaults to 50"],
424
+ 'large_hip_knee_angles': ["", "Hip and knee angles below this value are considered as imprecise. Defaults to 45"],
425
+ 'trimmed_extrema_percent': ["", "Proportion of the most extreme segment values to remove before calculating their mean. Defaults to 50"],
426
+ 'fontSize': ["", "font size for angle values. 0.3 if not specified"],
427
+ 'flip_left_right': ["", "true or false. true to get consistent angles with people facing both left and right sides. Set it to false if you want timeseries to be continuous even when the participent switches their stance. true if not specified"],
428
+ 'correct_segment_angles_with_floor_angle': ["", "true or false. If the camera is tilted, corrects segment angles as regards to the floor angle. Set to false is the floor is tilted instead. True if not specified"],
429
+ 'interpolate': ["", "interpolate missing data. true if not specified"],
430
+ 'interp_gap_smaller_than': ["", "interpolate sequences of missing data if they are less than N frames long. 10 if not specified"],
431
+ 'fill_large_gaps_with': ["", "last_value, nan, or zeros. last_value if not specified"],
432
+ 'filter': ["", "filter results. true if not specified"],
433
+ 'filter_type': ["", "butterworth, gaussian, median, or loess. butterworth if not specified"],
434
+ 'order': ["", "order of the Butterworth filter. 4 if not specified"],
435
+ 'cut_off_frequency': ["", "cut-off frequency of the Butterworth filter. 3 if not specified"],
436
+ 'sigma_kernel': ["", "sigma of the gaussian filter. 1 if not specified"],
437
+ 'nb_values_used': ["", "number of values used for the loess filter. 5 if not specified"],
438
+ 'kernel_size': ["", "kernel size of the median filter. 3 if not specified"],
439
+ 'use_custom_logging': ["", "use custom logging. false if not specified"]
440
+ ```
441
+
442
+ <br>
443
+
444
+
358
445
  ### How it works
359
446
 
360
447
  Sports2D:
@@ -455,7 +542,11 @@ If you want to contribute to Sports2D, please follow [this guide](https://docs.g
455
542
  - [x] Option to only save one person (with the highest average score, or with the most frames and fastest speed)
456
543
  - [x] Run again without pose estimation with the option `--load_trc` for px .trc file.
457
544
  - [x] **Convert positions to meters** by providing the person height, a calibration file, or 3D points [to click on the image](https://stackoverflow.com/questions/74248955/how-to-display-the-coordinates-of-the-points-clicked-on-the-image-in-google-cola)
545
+ - [x] Support any detection and/or pose estimation model.
546
+
458
547
  - [ ] Perform **Inverse kinematics and dynamics** with OpenSim (cf. [Pose2Sim](https://github.com/perfanalytics/pose2sim), but in 2D). Update [this model](https://github.com/davidpagnon/Sports2D/blob/main/Sports2D/Utilities/2D_gait.osim) (add arms, markers, remove muscles and contact spheres). Add pipeline example.
548
+ - [ ] Optionally let user select the person of interest in single_person mode:\
549
+ `multiperson = true # true, or 'single_auto', or 'single_click'. 'single_auto' selects the person with highest average likelihood, and 'single_click' lets the user manually select the person of interest.`
459
550
  - [ ] Run with the option `--compare_to` to visually compare motion with a trc file. If run with a webcam input, the user can follow the motion of the trc file. Further calculation can then be done to compare specific variables.
460
551
  - [ ] **Colab version**: more user-friendly, usable on a smartphone.
461
552
  - [ ] **GUI applications** for Windows, Mac, and Linux, as well as for Android and iOS.
@@ -0,0 +1,16 @@
1
+ Sports2D/Sports2D.py,sha256=ASgy0qsSDceBq4XFYo99ZFyJdNED72yDfgyMCJkhs-Q,27380
2
+ Sports2D/__init__.py,sha256=TyCP7Uuuy6CNklhPf8W84MbYoO1_-1dxowSYAJyk_OI,102
3
+ Sports2D/process.py,sha256=yAOS5nMAW0osCa-1wUEElNjy9hDCHhp7D_ug4b3A7DY,86671
4
+ Sports2D/Demo/Config_demo.toml,sha256=0OXf19HlAWjeev6D6EaADREhdvONp74HrjBxXBt1Keo,11378
5
+ Sports2D/Demo/demo.mp4,sha256=2aZkFxhWR7ESMEtXCT8MGA83p2jmoU2sp1ylQfO3gDk,3968304
6
+ Sports2D/Utilities/__init__.py,sha256=TyCP7Uuuy6CNklhPf8W84MbYoO1_-1dxowSYAJyk_OI,102
7
+ Sports2D/Utilities/common.py,sha256=Ak8ovbU4zInqMhqRw2CIz50diZyqtZ9nhVtpI1zamCQ,28303
8
+ Sports2D/Utilities/filter.py,sha256=8mVefMjDzxmh9a30eNtIrUuK_mUKoOJ2Nr-OzcQKkKM,4922
9
+ Sports2D/Utilities/skeletons.py,sha256=-EtpcoGxwAtJLr02_svLhdkFoNaQiUGj7cfK_aazgB0,40290
10
+ Sports2D/Utilities/tests.py,sha256=U0uwhPgcDY7HavI5f3HmfWydFi8eOfn_h4FIRCRhFcc,3104
11
+ sports2d-0.6.1.dist-info/LICENSE,sha256=f4qe3nE0Y7ltJho5w-xAR0jI5PUox5Xl-MsYiY7ZRM8,1521
12
+ sports2d-0.6.1.dist-info/METADATA,sha256=-GBzyA-5TSJfBBzP4fmYTsLkSpgKH9Z_2guBiIoezc8,31271
13
+ sports2d-0.6.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ sports2d-0.6.1.dist-info/entry_points.txt,sha256=h2CJTuydtNf8JyaLoWxWl5HTSIxx5Ra_FSiSGQsf7Sk,52
15
+ sports2d-0.6.1.dist-info/top_level.txt,sha256=DoURf9UDB8lQ_9lMUPQMQqhXCvWPFFjJco9NzPlHJ6I,9
16
+ sports2d-0.6.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,16 +0,0 @@
1
- Sports2D/Sports2D.py,sha256=dZv4xglguFJZDu9Zv0AZKAGu1TQIW9ynmY8pMsNHw14,26377
2
- Sports2D/__init__.py,sha256=TyCP7Uuuy6CNklhPf8W84MbYoO1_-1dxowSYAJyk_OI,102
3
- Sports2D/process.py,sha256=uX35szjJ6T7tOcqXQsljnS6xD1T9ufo2_hhJFI29cKo,89117
4
- Sports2D/Demo/Config_demo.toml,sha256=CeHY91RXrt26TzvtXnCq7Hp2gMdu3EX-flZxaH0DqyA,6768
5
- Sports2D/Demo/demo.mp4,sha256=2aZkFxhWR7ESMEtXCT8MGA83p2jmoU2sp1ylQfO3gDk,3968304
6
- Sports2D/Utilities/__init__.py,sha256=TyCP7Uuuy6CNklhPf8W84MbYoO1_-1dxowSYAJyk_OI,102
7
- Sports2D/Utilities/common.py,sha256=FEWmlq9HNlHzA2ioV5MPPOeC-5Py4JaDbIIxQgq9hGE,14128
8
- Sports2D/Utilities/filter.py,sha256=8mVefMjDzxmh9a30eNtIrUuK_mUKoOJ2Nr-OzcQKkKM,4922
9
- Sports2D/Utilities/skeletons.py,sha256=44IWpz47zjh_6YDqkwaJnSysaGi7ovgYE25ji-hC-Kw,15660
10
- Sports2D/Utilities/tests.py,sha256=g06HBExGkvZrhZpNXN19G9Shisfgp1cqjAp0kFxiKEc,2574
11
- sports2d-0.5.6.dist-info/LICENSE,sha256=f4qe3nE0Y7ltJho5w-xAR0jI5PUox5Xl-MsYiY7ZRM8,1521
12
- sports2d-0.5.6.dist-info/METADATA,sha256=X6YrqZQnm0k9MG59MJe3pguWBwxR0mJ7-c0SWc-67FY,23221
13
- sports2d-0.5.6.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
14
- sports2d-0.5.6.dist-info/entry_points.txt,sha256=h2CJTuydtNf8JyaLoWxWl5HTSIxx5Ra_FSiSGQsf7Sk,52
15
- sports2d-0.5.6.dist-info/top_level.txt,sha256=DoURf9UDB8lQ_9lMUPQMQqhXCvWPFFjJco9NzPlHJ6I,9
16
- sports2d-0.5.6.dist-info/RECORD,,