sports2d 0.8.17__py3-none-any.whl → 0.8.18__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.
@@ -139,11 +139,12 @@ reject_outliers = true # Hampel filter for outlier rejection before other f
139
139
 
140
140
  filter = true
141
141
  show_graphs = true # Show plots of raw and processed results
142
- filter_type = 'butterworth' # butterworth, gcv_spline, kalman, gaussian, loess, median, butterworth_on_speed
142
+ filter_type = 'butterworth' # butterworth, kalman, gcv_spline, gaussian, loess, median, butterworth_on_speed
143
+
143
144
  # Most intuitive and standard filter in biomechanics
144
145
  [post-processing.butterworth]
145
- order = 4
146
146
  cut_off_frequency = 6 # Hz # Will be divided by slowmo_factor to be equivalent to non slowed-down video
147
+ order = 4
147
148
 
148
149
  # Used in countless applications, this one is a simplified Kalman filter
149
150
  [post-processing.kalman]
@@ -153,8 +154,8 @@ filter_type = 'butterworth' # butterworth, gcv_spline, kalman, gaussian, loe
153
154
 
154
155
  # Automatically determines optimal parameters for each point, which is good when some move faster than others (eg fingers vs hips).
155
156
  [post-processing.gcv_spline]
156
- cut_off_frequency = 'auto' # 'auto' or int # If int, behaves like a Butterworth filter. 'auto' is sometimes unstable
157
- smoothing_factor = 0.1 # >=0, ignored if cut_off_frequency != 'auto'. Biases results towards more smoothing (>1) or more fidelity to data (<1)
157
+ gcv_cut_off_frequency = 'auto' # 'auto' or int # If int, behaves like a Butterworth filter. 'auto' is usually better, unless the signal is too short (noise can then be considered as signal -> trajectories not filtered)
158
+ gcv_smoothing_factor = 0.1 # >=0, ignored if cut_off_frequency != 'auto'. Biases results towards more smoothing (>1) or more fidelity to data (<1)
158
159
 
159
160
  [post-processing.loess]
160
161
  nb_values_used = 5 # = fraction of data used * nb frames
Sports2D/Sports2D.py CHANGED
@@ -239,7 +239,7 @@ DEFAULT_CONFIG = {'base': {'video_input': ['demo.mp4'],
239
239
  'filter_type': 'butterworth',
240
240
  'butterworth': {'order': 4, 'cut_off_frequency': 6.0},
241
241
  'kalman': {'trust_ratio': 500.0, 'smooth':True},
242
- 'gcv_spline': {'gcv_cut_off_frequency': 'auto', 'smoothing_factor': 0.1},
242
+ 'gcv_spline': {'gcv_cut_off_frequency': 'auto', 'gcv_smoothing_factor': 1.0},
243
243
  'gaussian': {'sigma_kernel': 1},
244
244
  'loess': {'nb_values_used': 5},
245
245
  'median': {'kernel_size': 3},
@@ -327,12 +327,12 @@ CONFIG_HELP = {'config': ["C", "path to a toml configuration file"],
327
327
  'reject_outliers': ["", "reject outliers with Hampel filter before other filtering methods. true if not specified"],
328
328
  'filter': ["", "filter results. true if not specified"],
329
329
  'filter_type': ["", "butterworth, kalman, gcv_spline, gaussian, median, or loess. butterworth if not specified"],
330
+ 'cut_off_frequency': ["", "cut-off frequency of the Butterworth filter. 6 if not specified"],
330
331
  'order': ["", "order of the Butterworth filter. 4 if not specified"],
331
- 'cut_off_frequency': ["", "cut-off frequency of the Butterworth filter. 3 if not specified"],
332
+ 'gcv_cut_off_frequency': ["", "cut-off frequency of the GCV spline filter. 'auto' is usually better, unless the signal is too short (noise can then be considered as signal -> trajectories not filtered). 'auto' if not specified"],
333
+ 'gcv_smoothing_factor': ["", "smoothing factor of the GCV spline filter (>=0). Ignored if cut_off_frequency != 'auto'. Biases results towards more smoothing (>1) or more fidelity to data (<1). 1.0 if not specified"],
332
334
  'trust_ratio': ["", "trust ratio of the Kalman filter: How much more do you trust triangulation results (measurements), than the assumption of constant acceleration(process)? 500 if not specified"],
333
335
  'smooth': ["", "dual Kalman smoothing. true if not specified"],
334
- 'gcv_cut_off_frequency': ["", "cut-off frequency of the GCV spline filter. 'auto' if not specified"],
335
- 'smoothing_factor': ["", "smoothing factor of the GCV spline filter (>=0). Ignored if cut_off_frequency != 'auto'. Biases results towards more smoothing (>1) or more fidelity to data (<1). 0.1 if not specified"],
336
336
  'sigma_kernel': ["", "sigma of the gaussian filter. 1 if not specified"],
337
337
  'nb_values_used': ["", "number of values used for the loess filter. 5 if not specified"],
338
338
  'kernel_size': ["", "kernel size of the median filter. 3 if not specified"],
Sports2D/process.py CHANGED
@@ -85,6 +85,11 @@ from Pose2Sim.skeletons import *
85
85
  from Pose2Sim.triangulation import indices_of_first_last_non_nan_chunks
86
86
  from Pose2Sim.filtering import *
87
87
 
88
+ # Not safe, but to be used until OpenMMLab/RTMlib's SSL certificates are updated
89
+ import ssl
90
+ ssl._create_default_https_context = ssl._create_unverified_context
91
+
92
+
88
93
 
89
94
  DEFAULT_MASS = 70
90
95
  DEFAULT_HEIGHT = 1.7
@@ -1441,20 +1446,21 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1441
1446
  sections_to_keep = config_dict.get('post-processing').get('sections_to_keep')
1442
1447
 
1443
1448
  do_filter = config_dict.get('post-processing').get('filter')
1449
+ handle_LR_swap = config_dict.get('post-processing').get('handle_LR_swap', False)
1444
1450
  reject_outliers = config_dict.get('post-processing').get('reject_outliers', False)
1445
1451
  show_plots = config_dict.get('post-processing').get('show_graphs')
1446
1452
  filter_type = config_dict.get('post-processing').get('filter_type')
1447
- butterworth_filter_order = config_dict.get('post-processing').get('butterworth').get('order')
1448
- butterworth_filter_cutoff = config_dict.get('post-processing').get('butterworth').get('cut_off_frequency')
1449
- gcv_filter_cutoff = config_dict.get('post-processing').get('gcv_spline').get('cut_off_frequency')
1450
- gcv_filter_smoothingfactor = config_dict.get('post-processing').get('gcv_spline').get('smoothing_factor')
1451
- kalman_filter_trust_ratio = config_dict.get('post-processing').get('kalman').get('trust_ratio')
1452
- kalman_filter_smooth = config_dict.get('post-processing').get('kalman').get('smooth')
1453
- gaussian_filter_kernel = config_dict.get('post-processing').get('gaussian').get('sigma_kernel')
1454
- loess_filter_kernel = config_dict.get('post-processing').get('loess').get('nb_values_used')
1455
- median_filter_kernel = config_dict.get('post-processing').get('median').get('kernel_size')
1456
- butterworthspeed_filter_order = config_dict.get('post-processing').get('butterworth_on_speed').get('order')
1457
- butterworthspeed_filter_cutoff = config_dict.get('post-processing').get('butterworth_on_speed').get('cut_off_frequency')
1453
+ butterworth_filter_order = config_dict.get('post-processing').get('butterworth', {}).get('order')
1454
+ butterworth_filter_cutoff = config_dict.get('post-processing').get('butterworth', {}).get('cut_off_frequency')
1455
+ gcv_filter_cutoff = config_dict.get('post-processing').get('gcv_spline', {}).get('gcv_cut_off_frequency')
1456
+ gcv_smoothing_factor = config_dict.get('post-processing').get('gcv_spline', {}).get('gcv_smoothing_factor')
1457
+ kalman_filter_trust_ratio = config_dict.get('post-processing').get('kalman', {}).get('trust_ratio')
1458
+ kalman_filter_smooth = config_dict.get('post-processing').get('kalman', {}).get('smooth')
1459
+ gaussian_filter_kernel = config_dict.get('post-processing').get('gaussian', {}).get('sigma_kernel')
1460
+ loess_filter_kernel = config_dict.get('post-processing').get('loess', {}).get('nb_values_used')
1461
+ median_filter_kernel = config_dict.get('post-processing').get('median', {}).get('kernel_size')
1462
+ butterworthspeed_filter_order = config_dict.get('post-processing').get('butterworth_on_speed', {}).get('order')
1463
+ butterworthspeed_filter_cutoff = config_dict.get('post-processing').get('butterworth_on_speed', {}).get('cut_off_frequency')
1458
1464
 
1459
1465
  # Create output directories
1460
1466
  if video_file == "webcam":
@@ -1491,8 +1497,6 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1491
1497
  from Pose2Sim.markerAugmentation import augment_markers_all
1492
1498
  if do_ik:
1493
1499
  from Pose2Sim.kinematics import kinematics_all
1494
- if do_filter:
1495
- from Pose2Sim.filtering import filter_all
1496
1500
  except ImportError:
1497
1501
  logging.error("OpenSim package is not installed. Please install it to use inverse kinematics or marker augmentation features (see 'Full install' section of the documentation).")
1498
1502
  raise ImportError("OpenSim package is not installed. Please install it to use inverse kinematics or marker augmentation features (see 'Full install' section of the documentation).")
@@ -1511,14 +1515,14 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1511
1515
  kinematics_dir.mkdir(parents=True, exist_ok=True)
1512
1516
 
1513
1517
  if do_filter:
1514
- print(filter_type)
1518
+ Pose2Sim_config_dict['personAssociation']['handle_LR_swap'] = handle_LR_swap
1515
1519
  Pose2Sim_config_dict['filtering']['reject_outliers'] = reject_outliers
1516
1520
  Pose2Sim_config_dict['filtering']['filter'] = do_filter
1517
1521
  Pose2Sim_config_dict['filtering']['type'] = filter_type
1518
- Pose2Sim_config_dict['filtering']['butterworth']['order'] = butterworth_filter_order
1519
- Pose2Sim_config_dict['filtering']['butterworth']['cut_off_frequency'] = butterworth_filter_cutoff
1520
1522
  Pose2Sim_config_dict['filtering']['gcv_spline']['cut_off_frequency'] = gcv_filter_cutoff
1521
- Pose2Sim_config_dict['filtering']['gcv_spline']['smoothing_factor'] = gcv_filter_smoothingfactor
1523
+ Pose2Sim_config_dict['filtering']['gcv_spline']['smoothing_factor'] = gcv_smoothing_factor
1524
+ Pose2Sim_config_dict['filtering']['butterworth']['cut_off_frequency'] = butterworth_filter_cutoff
1525
+ Pose2Sim_config_dict['filtering']['butterworth']['order'] = butterworth_filter_order
1522
1526
  Pose2Sim_config_dict['filtering']['kalman']['trust_ratio'] = kalman_filter_trust_ratio
1523
1527
  Pose2Sim_config_dict['filtering']['kalman']['smooth'] = kalman_filter_smooth
1524
1528
  Pose2Sim_config_dict['filtering']['gaussian']['sigma_kernel'] = gaussian_filter_kernel
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sports2d
3
- Version: 0.8.17
3
+ Version: 0.8.18
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>
@@ -652,7 +652,7 @@ Sports2D:
652
652
  Draws the skeleton and the keypoints, with a green to red color scale to account for their confidence\
653
653
  Draws joint and segment angles on the body, and writes the values either near the joint/segment, or on the upper-left of the image with a progress bar
654
654
 
655
- 6. **Interpolates and filters results:** Missing pose and angle sequences are interpolated unless gaps are too large. You can reject outliers with a Hampel filter): `--reject_outliers True`. Results are filtered according to the selected filter (among `Butterworth`, `Kalman`, `GCV_spline`, `Gaussian`, `LOESS`, `Median`, or `Butterworth_on_speed`) and their parameters, or not filtered at all if `--filter False`.\
655
+ 6. **Interpolates and filters results:** Missing pose and angle sequences are interpolated unless gaps are too large. Outliers are rejected with a Hampel filter. Results are filtered with a 6 Hz Butterworth filter. Many other filters are available, and all of the above can be configured or deactivated (see [Config_Demo.toml](https://github.com/davidpagnon/Sports2D/blob/main/Sports2D/Demo/Config_demo.toml))
656
656
 
657
657
  7. **Optionally show** processed images, saves them, or saves them as a video\
658
658
  **Optionally plots** pose and angle data before and after processing for comparison\
@@ -9,17 +9,17 @@ Content/paper.md,sha256=8rWSOLrKTysloZv0Fz2lr3nayxtHi7GlFMqwdgDVggY,11333
9
9
  Content/sports2d_blender.gif,sha256=wgMuPRxhja3XtQn76_okGXsNnUT9Thp0pnD36GdW5_E,448786
10
10
  Content/sports2d_opensim.gif,sha256=XP1AcjqhbGcJknXUoNJjPWAwaM9ahZafbDgLWvzKJs4,376656
11
11
  Sports2D/Sports2D.ipynb,sha256=VnOVjIl6ndnCJTT13L4W5qTw4T-TQDF3jt3-wxnXDqM,2427047
12
- Sports2D/Sports2D.py,sha256=6uL8wvkRDAQ0Y2EigP5SamOBV2cLZTtqgtfwNT4MwNg,35249
12
+ Sports2D/Sports2D.py,sha256=3Mcc_jFaD5Zv4ArB-jKYhgpMlFT0XBifTlSe70volzk,35385
13
13
  Sports2D/__init__.py,sha256=BuUkPEdItxlkeqz4dmoiPwZLkgAfABJK3KWQ1ujTGwE,153
14
- Sports2D/process.py,sha256=N4SnBGqOBDEtyAdDS0yUi_EuSVUO2yIoG8p8yzmoAA0,120372
15
- Sports2D/Demo/Config_demo.toml,sha256=PSSY722ymsBMXrrgIMcmJpf0acT4SriLKdWNQd0yZ-8,15467
14
+ Sports2D/process.py,sha256=bDKhKftfDQucuwnVnoXrtHYrMe8qrOP33B6P1wy2wLE,120632
15
+ Sports2D/Demo/Config_demo.toml,sha256=YescEgeQq3ojGqEAFWgXN142HL-YaVcRty9LbJgScoM,15577
16
16
  Sports2D/Demo/demo.mp4,sha256=2aZkFxhWR7ESMEtXCT8MGA83p2jmoU2sp1ylQfO3gDk,3968304
17
17
  Sports2D/Utilities/__init__.py,sha256=BuUkPEdItxlkeqz4dmoiPwZLkgAfABJK3KWQ1ujTGwE,153
18
18
  Sports2D/Utilities/common.py,sha256=idMRmesFv5BPX-5g3z5dOVa7SpS_8tNgijvGrOZlR-k,11185
19
19
  Sports2D/Utilities/tests.py,sha256=Ec504-4iuAvw5TDNT7upyoPRcs09EIe4Dteph3ybFJA,4702
20
- sports2d-0.8.17.dist-info/licenses/LICENSE,sha256=f4qe3nE0Y7ltJho5w-xAR0jI5PUox5Xl-MsYiY7ZRM8,1521
21
- sports2d-0.8.17.dist-info/METADATA,sha256=uNvpOHxPoDGclpbj2ap0z98qCWsL_F2t2vwnHaDnVzQ,40498
22
- sports2d-0.8.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- sports2d-0.8.17.dist-info/entry_points.txt,sha256=V8dFDIXatz9VvoGgoHzb2wE71C9-f85K6_OjnEQlxww,108
24
- sports2d-0.8.17.dist-info/top_level.txt,sha256=cWWBiDD2WbQXMoIoN6-9et9U2t2c_ZKo2JtBqO5uN-k,17
25
- sports2d-0.8.17.dist-info/RECORD,,
20
+ sports2d-0.8.18.dist-info/licenses/LICENSE,sha256=f4qe3nE0Y7ltJho5w-xAR0jI5PUox5Xl-MsYiY7ZRM8,1521
21
+ sports2d-0.8.18.dist-info/METADATA,sha256=1X_RdFwHijFHWjOpFrmXkGTAnqCzVXnlAl-ZHnosNNQ,40492
22
+ sports2d-0.8.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ sports2d-0.8.18.dist-info/entry_points.txt,sha256=V8dFDIXatz9VvoGgoHzb2wE71C9-f85K6_OjnEQlxww,108
24
+ sports2d-0.8.18.dist-info/top_level.txt,sha256=cWWBiDD2WbQXMoIoN6-9et9U2t2c_ZKo2JtBqO5uN-k,17
25
+ sports2d-0.8.18.dist-info/RECORD,,