MCPcopy Create free account
hub / github.com/XLearning-SCU/2022-CVPR-DART / extract_gall_feat

Function extract_gall_feat

test.py:98–112  ·  view source on GitHub ↗
(gall_loader, net)

Source from the content-addressed store, hash-verified

96
97
98def extract_gall_feat(gall_loader, net):
99 net.eval()
100 print('Extracting Gallery Feature...')
101 start = time.time()
102 ptr = 0
103 gall_feat_fc = np.zeros((ngall, pool_dim))
104 with torch.no_grad():
105 for batch_idx, (input, label) in enumerate(gall_loader):
106 batch_num = input.size(0)
107 input = input.cuda()
108 _, feat_fc = net(input, input, test_mode[0])
109 gall_feat_fc[ptr:ptr + batch_num, :] = feat_fc.detach().cpu().numpy()
110 ptr = ptr + batch_num
111 print('Extracting Time:\t {:.3f}'.format(time.time() - start))
112 return gall_feat_fc
113
114
115def extract_query_feat(query_loader, net):

Callers 1

test.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected