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

Function extract_query_feat

test.py:115–129  ·  view source on GitHub ↗
(query_loader, net)

Source from the content-addressed store, hash-verified

113
114
115def extract_query_feat(query_loader, net):
116 net.eval()
117 print('Extracting Query Feature...')
118 start = time.time()
119 ptr = 0
120 query_feat_fc = np.zeros((nquery, pool_dim))
121 with torch.no_grad():
122 for batch_idx, (input, label) in enumerate(query_loader):
123 batch_num = input.size(0)
124 input = input.cuda()
125 _, feat_fc = net(input, input, test_mode[1])
126 query_feat_fc[ptr:ptr + batch_num, :] = feat_fc.detach().cpu().numpy()
127 ptr = ptr + batch_num
128 print('Extracting Time:\t {:.3f}'.format(time.time() - start))
129 return query_feat_fc
130
131
132if dataset == 'sysu':

Callers 1

test.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected