laughtervv/SGPN

What is the purpose of decreasing group id by 1 in group merging?

PatrickFeng opened this issue · 1 comments

Hi @laughtervv Thanks for your awesome work. I have confusion on group merging. The group id of some points with low confidence or small cardinality is assigned to -1. After then, you decreased the group id by 1 again in your code(line 151, test_util.py). Can you explain why?

un, cnt = np.unique(groupid, return_counts=True)
groupidnew = groupid.copy()
for ig, g in enumerate(un):
    if g == -1:
        continue
    **groupidnew[groupid==g] = (ig-1)**
    groupseg[(ig-1)] = groupseg.pop(g)
groupid = groupidnew

np.unique will sort the unique group id in a increasement manner, for example, [-1, 0, 5, 12, ...]
The code assigns consecutive group ids to the segmented instances, which begin from 0.
If all points is segmented not as background (group id is -1), there will be a minor bug since the first instance will be assigned to backgroud(-1). Do I understand it correctly?