Skip to content

Commit

Permalink
Merge pull request #18 from tdeboissiere/master
Browse files Browse the repository at this point in the history
Sort model predictions correctly
  • Loading branch information
fchollet authored Oct 31, 2016
2 parents 48dcedb + fa518ab commit 8d8f54a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imagenet_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def decode_predictions(preds, top=5):
CLASS_INDEX = json.load(open(fpath))
results = []
for pred in preds:
top_indices = np.argpartition(pred, -top)[-top:][::-1]
top_indices = pred.argsort()[-top:][::-1]
result = [tuple(CLASS_INDEX[str(i)]) + (pred[i],) for i in top_indices]
results.append(result)
return results

0 comments on commit 8d8f54a

Please sign in to comment.