Skip to content

Commit

Permalink
[Fix] Fix Recognition Score Normalization Issue (#1333)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinke-wang authored Sep 21, 2022
1 parent 3c63f73 commit 0421659
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion mmocr/models/textrecog/convertors/attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def tensor2idx(self, outputs, img_metas=None):
indexes, scores = [], []
for idx in range(batch_size):
seq = outputs[idx, :, :]
seq = seq.softmax(dim=-1)
max_value, max_idx = torch.max(seq, -1)
str_index, str_score = [], []
output_index = max_idx.cpu().detach().numpy().tolist()
Expand Down
2 changes: 1 addition & 1 deletion mmocr/models/textrecog/recognizer/abinet.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def simple_test(self, img, img_metas, **kwargs):
return ret['logits']

label_indexes, label_scores = self.label_convertor.tensor2idx(
ret['logits'], img_metas)
ret['logits'].softmax(dim=-1), img_metas)
label_strings = self.label_convertor.idx2str(label_indexes)

# flatten batch results
Expand Down

0 comments on commit 0421659

Please sign in to comment.