Skip to content

Commit b3b503c

Browse files
authored
Merge pull request #626 from cvcomar/master
fix: the exception not using default topk argument
2 parents e7f0db8 + d7e1e71 commit b3b503c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def main():
114114
_logger.info('Predict: [{0}/{1}] Time {batch_time.val:.3f} ({batch_time.avg:.3f})'.format(
115115
batch_idx, len(loader), batch_time=batch_time))
116116

117-
topk_ids = np.concatenate(topk_ids, axis=0).squeeze()
117+
topk_ids = np.concatenate(topk_ids, axis=0)
118118

119119
with open(os.path.join(args.output_dir, './topk_ids.csv'), 'w') as out_file:
120120
filenames = loader.dataset.filenames(basename=True)
121121
for filename, label in zip(filenames, topk_ids):
122-
out_file.write('{0},{1},{2},{3},{4},{5}\n'.format(
123-
filename, label[0], label[1], label[2], label[3], label[4]))
122+
out_file.write('{0},{1}\n'.format(
123+
filename, ','.join([ str(v) for v in label])))
124124

125125

126126
if __name__ == '__main__':

0 commit comments

Comments
 (0)