vpk_vision

vpk_vision t1_irqumk7 wrote

Can I use a global threshold for clustering after training a Person-Reid NN with triplet Loss?

Assume that I have "N" classes in my training data, I train a Person-Reid NN using triplet Loss. In the inference stage I compute scores (using euclidean distance) as follows:

​

Class A Class A Class B Class B Class C Class C
Class A 0 0.6 0.8 0.79 0.88 0.88
Class A 0.6 0 0.71 0.71 0.87 0.87
Class B 0.8 0.71 0 0.70 0.86 0.86
Class B 0.79 0.71 0.70 0 0.85 0.85
Class C 0.88 0.87 0.86 0.85 0 0.80
Class C 0.88 0.87 0.86 0.85 0.80 0

​

The above is a hypothetical N*N score matrix that I have constructed.

Row 1 and Row2 (Column1 and Column2): Class A

Row 3 and Row 4 (Column3 and Column4): Class B

Row 5 and Row 6 (Column5 and Column6): Class C

The only constraint that I have used is that the intraclass distances should be smaller than the interclass distances (which is what triplet Loss does). However a single threshold cannot be used in this case. For example a threshold of 0.6 would work for Class A but not for Class C. Is my understanding correct or am I missing something? Thanks a lot in advance.

2