ROMP
ROMP copied to clipboard
wrong detect occluded person
In image_base.py, when you calculate occluded person, I think there is wrong condition.
full_kp2ds is normalized to [-1 ~ +1] before passed to detect_occluded_person() as belows:
def process_kp2ds_bboxes(self, full_kps, img_shape=None, is_pose2d=None):
...
if is_pose2d.sum()>0:
# NOTE normalized here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
full_kp2d = [self.process_kps(full_kps[ind], img_shape,set_minus=True) for ind in np.where(is_pose2d)[0]]
# NOTE parse_multiperson_kp2ds calls detect_occluded_person !!
..... = self.parse_multiperson_kp2ds(full_kp2d)
def parse_multiperson_kp2ds(self, full_kps):
...
person_centers, full_kp2ds = np.array(person_centers), np.array(full_kp2ds)
occluded_by_who = detect_occluded_person(person_centers,full_kp2ds) if args().collision_aware_centermap else None
return person_centers, full_kp2ds, used_person_inds, bboxes_hw_norm, occluded_by_who, heatmap, AE_joints
Therefore, I think visible condition to be greater than '-1', not '0' as belows:
def detect_occluded_person(person_centers, full_kp2ds, thresh=2*64/512.):
'''
Parameters
----------
person_centers : (num_people, 2)
x, y
normalized to [-1 ~ +1]
full_kp2ds : (num_people, num_joints, 2)
normalized to [-1 ~ +1]
'''
person_num = len(person_centers)
# index of the person at the front of an occlusion
occluded_by_who = np.ones(person_num) * -1
if person_num > 1:
for inds, (person_center, kp2d) in enumerate(zip(person_centers, full_kp2ds)):
# dist : (num_people, ); person_centers (num_people, 2) - person_center (2, )
dist = np.sqrt(((person_centers - person_center)**2).sum(-1))
if (dist > 0).sum() > 0:
if (dist[dist > 0] < thresh).sum() > 0:
# Comparing the visible keypoint number to justify whether the person is occluded by the others
#if (full_kp2ds[inds, :, 0] > 0).sum() >= (kp2d[:, 0] > 0).sum():
# NOTE here !! condition to be 'coords > -1'
if (full_kp2ds[inds, :, 0] > -1).sum() >= (kp2d[:, 0] > -1).sum():
closet_idx = np.where(dist==np.min(dist[dist > 0]))[0][0]
if occluded_by_who[closet_idx] < 0:
occluded_by_who[inds] = closet_idx
return occluded_by_who.astype(np.int)