forked from ICCC-Platform/PTGAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ensemble.py
50 lines (40 loc) · 1.74 KB
/
ensemble.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
import os
'''
@inproceedings{luo2021empirical,
title={An Empirical Study of Vehicle Re-Identification on the AI City Challenge},
author={Luo, Hao and Chen, Weihua and Xu Xianzhe and Gu Jianyang and Zhang, Yuqi and Chong Liu and Jiang Qiyi and He, Shuting and Wang, Fan and Li, Hao},
booktitle={Proc. CVPR Workshops},
year={2021}
}
'''
distmat_paths = [
'./logs/stage2/resnext101a_384/v1/dist_mat.npy',
'./logs/stage2/resnext101a_384/v2/dist_mat.npy',
'./logs/stage2/101a_384/v1/dist_mat.npy',
'./logs/stage2/101a_384/v2/dist_mat.npy',
'./logs/stage2/101a_384_recrop/v1/dist_mat.npy',
'./logs/stage2/101a_384_recrop/v2/dist_mat.npy',
'./logs/stage2/101a_384_spgan/v1/dist_mat.npy',
'./logs/stage2/101a_384_spgan/v2/dist_mat.npy',
'./logs/stage2/densenet169a_384/v1/dist_mat.npy',
'./logs/stage2/densenet169a_384/v2/dist_mat.npy',
'./logs/stage2/s101_384/v1/dist_mat.npy',
'./logs/stage2/s101_384/v2/dist_mat.npy',
'./logs/stage2/se_resnet101a_384/v1/dist_mat.npy',
'./logs/stage2/se_resnet101a_384/v2/dist_mat.npy',
'./logs/stage2/transreid_256/v1/dist_mat.npy',
'./logs/stage2/transreid_256/v2/dist_mat.npy',
]
data = np.load(distmat_paths[0])
distmat = np.zeros((data.shape[0],data.shape[1]))
for i in distmat_paths:
distmat += np.load(i)
sort_distmat_index = np.argsort(distmat, axis=1)
print('The shape of distmat is: {}'.format(distmat.shape))
save_path = './track2_veri.txt'
# with open(save_path,'w') as f:
# for item in sort_distmat_index:
# for i in range(99):
# f.write(str(item[i] + 1).zfill(6)+'.jpg' + ' ')
# f.write(str(item[i+1] + 1).zfill(6)+'.jpg' + '\n')