Merge pull request #203 from peabody124/tracking_fix

fix merge conflict of assignment
This commit is contained in:
Qing Shuai 2022-11-12 21:31:35 +08:00 committed by GitHub
commit 1a7e067981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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):