From 31aa45fed220e76feaaff717343e4e67f23e14a7 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Fri, 25 Dec 2020 16:39:50 +0800 Subject: [PATCH] add init to fc1 --- ppocr/modeling/transforms/tps.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ppocr/modeling/transforms/tps.py b/ppocr/modeling/transforms/tps.py index 86665bed..e7a152c1 100644 --- a/ppocr/modeling/transforms/tps.py +++ b/ppocr/modeling/transforms/tps.py @@ -16,6 +16,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +import math import paddle from paddle import nn, ParamAttr from paddle.nn import functional as F @@ -88,11 +89,14 @@ class LocalizationNetwork(nn.Layer): in_channels = num_filters self.block_list.append(pool) name = "loc_fc1" + stdv = 1.0 / math.sqrt(num_filters_list[-1] * 1.0) self.fc1 = nn.Linear( in_channels, fc_dim, weight_attr=ParamAttr( - learning_rate=loc_lr, name=name + "_w"), + learning_rate=loc_lr, + name=name + "_w", + initializer=nn.initializer.Uniform(-stdv, stdv)), bias_attr=ParamAttr(name=name + '.b_0'), name=name) -- GitLab