sports2d 0.8.12__py3-none-any.whl → 0.8.13__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.
Sports2D/process.py CHANGED
@@ -1830,7 +1830,7 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1830
1830
  if fill_large_gaps_with.lower() == 'last_value':
1831
1831
  for col in all_frames_X_person_interp.columns:
1832
1832
  first_run_start, last_run_end = indices_of_first_last_non_nan_chunks(all_frames_Y_person_interp[col])
1833
- for coord_df in [all_frames_X_person_interp, all_frames_Y_person_interp]:
1833
+ for coord_df in [all_frames_X_person_interp, all_frames_Y_person_interp, all_frames_Z_homog]:
1834
1834
  coord_df.loc[:first_run_start, col] = np.nan
1835
1835
  coord_df.loc[last_run_end:, col] = np.nan
1836
1836
  coord_df.loc[first_run_start:last_run_end, col] = coord_df.loc[first_run_start:last_run_end, col].ffill().bfill()
@@ -1956,7 +1956,13 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1956
1956
  # Convert to meters
1957
1957
  px_to_m_i = [convert_px_to_meters(trc_data[i][kpt_name], first_person_height, height_px, cx, cy, -floor_angle_estim, visible_side=visible_side_i) for kpt_name in new_keypoints_names]
1958
1958
  trc_data_m_i = pd.concat([all_frames_time.rename('time')]+px_to_m_i, axis=1)
1959
- trc_data_m_i = trc_data_m_i.ffill(axis=0).bfill(axis=0)
1959
+ for c in 3*np.arange(len(trc_data_m_i.columns[3::3]))+1: # only X coordinates
1960
+ first_run_start, last_run_end = indices_of_first_last_non_nan_chunks(trc_data_m_i.iloc[:,c])
1961
+ trc_data_m_i.iloc[:first_run_start,c+2] = np.nan
1962
+ trc_data_m_i.iloc[last_run_end:,c+2] = np.nan
1963
+ trc_data_m_i.iloc[first_run_start:last_run_end,c+2] = trc_data_m_i.iloc[first_run_start:last_run_end,c+2].ffill().bfill()
1964
+ first_trim, last_trim = trc_data_m_i.isnull().any(axis=1).idxmin(), trc_data_m_i[::-1].isnull().any(axis=1).idxmin()
1965
+ trc_data_m_i = trc_data_m_i.iloc[first_trim:last_trim+1,:]
1960
1966
  px_to_m_unfiltered_i = [convert_px_to_meters(trc_data_unfiltered[i][kpt_name], first_person_height, height_px, cx, cy, -floor_angle_estim) for kpt_name in new_keypoints_names]
1961
1967
  trc_data_unfiltered_m_i = pd.concat([all_frames_time.rename('time')]+px_to_m_unfiltered_i, axis=1)
1962
1968
 
@@ -2048,7 +2054,11 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
2048
2054
  logging.info(f'- Person {i}: Interpolating missing sequences if they are smaller than {interp_gap_smaller_than} frames. Large gaps filled with {fill_large_gaps_with}.')
2049
2055
  all_frames_angles_person_interp = all_frames_angles_person.apply(interpolate_zeros_nans, axis=0, args = [interp_gap_smaller_than, 'linear'])
2050
2056
  if fill_large_gaps_with == 'last_value':
2051
- all_frames_angles_person_interp = all_frames_angles_person_interp.ffill(axis=0).bfill(axis=0)
2057
+ for col in all_frames_angles_person_interp.columns:
2058
+ first_run_start, last_run_end = indices_of_first_last_non_nan_chunks(all_frames_angles_person_interp[col])
2059
+ all_frames_angles_person_interp.loc[:first_run_start, col] = np.nan
2060
+ all_frames_angles_person_interp.loc[last_run_end:, col] = np.nan
2061
+ all_frames_angles_person_interp.loc[first_run_start:last_run_end, col] = all_frames_angles_person_interp.loc[first_run_start:last_run_end, col].ffill().bfill()
2052
2062
  elif fill_large_gaps_with == 'zeros':
2053
2063
  all_frames_angles_person_interp.replace(np.nan, 0, inplace=True)
2054
2064
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sports2d
3
- Version: 0.8.12
3
+ Version: 0.8.13
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>
@@ -11,16 +11,16 @@ Content/sports2d_opensim.gif,sha256=XP1AcjqhbGcJknXUoNJjPWAwaM9ahZafbDgLWvzKJs4,
11
11
  Sports2D/Sports2D.ipynb,sha256=VnOVjIl6ndnCJTT13L4W5qTw4T-TQDF3jt3-wxnXDqM,2427047
12
12
  Sports2D/Sports2D.py,sha256=tbQi_d6GXMqFkSd1_FRxyl6oA4CXEJH0g-lEskmR4mI,33521
13
13
  Sports2D/__init__.py,sha256=BuUkPEdItxlkeqz4dmoiPwZLkgAfABJK3KWQ1ujTGwE,153
14
- Sports2D/process.py,sha256=7qmRF8xi41A-_O5aeuvM1WTJLXCLzwWUvT5klku3qJE,112492
14
+ Sports2D/process.py,sha256=VrjshVnplbaNZY5zcNWbuR30peqN28JlYvONwtWZFPQ,113626
15
15
  Sports2D/Demo/Config_demo.toml,sha256=jiPGr6JbePu1tItgRxdAu45mwFqr3RcIi_tfhO2ik1g,14027
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/filter.py,sha256=rfZcqofjllKI_5ovZTKEAmyjOZpB_PzbAJ0P874T8Ak,4973
20
20
  Sports2D/Utilities/tests.py,sha256=3-slY2teKd78q0NzfJ2H84xRFSNXvGyDwew27oHJfrY,4740
21
- sports2d-0.8.12.dist-info/licenses/LICENSE,sha256=f4qe3nE0Y7ltJho5w-xAR0jI5PUox5Xl-MsYiY7ZRM8,1521
22
- sports2d-0.8.12.dist-info/METADATA,sha256=g-tjMxMWMTSwStQfCCrmr65XPFeXIv37OO3XG6MMWxY,38443
23
- sports2d-0.8.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- sports2d-0.8.12.dist-info/entry_points.txt,sha256=V8dFDIXatz9VvoGgoHzb2wE71C9-f85K6_OjnEQlxww,108
25
- sports2d-0.8.12.dist-info/top_level.txt,sha256=cWWBiDD2WbQXMoIoN6-9et9U2t2c_ZKo2JtBqO5uN-k,17
26
- sports2d-0.8.12.dist-info/RECORD,,
21
+ sports2d-0.8.13.dist-info/licenses/LICENSE,sha256=f4qe3nE0Y7ltJho5w-xAR0jI5PUox5Xl-MsYiY7ZRM8,1521
22
+ sports2d-0.8.13.dist-info/METADATA,sha256=Kj5MWI6mJKi3HePcPThjFXkV1zMGug966uVX0D-r9tk,38443
23
+ sports2d-0.8.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ sports2d-0.8.13.dist-info/entry_points.txt,sha256=V8dFDIXatz9VvoGgoHzb2wE71C9-f85K6_OjnEQlxww,108
25
+ sports2d-0.8.13.dist-info/top_level.txt,sha256=cWWBiDD2WbQXMoIoN6-9et9U2t2c_ZKo2JtBqO5uN-k,17
26
+ sports2d-0.8.13.dist-info/RECORD,,