Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix transforms for empty boxes and keypoints inputs (#1741)

hal-314ea9a8d407070
diff --git a/kornia/augmentation/container/utils.py b/kornia/augmentation/container/utils.py
index 1e8beb9dd..7d4c1214c 100644
--- a/kornia/augmentation/container/utils.py
+++ b/kornia/augmentation/container/utils.py
@@ -99,7 +99,7 @@ class ApplyInverseImpl(ApplyInverseInterface):
to_apply = torch.ones(input.shape[0], device=input.device, dtype=input.dtype).bool()
# If any inputs need to be transformed.
- if mat is not None and to_apply is not None and to_apply.sum() != 0:
+ if mat is not None and to_apply is not None and to_apply.sum() != 0 and input.numel() > 0:
input[to_apply] = cls.apply_func(mat, input[to_apply])
return input, label