sports2d 0.8.14__tar.gz → 0.8.15__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.14 → sports2d-0.8.15}/PKG-INFO +1 -1
  2. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/process.py +22 -4
  3. {sports2d-0.8.14 → sports2d-0.8.15}/sports2d.egg-info/PKG-INFO +1 -1
  4. {sports2d-0.8.14 → sports2d-0.8.15}/.github/workflows/continuous-integration.yml +0 -0
  5. {sports2d-0.8.14 → sports2d-0.8.15}/.github/workflows/joss_pdf.yml +0 -0
  6. {sports2d-0.8.14 → sports2d-0.8.15}/.github/workflows/publish-on-release.yml +0 -0
  7. {sports2d-0.8.14 → sports2d-0.8.15}/.gitignore +0 -0
  8. {sports2d-0.8.14 → sports2d-0.8.15}/CITATION.cff +0 -0
  9. {sports2d-0.8.14 → sports2d-0.8.15}/Content/Demo_plots.png +0 -0
  10. {sports2d-0.8.14 → sports2d-0.8.15}/Content/Demo_results.png +0 -0
  11. {sports2d-0.8.14 → sports2d-0.8.15}/Content/Demo_terminal.png +0 -0
  12. {sports2d-0.8.14 → sports2d-0.8.15}/Content/Person_selection.png +0 -0
  13. {sports2d-0.8.14 → sports2d-0.8.15}/Content/Video_tuto_Sports2D_Colab.png +0 -0
  14. {sports2d-0.8.14 → sports2d-0.8.15}/Content/joint_convention.png +0 -0
  15. {sports2d-0.8.14 → sports2d-0.8.15}/Content/paper.bib +0 -0
  16. {sports2d-0.8.14 → sports2d-0.8.15}/Content/paper.md +0 -0
  17. {sports2d-0.8.14 → sports2d-0.8.15}/Content/sports2d_blender.gif +0 -0
  18. {sports2d-0.8.14 → sports2d-0.8.15}/Content/sports2d_opensim.gif +0 -0
  19. {sports2d-0.8.14 → sports2d-0.8.15}/LICENSE +0 -0
  20. {sports2d-0.8.14 → sports2d-0.8.15}/README.md +0 -0
  21. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Demo/Config_demo.toml +0 -0
  22. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Demo/demo.mp4 +0 -0
  23. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Sports2D.ipynb +0 -0
  24. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Sports2D.py +0 -0
  25. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Utilities/__init__.py +0 -0
  26. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Utilities/common.py +0 -0
  27. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Utilities/filter.py +0 -0
  28. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/Utilities/tests.py +0 -0
  29. {sports2d-0.8.14 → sports2d-0.8.15}/Sports2D/__init__.py +0 -0
  30. {sports2d-0.8.14 → sports2d-0.8.15}/pyproject.toml +0 -0
  31. {sports2d-0.8.14 → sports2d-0.8.15}/setup.cfg +0 -0
  32. {sports2d-0.8.14 → sports2d-0.8.15}/sports2d.egg-info/SOURCES.txt +0 -0
  33. {sports2d-0.8.14 → sports2d-0.8.15}/sports2d.egg-info/dependency_links.txt +0 -0
  34. {sports2d-0.8.14 → sports2d-0.8.15}/sports2d.egg-info/entry_points.txt +0 -0
  35. {sports2d-0.8.14 → sports2d-0.8.15}/sports2d.egg-info/requires.txt +0 -0
  36. {sports2d-0.8.14 → sports2d-0.8.15}/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.14
3
+ Version: 0.8.15
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>
@@ -1653,7 +1653,7 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1653
1653
 
1654
1654
  # Process coordinates and compute angles
1655
1655
  valid_X, valid_Y, valid_scores = [], [], []
1656
- valid_X_flipped, valid_angles = [], []
1656
+ valid_X_flipped, valid_angles_flipped, valid_angles = [], [], []
1657
1657
  for person_idx in range(len(keypoints)):
1658
1658
  if load_trc_px:
1659
1659
  person_X = keypoints[person_idx][:,0]
@@ -1699,7 +1699,17 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1699
1699
  else:
1700
1700
  ang = np.nan
1701
1701
  person_angles.append(ang)
1702
+
1703
+ # flip angles on the left side if flip_left_right false
1704
+ if len(visible_side) <= person_idx:
1705
+ visible_side += ['auto'] # set to 'auto' if list too short
1706
+ if visible_side[person_idx] == 'left' and not flip_left_right:
1707
+ person_angles_flipped = list(-np.array(person_angles))
1708
+ else:
1709
+ person_angles_flipped = person_angles.copy()
1710
+
1702
1711
  valid_angles.append(person_angles)
1712
+ valid_angles_flipped.append(person_angles_flipped)
1703
1713
  valid_X_flipped.append(person_X_flipped)
1704
1714
  valid_X.append(person_X)
1705
1715
  valid_Y.append(person_Y)
@@ -1714,7 +1724,8 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1714
1724
  img = draw_keypts(img, valid_X, valid_Y, valid_scores, cmap_str='RdYlGn')
1715
1725
  img = draw_skel(img, valid_X, valid_Y, pose_model)
1716
1726
  if calculate_angles:
1717
- img = draw_angles(img, valid_X, valid_Y, valid_angles, valid_X_flipped, new_keypoints_ids, new_keypoints_names, angle_names, display_angle_values_on=display_angle_values_on, colors=colors, fontSize=fontSize, thickness=thickness)
1727
+
1728
+ img = draw_angles(img, valid_X, valid_Y, valid_angles_flipped, valid_X_flipped, new_keypoints_ids, new_keypoints_names, angle_names, display_angle_values_on=display_angle_values_on, colors=colors, fontSize=fontSize, thickness=thickness)
1718
1729
  cv2.imshow(f'{video_file} Sports2D', img)
1719
1730
  if (cv2.waitKey(1) & 0xFF) == ord('q') or (cv2.waitKey(1) & 0xFF) == 27:
1720
1731
  break
@@ -1936,6 +1947,7 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1936
1947
  f'xy_origin: {xy_origin if not xy_origin=="auto" else f"auto (estimation: {[round(c) for c in xy_origin_estim]})"} px.')
1937
1948
 
1938
1949
  # Coordinates in m
1950
+ new_visible_side = []
1939
1951
  for i in range(len(trc_data)):
1940
1952
  if not np.array(trc_data[i].iloc[:,1:] ==0).all():
1941
1953
  # Automatically determine visible side
@@ -1984,7 +1996,9 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
1984
1996
  if make_c3d:
1985
1997
  c3d_path = convert_to_c3d(str(pose_path_person_m_i))
1986
1998
  logging.info(f'Pose in meters saved to {pose_path_person_m_i.resolve()}. {"Also saved in c3d format." if make_c3d else ""}')
1987
-
1999
+ else:
2000
+ visible_side_i = 'none'
2001
+ new_visible_side += [visible_side_i]
1988
2002
 
1989
2003
 
1990
2004
 
@@ -2050,6 +2064,10 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
2050
2064
  angles_path_person = angles_output_path.parent / (angles_output_path.stem + f'_person{i:02d}.mot')
2051
2065
  all_frames_angles_person = pd.DataFrame(all_frames_angles_homog[:,idx_person,:], columns=angle_names)
2052
2066
 
2067
+ # Flip angles for left side when flip_left_right false
2068
+ if new_visible_side[i] == 'left' and not flip_left_right:
2069
+ all_frames_angles_homog[:, idx_person, :] = -all_frames_angles_homog[:, idx_person, :]
2070
+
2053
2071
  # Delete person if less than 4 valid frames
2054
2072
  angle_nan_count = len(np.where(all_frames_angles_person.sum(axis=1)==0)[0])
2055
2073
  if frame_count - frame_range[0] - angle_nan_count <= 4:
@@ -2215,7 +2233,7 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
2215
2233
  # masses.append(DEFAULT_MASS)
2216
2234
  logging.info(f'Less than 4 valid frames. Deleting person.')
2217
2235
  else:
2218
- if visible_side[i] == 'none':
2236
+ if new_visible_side[i] == 'none':
2219
2237
  logging.info(f'Skipping marker augmentation and inverse kinematics because visible_side is "none".')
2220
2238
  # heights_m.append(DEFAULT_HEIGHT)
2221
2239
  # masses.append(DEFAULT_MASS)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sports2d
3
- Version: 0.8.14
3
+ Version: 0.8.15
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>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes