fix criterion crash for poor visibility

This commit is contained in:
James Cotton 2022-09-22 16:36:02 +00:00
parent 3c6ddcf7a3
commit e07976945f

View File

@ -76,6 +76,8 @@ class CritMinMax(BaseCrit):
def __call__(self, keypoints3d, **kwargs): def __call__(self, keypoints3d, **kwargs):
idx = keypoints3d[..., -1] > self.min_conf idx = keypoints3d[..., -1] > self.min_conf
k3d = keypoints3d[idx, :3] k3d = keypoints3d[idx, :3]
if sum(idx) == 0:
return False
mink = np.min(k3d, axis=0) mink = np.min(k3d, axis=0)
maxk = np.max(k3d, axis=0) maxk = np.max(k3d, axis=0)
length = max(np.abs(maxk - mink)) length = max(np.abs(maxk - mink))