-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.py
508 lines (394 loc) · 22 KB
/
test.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
from __future__ import print_function
import argparse
import time
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
import torch.utils.data as data
import torchvision.transforms as transforms
from data_loader import SYSUData, RegDBData, TestData
from data_manager import *
from eval_metrics import eval_sysu, eval_regdb
from model import embed_net
from utils import *
import pdb
import scipy.io
parser = argparse.ArgumentParser(description='PyTorch Cross-Modality Training')
parser.add_argument('--dataset', default='sysu', help='dataset name: regdb or sysu]')
parser.add_argument('--lr', default=0.1 , type=float, help='learning rate, 0.00035 for adam')
parser.add_argument('--optim', default='sgd', type=str, help='optimizer')
parser.add_argument('--arch', default='resnet50', type=str, help='network baseline: resnet50')
parser.add_argument('--resume', '-r', default='sysu_agw_p4_n4_lr_0.1_seed_0_best.t', type=str, help='resume from checkpoint')
parser.add_argument('--test-only', action='store_true', help='test only')
parser.add_argument('--model_path', default='save_model/', type=str, help='model save path')
parser.add_argument('--save_epoch', default=20, type=int, metavar='s', help='save model every 10 epochs')
parser.add_argument('--log_path', default='log/', type=str, help='log save path')
parser.add_argument('--vis_log_path', default='log/vis_log/', type=str, help='log save path')
parser.add_argument('--workers', default=4, type=int, metavar='N', help='number of data loading workers (default: 4)')
parser.add_argument('--img_w', default=192, type=int, metavar='imgw', help='img width')
parser.add_argument('--img_h', default=384, type=int, metavar='imgh', help='img height')
parser.add_argument('--batch-size', default=8, type=int, metavar='B', help='training batch size')
parser.add_argument('--test-batch', default=64, type=int, metavar='tb', help='testing batch size')
parser.add_argument('--method', default='awg', type=str, metavar='m', help='method type: base or awg')
parser.add_argument('--margin', default=0.3, type=float, metavar='margin', help='triplet loss margin')
parser.add_argument('--num_pos', default=5, type=int, help='num of pos per identity in each modality')
parser.add_argument('--trial', default=1, type=int, metavar='t', help='trial (only for RegDB dataset)')
parser.add_argument('--seed', default=0, type=int, metavar='t', help='random seed')
parser.add_argument('--gpu', default='4', type=str, help='gpu device ids for CUDA_VISIBLE_DEVICES')
parser.add_argument('--mode', default='all', type=str, help='all or indoor for sysu')
parser.add_argument('--tvsearch', action='store_true', default = True, help='whether thermal to visible search on RegDB')
args = parser.parse_args()
os.environ['CUDA_VISIBLE_DEVICES'] = args.gpu
dataset = args.dataset
if dataset == 'sysu':
data_path = './Datasets/SYSU-MM01/'
n_class = 395
test_mode = [1, 2]
elif dataset =='regdb':
data_path = './Datasets/RegDB/'
n_class = 206
test_mode = [2, 1]
device = 'cuda' if torch.cuda.is_available() else 'cpu'
best_acc = 0 # best test accuracy
start_epoch = 0
pool_dim = 2048 * 4
print('==> Building model..')
if args.method =='base':
net = embed_net(n_class, no_local= 'off', gm_pool = 'off', arch=args.arch)
else:
net = embed_net(n_class, no_local= 'on', gm_pool = 'on', arch=args.arch)
net.to(device)
cudnn.benchmark = True
checkpoint_path = args.model_path
if args.method =='id':
criterion = nn.CrossEntropyLoss()
criterion.to(device)
print('==> Loading data..')
# Data loading code
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],std=[0.229, 0.224, 0.225])
transform_train = transforms.Compose([
transforms.ToPILImage(),
transforms.RandomCrop((args.img_h,args.img_w)),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize,
])
transform_test = transforms.Compose([
transforms.ToPILImage(),
transforms.Resize((args.img_h,args.img_w)),
transforms.ToTensor(),
normalize,
])
end = time.time()
def extract_gall_feat(gall_loader):
net.eval()
print ('Extracting Gallery Feature...')
start = time.time()
ptr = 0
gall_feat_pool = np.zeros((ngall, pool_dim))
gall_feat_fc = np.zeros((ngall, pool_dim))
Xgall_feat_pool = np.zeros((ngall, pool_dim))
Xgall_feat_fc = np.zeros((ngall, pool_dim))
with torch.no_grad():
for batch_idx, (input, label ) in enumerate(gall_loader):
batch_num = input.size(0)
input = Variable(input.cuda())
feat_pool, feat_fc = net(input, input, test_mode[0])
gall_feat_pool[ptr:ptr+batch_num,: ] = feat_pool[:batch_num].detach().cpu().numpy()
gall_feat_fc[ptr:ptr+batch_num,: ] = feat_fc[:batch_num].detach().cpu().numpy()
Xgall_feat_pool[ptr:ptr+batch_num,: ] = feat_pool[batch_num:].detach().cpu().numpy()
Xgall_feat_fc[ptr:ptr+batch_num,: ] = feat_fc[batch_num:].detach().cpu().numpy()
ptr = ptr + batch_num
print('Extracting Time:\t {:.3f}'.format(time.time()-start))
return gall_feat_pool, gall_feat_fc, Xgall_feat_pool, Xgall_feat_fc
def extract_query_feat(query_loader):
net.eval()
print ('Extracting Query Feature...')
start = time.time()
ptr = 0
query_feat_pool = np.zeros((nquery, pool_dim))
query_feat_fc = np.zeros((nquery, pool_dim))
Xquery_feat_pool = np.zeros((nquery, pool_dim))
Xquery_feat_fc = np.zeros((nquery, pool_dim))
with torch.no_grad():
for batch_idx, (input, label ) in enumerate(query_loader):
batch_num = input.size(0)
input = Variable(input.cuda())
feat_pool, feat_fc = net(input, input, test_mode[1])
query_feat_pool[ptr:ptr+batch_num,: ] = feat_pool[:batch_num].detach().cpu().numpy()
query_feat_fc[ptr:ptr+batch_num,: ] = feat_fc[:batch_num].detach().cpu().numpy()
Xquery_feat_pool[ptr:ptr+batch_num,: ] = feat_pool[batch_num:].detach().cpu().numpy()
Xquery_feat_fc[ptr:ptr+batch_num,: ] = feat_fc[batch_num:].detach().cpu().numpy()
ptr = ptr + batch_num
print('Extracting Time:\t {:.3f}'.format(time.time()-start))
return query_feat_pool, query_feat_fc, Xquery_feat_pool, Xquery_feat_fc
if dataset == 'sysu':
print('==> Resuming from checkpoint..')
if len(args.resume) > 0:
model_path = checkpoint_path + args.resume
# model_path = checkpoint_path + 'sysu_awg_p4_n8_lr_0.1_seed_0_best.t'
if os.path.isfile(model_path):
print('==> loading checkpoint {}'.format(args.resume))
checkpoint = torch.load(model_path)
net.load_state_dict(checkpoint['net'])
print('==> loaded checkpoint {} (epoch {})'
.format(args.resume, checkpoint['epoch']))
else:
print('==> no checkpoint found at {}'.format(args.resume))
# testing set
query_img, query_label, query_cam = process_query_sysu(data_path, mode=args.mode)
gall_img, gall_label, gall_cam = process_gallery_sysu(data_path, mode=args.mode, trial=0)
nquery = len(query_label)
ngall = len(gall_label)
print("Dataset statistics:")
print(" ------------------------------")
print(" subset | # ids | # images")
print(" ------------------------------")
print(" query | {:5d} | {:8d}".format(len(np.unique(query_label)), nquery))
print(" gallery | {:5d} | {:8d}".format(len(np.unique(gall_label)), ngall))
print(" ------------------------------")
queryset = TestData(query_img, query_label, transform=transform_test, img_size=(args.img_w, args.img_h))
query_loader = data.DataLoader(queryset, batch_size=args.test_batch, shuffle=False, num_workers=4)
print('Data Loading Time:\t {:.3f}'.format(time.time() - end))
query_feat_pool, query_feat_fc, Xquery_feat_pool, Xquery_feat_fc = extract_query_feat(query_loader)
for trial in range(10):
gall_img, gall_label, gall_cam = process_gallery_sysu(data_path, mode=args.mode, trial=trial)
trial_gallset = TestData(gall_img, gall_label, transform=transform_test, img_size=(args.img_w, args.img_h))
trial_gall_loader = data.DataLoader(trial_gallset, batch_size=args.test_batch, shuffle=False, num_workers=4)
gall_feat_pool, gall_feat_fc, Xgall_feat_pool, Xgall_feat_fc = extract_gall_feat(trial_gall_loader)
# fc feature
distmat = np.matmul(query_feat_fc, np.transpose(gall_feat_fc))
cmc, mAP, mINP = eval_sysu(-distmat, query_label, gall_label, query_cam, gall_cam)
distmat1 = np.matmul(query_feat_fc, np.transpose(Xgall_feat_fc))
cmc1, mAP1, mINP1 = eval_sysu(-distmat1, query_label, gall_label, query_cam, gall_cam)
distmat2 = np.matmul(Xquery_feat_fc, np.transpose(gall_feat_fc))
cmc2, mAP2, mINP2 = eval_sysu(-distmat2, query_label, gall_label, query_cam, gall_cam)
distmat3 = np.matmul(Xquery_feat_fc, np.transpose(Xgall_feat_fc))
cmc3, mAP3, mINP3 = eval_sysu(-distmat3, query_label, gall_label, query_cam, gall_cam)
result = {'gallery_f':gall_feat_fc,'gallery_label':gall_label,'gallery_cam':gall_cam,'query_f':query_feat_fc,'query_label':query_label,'query_cam':query_cam}
scipy.io.savemat('pytorch_result.mat',result)
distmat4 = distmat + distmat1 + distmat2 + distmat3
cmc4, mAP4, mINP4 = eval_sysu(-distmat4, query_label, gall_label, query_cam, gall_cam)
distmat5 = np.minimum(np.minimum(distmat, distmat1), np.minimum(distmat2, distmat3))
cmc5, mAP5, mINP5 = eval_sysu(-distmat5, query_label, gall_label, query_cam, gall_cam)
distmat6 = np.maximum(np.maximum(distmat, distmat1), np.maximum(distmat2, distmat3))
cmc6, mAP6, mINP6 = eval_sysu(-distmat6, query_label, gall_label, query_cam, gall_cam)
if trial == 0:
all_cmc = cmc
all_mAP = mAP
all_mINP = mINP
all_cmc1 = cmc1
all_mAP1 = mAP1
all_mINP1 = mINP1
all_cmc2 = cmc2
all_mAP2 = mAP2
all_mINP2 = mINP2
all_cmc3 = cmc3
all_mAP3 = mAP3
all_mINP3 = mINP3
all_cmc4 = cmc4
all_mAP4 = mAP4
all_mINP4 = mINP4
all_cmc5 = cmc5
all_mAP5 = mAP5
all_mINP5 = mINP5
all_cmc6 = cmc6
all_mAP6 = mAP6
all_mINP6 = mINP6
else:
all_cmc = all_cmc + cmc
all_mAP = all_mAP + mAP
all_mINP = all_mINP + mINP
all_cmc1 = all_cmc1 + cmc1
all_mAP1 = all_mAP1 + mAP1
all_mINP1 = all_mINP1 + mINP1
all_cmc2 = all_cmc2 + cmc2
all_mAP2 = all_mAP2 + mAP2
all_mINP2 = all_mINP2 + mINP2
all_cmc3 = all_cmc3 + cmc3
all_mAP3 = all_mAP3 + mAP3
all_mINP3 = all_mINP3 + mINP3
all_cmc4 = all_cmc4 + cmc4
all_mAP4 = all_mAP4 + mAP4
all_mINP4 = all_mINP4 + mINP4
all_cmc5 = all_cmc5 + cmc5
all_mAP5 = all_mAP5 + mAP5
all_mINP5 = all_mINP5 + mINP5
all_cmc6 = all_cmc6 + cmc6
all_mAP6 = all_mAP6 + mAP6
all_mINP6 = all_mINP6 + mINP6
print('Test Trial: {}'.format(trial))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc[0], cmc[4], cmc[9], cmc[19], mAP, mINP))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc1[0], cmc1[4], cmc1[9], cmc1[19], mAP1, mINP1))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc2[0], cmc2[4], cmc2[9], cmc2[19], mAP2, mINP2))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc3[0], cmc3[4], cmc3[9], cmc3[19], mAP3, mINP3))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc4[0], cmc4[4], cmc4[9], cmc4[19], mAP4, mINP4))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc5[0], cmc5[4], cmc5[9], cmc5[19], mAP5, mINP5))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc6[0], cmc6[6], cmc6[9], cmc6[19], mAP6, mINP6))
elif dataset == 'regdb':
for trial in range(10):
test_trial = trial +1
#model_path = checkpoint_path + args.resume regdb_agw_p4_n4_lr_0.1_seed_0_trial_9_best.t
model_path = '/media/data3/zyk_data/GPAA3/save_model/regdb_agw_p4_n4_lr_0.1_seed_0_trial_{}_best.t'.format(test_trial)
print(model_path)
print(os.path.isfile(model_path))
if os.path.isfile(model_path):
print('==> loading checkpoint {}'.format(args.resume))
checkpoint = torch.load(model_path)
net.load_state_dict(checkpoint['net'])
else:
print('==> no checkpoint found at {}'.format(model_path))
# training set
trainset = RegDBData(data_path, test_trial, transform=transform_train)
# generate the idx of each person identity
color_pos, thermal_pos = GenIdx(trainset.train_color_label, trainset.train_thermal_label)
# testing set
query_img, query_label = process_test_regdb(data_path, trial=test_trial, modal='visible')
gall_img, gall_label = process_test_regdb(data_path, trial=test_trial, modal='thermal')
gallset = TestData(gall_img, gall_label, transform=transform_test, img_size=(args.img_w, args.img_h))
gall_loader = data.DataLoader(gallset, batch_size=args.test_batch, shuffle=False, num_workers=args.workers)
nquery = len(query_label)
ngall = len(gall_label)
queryset = TestData(query_img, query_label, transform=transform_test, img_size=(args.img_w, args.img_h))
query_loader = data.DataLoader(queryset, batch_size=args.test_batch, shuffle=False, num_workers=4)
print('Data Loading Time:\t {:.3f}'.format(time.time() - end))
query_feat_pool, query_feat_fc, Xquery_feat_pool, Xquery_feat_fc = extract_query_feat(query_loader)
gall_feat_pool, gall_feat_fc, Xgall_feat_pool, Xgall_feat_fc = extract_gall_feat(gall_loader)
if args.tvsearch:
# pool5 feature eval_regdb
distmat = np.matmul(gall_feat_fc, np.transpose(query_feat_fc))
cmc, mAP, mINP = eval_regdb(-distmat, gall_label, query_label)
distmat1 = np.matmul(Xgall_feat_fc, np.transpose(query_feat_fc))
cmc1, mAP1, mINP1 = eval_regdb(-distmat1, gall_label, query_label)
distmat2 = np.matmul(gall_feat_fc, np.transpose(Xquery_feat_fc))
cmc2, mAP2, mINP2 = eval_regdb(-distmat2, gall_label, query_label)
distmat3 = np.matmul(Xgall_feat_fc, np.transpose(Xquery_feat_fc))
cmc3, mAP3, mINP3 = eval_regdb(-distmat3, gall_label, query_label)
#result = {'gallery_f':gall_feat_fc,'gallery_label':gall_label,'gallery_cam':gall_cam,'query_f':query_feat_fc,'query_label':query_label,'query_cam':query_cam}
#scipy.io.savemat('pytorch_result.mat',result)
distmat4 = distmat + distmat1 + distmat2 + distmat3
cmc4, mAP4, mINP4 = eval_regdb(-distmat4, gall_label, query_label)
distmat5 = np.minimum(np.minimum(distmat, distmat1), np.minimum(distmat2, distmat3))
cmc5, mAP5, mINP5 = eval_regdb(-distmat5, gall_label, query_label)
distmat6 = np.maximum(np.maximum(distmat, distmat1), np.maximum(distmat2, distmat3))
cmc6, mAP6, mINP6 = eval_regdb(-distmat6, gall_label, query_label)
else:
# pool5 feature
distmat = np.matmul(query_feat_fc, np.transpose(gall_feat_fc))
cmc, mAP, mINP = eval_regdb(-distmat, query_label, gall_label)
distmat1 = np.matmul(query_feat_fc, np.transpose(Xgall_feat_fc))
cmc1, mAP1, mINP1 = eval_regdb(-distmat1, query_label, gall_label)
distmat2 = np.matmul(Xquery_feat_fc, np.transpose(gall_feat_fc))
cmc2, mAP2, mINP2 = eval_regdb(-distmat2, query_label, gall_label)
distmat3 = np.matmul(Xquery_feat_fc, np.transpose(Xgall_feat_fc))
cmc3, mAP3, mINP3 = eval_regdb(-distmat3, query_label, gall_label)
#result = {'gallery_f':gall_feat_fc,'gallery_label':gall_label,'gallery_cam':gall_cam,'query_f':query_feat_fc,'query_label':query_label,'query_cam':query_cam}
#scipy.io.savemat('pytorch_result.mat',result)
distmat4 = distmat + distmat1 + distmat2 + distmat3
cmc4, mAP4, mINP4 = eval_regdb(-distmat4, query_label, gall_label)
distmat5 = np.minimum(np.minimum(distmat, distmat1), np.minimum(distmat2, distmat3))
cmc5, mAP5, mINP5 = eval_regdb(-distmat5, query_label, gall_label)
distmat6 = np.maximum(np.maximum(distmat, distmat1), np.maximum(distmat2, distmat3))
cmc6, mAP6, mINP6 = eval_regdb(-distmat6, query_label, gall_label)
if trial == 0:
all_cmc = cmc
all_mAP = mAP
all_mINP = mINP
all_cmc1 = cmc1
all_mAP1 = mAP1
all_mINP1 = mINP1
all_cmc2 = cmc2
all_mAP2 = mAP2
all_mINP2 = mINP2
all_cmc3 = cmc3
all_mAP3 = mAP3
all_mINP3 = mINP3
all_cmc4 = cmc4
all_mAP4 = mAP4
all_mINP4 = mINP4
all_cmc5 = cmc5
all_mAP5 = mAP5
all_mINP5 = mINP5
all_cmc6 = cmc6
all_mAP6 = mAP6
all_mINP6 = mINP6
else:
all_cmc = all_cmc + cmc
all_mAP = all_mAP + mAP
all_mINP = all_mINP + mINP
all_cmc1 = all_cmc1 + cmc1
all_mAP1 = all_mAP1 + mAP1
all_mINP1 = all_mINP1 + mINP1
all_cmc2 = all_cmc2 + cmc2
all_mAP2 = all_mAP2 + mAP2
all_mINP2 = all_mINP2 + mINP2
all_cmc3 = all_cmc3 + cmc3
all_mAP3 = all_mAP3 + mAP3
all_mINP3 = all_mINP3 + mINP3
all_cmc4 = all_cmc4 + cmc4
all_mAP4 = all_mAP4 + mAP4
all_mINP4 = all_mINP4 + mINP4
all_cmc5 = all_cmc5 + cmc5
all_mAP5 = all_mAP5 + mAP5
all_mINP5 = all_mINP5 + mINP5
all_cmc6 = all_cmc6 + cmc6
all_mAP6 = all_mAP6 + mAP6
all_mINP6 = all_mINP6 + mINP6
print('Test Trial: {}'.format(trial))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc[0], cmc[4], cmc[9], cmc[19], mAP, mINP))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc1[0], cmc1[4], cmc1[9], cmc1[19], mAP1, mINP1))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc2[0], cmc2[4], cmc2[9], cmc2[19], mAP2, mINP2))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc3[0], cmc3[4], cmc3[9], cmc3[19], mAP3, mINP3))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc4[0], cmc4[4], cmc4[9], cmc4[19], mAP4, mINP4))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc5[0], cmc5[4], cmc5[9], cmc5[19], mAP5, mINP5))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc6[0], cmc6[6], cmc6[9], cmc6[19], mAP6, mINP6))
cmc = all_cmc / 10
mAP = all_mAP / 10
mINP = all_mINP / 10
cmc1 = all_cmc1 / 10
mAP1 = all_mAP1 / 10
mINP1 = all_mINP1 / 10
cmc2 = all_cmc2 / 10
mAP2 = all_mAP2 / 10
mINP2 = all_mINP2 / 10
cmc3 = all_cmc3 / 10
mAP3 = all_mAP3 / 10
mINP3 = all_mINP3 / 10
cmc4 = all_cmc4 / 10
mAP4 = all_mAP4 / 10
mINP4 = all_mINP4 / 10
cmc5 = all_cmc5 / 10
mAP5 = all_mAP5 / 10
mINP5 = all_mINP5 / 10
cmc6 = all_cmc6 / 10
mAP6 = all_mAP6 / 10
mINP6 = all_mINP6 / 10
print('All Average:')
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc[0], cmc[4], cmc[9], cmc[19], mAP, mINP))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc1[0], cmc1[4], cmc1[9], cmc1[19], mAP1, mINP1))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc2[0], cmc2[4], cmc2[9], cmc2[19], mAP2, mINP2))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc3[0], cmc3[4], cmc3[9], cmc3[19], mAP3, mINP3))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc4[0], cmc4[4], cmc4[9], cmc4[19], mAP4, mINP4))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc5[0], cmc5[4], cmc5[9], cmc5[19], mAP5, mINP5))
print('FC: Rank-1: {:.2%} | Rank-5: {:.2%} | Rank-10: {:.2%}| Rank-20: {:.2%}| mAP: {:.2%}| mINP: {:.2%}'.format(
cmc6[0], cmc6[6], cmc6[9], cmc6[19], mAP6, mINP6))