From 122c82e93ff81e32d7f05f82db7e4dcec7456257 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Fri, 23 Oct 2020 12:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=A8=A1=E5=BC=8F=E6=97=B6?= =?UTF-8?q?=E5=B0=86=E8=BE=93=E5=87=BAsoftmax=E5=90=8E=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ppocr/modeling/heads/rec_ctc_head.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ppocr/modeling/heads/rec_ctc_head.py b/ppocr/modeling/heads/rec_ctc_head.py index 8c7b904f..e96b96ad 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 -- GitLab