Research Article
Trajectory Clustering in an Intersection by GDTW
| ADPC_allocate_sample | | Input: D: normalized asymmetric generalized DTW | | centeridxs: candidate cluster center index list | | thre_c2m: threshold from center to member | | thre_m2c: threshold from member to center | | Return: centeridx_to_memberidxs. outlieridxs: | | outlier index list. | (1) | cm_mat = D[centeridxs,:] | (2) | mc_mat = D[:, centeridxs] | (3) | outlieridxs = [] | (4) | centeridx_to_memberidxs = dict((i, []) for i in centeridxs) | (5) | for i = 0…len(D)-1: | (6) | if i in centeridx_to_memberidxs: | (7) | centeridx_to_memberidxs[i].append(i) | (8) | continue | (9) | br_c2m = cm_mat[:, i] < thre_c2m | (10) | br_m2c = mc_mat[i] < thre_m2c | (11) | ii = true_idxs(br_c2m & br_m2c) | (12) | if len(ii) = = 0: | (13) | outlieridxs.append(i) | (14) | continue | (15) | cj = argmin(cm_mat[j, i] + mc_mat[i, j] for j in ii) | (16) | ci = centeridxs[ ii[cj] ] | (17) | centeridx_to_memberidxs[ci].append(i) | (18) | return centeridx_to_memberidxs, outlieridxs |
|