Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion vietocr/model/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def predict(self, sample=None):
pred_sents = []
actual_sents = []
img_files = []
probs = []

for batch in self.valid_gen:
batch = self.batch_to_device(batch)
Expand All @@ -183,11 +184,12 @@ def predict(self, sample=None):

pred_sents.extend(pred_sent)
actual_sents.extend(actual_sent)
probs.extend(prob)

if sample != None and len(pred_sents) > sample:
break

return pred_sents, actual_sents, img_files, prob
return pred_sents, actual_sents, img_files, probs

def precision(self, sample=None):

Expand Down