Skip to content

Commit

Permalink
Fix display of result predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
Samet Çetin committed Jul 19, 2018
1 parent 10b0f3b commit 970c46e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/detect_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ def main(argv):
# PLACE WORD2VECS IN KDTREE
tree = KDTree(vectors)
# FIND CLOSEST WORD2VEC and GET PREDICTION RESULT
dist, index = tree.query(pred, k=1)
dist, index = tree.query(pred, k=5)
pred_labels = [classnames[idx] for idx in index[0]]

# PRINT RESULT
print("Prediction: %s" % classnames[index[0][0]])
print()
print("--- Top-5 Prediction ---")
for i, classname in enumerate(pred_labels):
print("%d- %s" %(i+1, classname))
print()
return

if __name__ == '__main__':
Expand Down

0 comments on commit 970c46e

Please sign in to comment.