shivalikasingh commited on
Commit
252f69c
·
1 Parent(s): b86a5c2

Update utils/predict.py

Browse files
Files changed (1) hide show
  1. utils/predict.py +3 -3
utils/predict.py CHANGED
@@ -68,9 +68,9 @@ def predict_batch(image_path):
68
 
69
  prob_list = slice_pred[i].numpy().flatten().tolist()
70
  sorted_prob = np.argsort(slice_pred[i])[::-1].flatten()
71
- prob_scores = {"image": "image "+ str(j), "first": f"probability of {class_vocab[sorted_prob[0]]} is {round(prob_list[sorted_prob[0]] * 100,2)} %",
72
- "second": f"probability of {class_vocab[sorted_prob[1]]} is {round(prob_list[sorted_prob[1]] * 100,2)} %",
73
- "third": f"probability of {class_vocab[sorted_prob[2]]} is {round(prob_list[sorted_prob[2]] * 100,2)} %"}
74
  predictions_df = predictions_df.append(prob_scores,ignore_index=True)
75
 
76
  plt.title(f"image {j} : {class_vocab[output]}")
 
68
 
69
  prob_list = slice_pred[i].numpy().flatten().tolist()
70
  sorted_prob = np.argsort(slice_pred[i])[::-1].flatten()
71
+ prob_scores = {"image": "image "+ str(j), "first": f"predicted {class_vocab[sorted_prob[0]]} with {round(prob_list[sorted_prob[0]] * 100,2)}% confidence",
72
+ "second": f"predicted {class_vocab[sorted_prob[1]]} is {round(prob_list[sorted_prob[1]] * 100,2)}% confidence",
73
+ "third": f"predicted {class_vocab[sorted_prob[2]]} is {round(prob_list[sorted_prob[2]] * 100,2)}% confidence"}
74
  predictions_df = predictions_df.append(prob_scores,ignore_index=True)
75
 
76
  plt.title(f"image {j} : {class_vocab[output]}")