From 3c6ddcf7a3aaa9dc6c5de95af86ff32a2b7fa0f8 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 22 Sep 2022 15:16:49 +0000 Subject: [PATCH 1/4] fix merge conflict of assignment --- easymocap/assignment/track.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/easymocap/assignment/track.py b/easymocap/assignment/track.py index 14b605b..68672c2 100644 --- a/easymocap/assignment/track.py +++ b/easymocap/assignment/track.py @@ -90,12 +90,16 @@ class BaseTrack: # directly assign if id0 != -1 and id1 == -1: if nf1 in frames_of_id[id0].keys(): - log('Merge conflict') + log(f'Merge conflict1 nf0: {nf0} ni0: {ni0} id0: {id0} nf1: {nf1} ni1: {ni1} id1: {id1}') + continue results[nf1][ni1]['id'] = id0 # log('Merge person {}'.format(maxid)) frames_of_id[id0][nf1] = ni1 continue if id0 == -1 and id1 != -1: + if nf0 in frames_of_id[id1].keys(): + log(f'Merge conflict2 nf0: {nf0} ni0: {ni0} id0: {id0} nf1: {nf1} ni1: {ni1} id1: {id1}') + continue results[nf0][ni0]['id'] = id1 frames_of_id[id1][nf0] = ni0 continue From e07976945f23001279c9c0fa95124c0370cd6ead Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 22 Sep 2022 16:36:02 +0000 Subject: [PATCH 2/4] fix criterion crash for poor visibility --- easymocap/assignment/criterion.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/easymocap/assignment/criterion.py b/easymocap/assignment/criterion.py index 88a5fc1..bfd61f9 100644 --- a/easymocap/assignment/criterion.py +++ b/easymocap/assignment/criterion.py @@ -76,6 +76,8 @@ class CritMinMax(BaseCrit): def __call__(self, keypoints3d, **kwargs): idx = keypoints3d[..., -1] > self.min_conf k3d = keypoints3d[idx, :3] + if sum(idx) == 0: + return False mink = np.min(k3d, axis=0) maxk = np.max(k3d, axis=0) length = max(np.abs(maxk - mink)) From 251b2671dd85f5f851aba173c7afce70bbf0fdb3 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 22 Sep 2022 16:36:53 +0000 Subject: [PATCH 3/4] fix divide by zero error in associate --- easymocap/assignment/associate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easymocap/assignment/associate.py b/easymocap/assignment/associate.py index 7321e88..5a3154a 100644 --- a/easymocap/assignment/associate.py +++ b/easymocap/assignment/associate.py @@ -77,9 +77,9 @@ def simple_associate(annots, affinity, dimGroups, Pall, group, cfg): err = ((kptsRepro[:, :, 2]*keypoints2d[:, :, 2]) > 0.) * np.linalg.norm(kptsRepro[:, :, :2] - keypoints2d[:, :, :2], axis=2) size = (bboxes[:, [2, 3]] - bboxes[:, [0, 1]]).max(axis=1, keepdims=True) err = err / size - err_view = err.sum(axis=1)/((err>0.).sum(axis=1)) + err_view = err.sum(axis=1)/((err>0. + 1e-9).sum(axis=1)) flag = (err_view < cfg.max_repro_error).all() - err = err.sum()/(err>0).sum() + err = err.sum()/(err>0 + 1e-9).sum() # err_view = err.sum(axis=1)/((err>0.).sum(axis=1)) # err = err.sum()/(err>0.).sum() # flag = err_view.max() < err_view.mean() * 2 From 6475cbec41d7901f8971d240e9e0682433466697 Mon Sep 17 00:00:00 2001 From: linyu0219 <29172715+linyu0219@users.noreply.github.com> Date: Fri, 10 Jun 2022 16:58:05 +0800 Subject: [PATCH 4/4] fix repro_smpl projectN3 error when vis repro_smpl, the kpts3d shape is [x,x,3], it has no visibility,it has xyz only, use z maybe lost some point in repro_smpl. --- easymocap/mytools/reconstruction.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/easymocap/mytools/reconstruction.py b/easymocap/mytools/reconstruction.py index 460b9fb..a040376 100644 --- a/easymocap/mytools/reconstruction.py +++ b/easymocap/mytools/reconstruction.py @@ -24,7 +24,8 @@ def projectN3(kpts3d, Pall): kp2d[:2, :] /= kp2d[2:, :] kp2ds.append(kp2d.T[None, :, :]) kp2ds = np.vstack(kp2ds) - kp2ds[..., -1] = kp2ds[..., -1] * (kpts3d[None, :, -1] > 0.) + if kpts3d.shape[-1] == 4: + kp2ds[..., -1] = kp2ds[..., -1] * (kpts3d[None, :, -1] > 0.) return kp2ds def simple_reprojection_error(kpts1, kpts1_proj): @@ -113,4 +114,4 @@ def check_limb(keypoints3d, limb_means, thres=0.5): break # 至少两段骨头可以使用 valid = valid and cnt > 2 - return valid \ No newline at end of file + return valid