mp-02 commited on
Commit
7300f19
·
verified ·
1 Parent(s): 911511a

Update cord_inference.py

Browse files
Files changed (1) hide show
  1. cord_inference.py +2 -9
cord_inference.py CHANGED
@@ -59,13 +59,6 @@ def prediction(image):
59
  l_words = []
60
  bboxes = []
61
 
62
- for i, j in enumerate(true_predictions):
63
- if true_confidence_scores[i] < 0.8: #####################################àà
64
- true_predictions[i] = "O"
65
- preds.append(true_predictions[i])
66
- l_words.append(true_words[i])
67
- bboxes.append(true_boxes[i])
68
-
69
  d = {}
70
  for id, i in enumerate(preds):
71
  if i not in d.keys():
@@ -79,8 +72,8 @@ def prediction(image):
79
  draw = ImageDraw.Draw(image, "RGBA")
80
  font = ImageFont.load_default()
81
 
82
- for prediction, box in zip(preds, bboxes):
83
  draw.rectangle(box)
84
- draw.text((box[0]+10, box[1]-10), text=prediction, font=font, fill="black")
85
 
86
  return d, image
 
59
  l_words = []
60
  bboxes = []
61
 
 
 
 
 
 
 
 
62
  d = {}
63
  for id, i in enumerate(preds):
64
  if i not in d.keys():
 
72
  draw = ImageDraw.Draw(image, "RGBA")
73
  font = ImageFont.load_default()
74
 
75
+ for prediction, box, confidence in zip(preds, bboxes, true_confidence_scores):
76
  draw.rectangle(box)
77
+ draw.text((box[0]+10, box[1]-10), text=prediction+ ", "+ confidence, font=font, fill="black", font_size="15")
78
 
79
  return d, image