add init to fc1

This commit is contained in:
WenmuZhou 2020-12-25 16:39:50 +08:00
parent 7a94905a4f
commit 31aa45fed2
1 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,7 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import math
import paddle import paddle
from paddle import nn, ParamAttr from paddle import nn, ParamAttr
from paddle.nn import functional as F from paddle.nn import functional as F
@ -88,11 +89,14 @@ class LocalizationNetwork(nn.Layer):
in_channels = num_filters in_channels = num_filters
self.block_list.append(pool) self.block_list.append(pool)
name = "loc_fc1" name = "loc_fc1"
stdv = 1.0 / math.sqrt(num_filters_list[-1] * 1.0)
self.fc1 = nn.Linear( self.fc1 = nn.Linear(
in_channels, in_channels,
fc_dim, fc_dim,
weight_attr=ParamAttr( 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'), bias_attr=ParamAttr(name=name + '.b_0'),
name=name) name=name)