FastReID is a research platform that implements state-of-the-art re-identification algorithms.
https://github.com/JDAI-CV/fast-reid
https://github.com/NirAharon/BoT-SORT
https://github.com/PINTO0309/SMILEtrack
Cosine similarity
is calculated by dividing the inner product of two vectors by the product of their norms. However, since the vectors here are already normalized, simply computing the inner product results in the cosine similarity.
import torch
import torch.nn.functional as F
# Obtain feature vectors from images
with torch.no_grad():
f1 = model(image1) # Feature vector of image1
f2 = model(image2) # Feature vector of image2
# Normalize and convert each vector to the unit norm (length is 1)
A_feat = F.normalize(f1, dim=1).cpu()
B_feat = F.normalize(f2, dim=1).cpu()
simlarity = A_feat.matmul(B_feat.transpose(1, 0)) # inner product of feature vectors
print("\033[1;31m The similarity is {}\033[".format(simlarity[0, 0]))
Comparison Patterns |
image.1 | image.2 | Comparison Patterns |
image.1 | image.2 |
---|---|---|---|---|---|
30 vs 31⬇️ | ![]() |
![]() |
1 vs 2⏫ | ![]() |
![]() |
30 vs 1⬇️ | ![]() |
![]() |
1 vs 3⏫ | ![]() |
![]() |
31 vs 2⬇️ | ![]() |
![]() |
1 vs 4⏫ | ![]() |
![]() |
python validation.py
Model | 30 vs 31 ⬇️ |
30 vs 1 ⬇️ |
31 vs 2 ⬇️ |
1 vs 2 ⏫ |
1 vs 3 ⏫ |
1 vs 4 ⏫ |
---|---|---|---|---|---|---|
mot17_sbs_S50_NMx3x256x128_post | 0.148 | 0.046 | 0.219 | 0.359 | 0.611 | 0.543 |
mot17_sbs_S50_NMx3x288x128_post | 0.154 | 0.036 | 0.223 | 0.375 | 0.643 | 0.562 |
mot17_sbs_S50_NMx3x320x128_post | 0.093 | 0.002 | 0.180 | 0.386 | 0.635 | 0.631 |
mot17_sbs_S50_NMx3x352x128_post | 0.057 | 0.000 | 0.153 | 0.366 | 0.642 | 0.649 |
mot17_sbs_S50_NMx3x384x128_post | 0.044 | 0.000 | 0.139 | 0.359 | 0.629 | 0.686 |
mot20_sbs_S50_NMx3x256x128_post | 0.406 | 0.318 | 0.309 | 0.538 | 0.727 | 0.778 |
mot20_sbs_S50_NMx3x288x128_post | 0.393 | 0.288 | 0.324 | 0.544 | 0.724 | 0.770 |
mot20_sbs_S50_NMx3x320x128_post | 0.372 | 0.253 | 0.293 | 0.543 | 0.701 | 0.775 |
mot20_sbs_S50_NMx3x352x128_post | 0.351 | 0.243 | 0.301 | 0.578 | 0.695 | 0.756 |
mot20_sbs_S50_NMx3x384x128_post | 0.325 | 0.226 | 0.289 | 0.559 | 0.698 | 0.757 |
OSNet | ||||||
osnet_x1_0_msmt17_combineall_256x128_amsgrad_NMx3x256x128 | 0.341 | 0.285 | 0.265 | 0.476 | 0.686 | 0.504 |
resnet50_msmt17_combineall_256x128_amsgrad_NMx3x256x128 | 0.418 | 0.373 | 0.329 | 0.593 | 0.810 | 0.752 |
https://github.com/PINTO0309/BoT-SORT-ONNX-TensorRT