Skip to content

Commit

Permalink
fix numpy obsolete comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpagnon committed Jan 26, 2024
1 parent 99a93de commit 9c7ade2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sports2D/Demo/Config_demo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pose_algo = 'BLAZEPOSE' # 'OPENPOSE' or 'BLAZEPOSE'
# Install OpenPose from https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/0_index.md
# BODY_25 is standard, BODY_25B is more accurate but requires downloading the model from
# https://github.com/CMU-Perceptual-Computing-Lab/openpose_train/blob/master/experimental_models/README.md
openpose_model = 'BODY_25B'
openpose_model = 'BODY_25'

# Installation path of openpose (between single quotes)
openpose_path = 'D:\softs\openpose-1.6.0-binaries-win64-gpu-flir-3d_recommended\openpose'
Expand Down
9 changes: 7 additions & 2 deletions Sports2D/detect_pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def json_to_csv(json_path, frame_rate, pose_model, interp_gap_smaller_than, filt
keypoints_names = [node.name for _, _, node in RenderTree(model) if node.id!=None]
keypoints_names_rearranged = [y for x,y in sorted(zip(keypoints_ids,keypoints_names))]
keypoints_nb = len(keypoints_ids)
print(keypoints_nb)

# Retrieve coordinates
logging.info('Sorting people across frames.')
Expand All @@ -301,8 +302,12 @@ def json_to_csv(json_path, frame_rate, pose_model, interp_gap_smaller_than, filt
keypt = np.array(keypt)
# Make sure keypt is as large as the number of persons that need to be detected
if len(keypt) < nb_persons_to_detect:
empty_keypt_to_add = np.concatenate( [[ np.zeros([25,3]) ]] * (nb_persons_to_detect-len(keypt)) )
keypt = [np.concatenate([keypt, empty_keypt_to_add]) if keypt!=[] else empty_keypt_to_add][0]
# print('\n')
# print(nb_persons_to_detect)
# print(len(keypt))
# print(repr(keypt))
empty_keypt_to_add = np.concatenate( [[ np.zeros([keypoints_nb,3]) ]] * (nb_persons_to_detect-len(keypt)) )
keypt = [np.concatenate([keypt, empty_keypt_to_add]) if list(keypt)!=[] else empty_keypt_to_add][0]
if 'keyptpre' not in locals():
keyptpre = keypt
# Associate persons across frames
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = sports2d
version = 0.2.5
version = 0.2.6
author = David Pagnon
author_email = [email protected]
description = Detect pose and compute 2D joint angles from a video.
Expand Down

0 comments on commit 9c7ade2

Please sign in to comment.