Skip to content

Commit

Permalink
fix bug when no detected person in video
Browse files Browse the repository at this point in the history
  • Loading branch information
Nacriema committed Feb 11, 2024
1 parent b825e0b commit 0ae9419
Showing 1 changed file with 7 additions and 3 deletions.
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 0ae9419

Please sign in to comment.