fix: 🐞 add check if keypoints size is 0 return empty keypoint result

Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
This commit is contained in:
Onuralp SEZER 2024-07-11 04:41:05 +03:00
parent 185ae462a4
commit 13fe6e0942
No known key found for this signature in database
GPG Key ID: CF0835DFDF14CA38
1 changed files with 2 additions and 0 deletions

View File

@ -448,6 +448,8 @@ class KeyPoints:
"""
if hasattr(detectron2_results["instances"], "pred_keypoints"):
if detectron2_results["instances"].pred_keypoints.cpu().numpy().size == 0:
return cls.empty()
return cls(
xy=detectron2_results["instances"]
.pred_keypoints.cpu()