diff --git a/ppocr/modeling/heads/rec_ctc_head.py b/ppocr/modeling/heads/rec_ctc_head.py index 8c7b904fed741d947e580611de3e9d8cb2f312f4..e96b96ad8168bb2d045f99458398ea75807a8b50 100755 --- a/ppocr/modeling/heads/rec_ctc_head.py +++ b/ppocr/modeling/heads/rec_ctc_head.py @@ -20,6 +20,7 @@ import math import paddle from paddle import ParamAttr, nn +from paddle.nn import functional as F def get_para_bias_attr(l2_decay, k, name): @@ -48,4 +49,6 @@ class CTC(nn.Layer): def forward(self, x, labels=None): predicts = self.fc(x) + if not self.training: + predicts = F.softmax(predicts, axis=2) return predicts