Skip to content

Commit 06bc116

Browse files
Fix bug when no person detected in the video (#230)
* fix bug when no detected person in video * fix lint --------- Co-authored-by: kennymckormick <[email protected]>
1 parent b825e0b commit 06bc116

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PYSKL
1+
# PYSKL
22

33
[![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)
44
[![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)

demo/demo_skeleton.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def pose_tracking(pose_results, max_tracks=2, thre=30):
213213
new_track['track_id'] = num_tracks
214214
new_track['data'] = [(idx, poses[j])]
215215
tracks.append(new_track)
216+
if num_joints is None:
217+
return None, None
216218
tracks.sort(key=lambda x: -len(x['data']))
217219
result = np.zeros((max_tracks, len(pose_results), num_joints, 3), dtype=np.float16)
218220
for i, track in enumerate(tracks[:max_tracks]):
@@ -284,9 +286,11 @@ def main():
284286
fake_anno['keypoint'] = keypoint
285287
fake_anno['keypoint_score'] = keypoint_score
286288

287-
results = inference_recognizer(model, fake_anno)
288-
289-
action_label = label_map[results[0][0]]
289+
if fake_anno['keypoint'] is None:
290+
action_label = ''
291+
else:
292+
results = inference_recognizer(model, fake_anno)
293+
action_label = label_map[results[0][0]]
290294

291295
pose_model = init_pose_model(args.pose_config, args.pose_checkpoint,
292296
args.device)

0 commit comments

Comments
 (0)