Skip to content

Commit

Permalink
Fix bug when no person detected in the video (#230)
Browse files Browse the repository at this point in the history
* fix bug when no detected person in video

* fix lint

---------

Co-authored-by: kennymckormick <[email protected]>
  • Loading branch information
Nacriema and kennymckormick authored Feb 19, 2024
1 parent b825e0b commit 06bc116
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PYSKL
# PYSKL

[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/revisiting-skeleton-based-action-recognition/skeleton-based-action-recognition-on-ntu-rgbd)](https://paperswithcode.com/sota/skeleton-based-action-recognition-on-ntu-rgbd?p=revisiting-skeleton-based-action-recognition)
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/dg-stgcn-dynamic-spatial-temporal-modeling/skeleton-based-action-recognition-on-ntu-rgbd-1)](https://paperswithcode.com/sota/skeleton-based-action-recognition-on-ntu-rgbd-1?p=dg-stgcn-dynamic-spatial-temporal-modeling)
Expand Down
10 changes: 7 additions & 3 deletions demo/demo_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def pose_tracking(pose_results, max_tracks=2, thre=30):
new_track['track_id'] = num_tracks
new_track['data'] = [(idx, poses[j])]
tracks.append(new_track)
if num_joints is None:
return None, None
tracks.sort(key=lambda x: -len(x['data']))
result = np.zeros((max_tracks, len(pose_results), num_joints, 3), dtype=np.float16)
for i, track in enumerate(tracks[:max_tracks]):
Expand Down Expand Up @@ -284,9 +286,11 @@ def main():
fake_anno['keypoint'] = keypoint
fake_anno['keypoint_score'] = keypoint_score

results = inference_recognizer(model, fake_anno)

action_label = label_map[results[0][0]]
if fake_anno['keypoint'] is None:
action_label = ''
else:
results = inference_recognizer(model, fake_anno)
action_label = label_map[results[0][0]]

pose_model = init_pose_model(args.pose_config, args.pose_checkpoint,
args.device)
Expand Down

0 comments on commit 06bc116

Please sign in to comment.