parent
96c078dafc
commit
07330e0e42
|
@ -1,6 +1,6 @@
|
|||
mode: 'train'
|
||||
ARCHITECTURE:
|
||||
name: "ShuffleNetV2"
|
||||
name: "ShuffleNetV2_x1_0"
|
||||
|
||||
pretrained_model: ""
|
||||
model_save_dir: "./output/"
|
|
@ -32,14 +32,13 @@ from .ghostnet import GhostNet_x0_5, GhostNet_x1_0, GhostNet_x1_3
|
|||
from .mobilenet_v1 import MobileNetV1_x0_25, MobileNetV1_x0_5, MobileNetV1_x0_75, MobileNetV1
|
||||
from .mobilenet_v2 import MobileNetV2_x0_25, MobileNetV2_x0_5, MobileNetV2_x0_75, MobileNetV2, MobileNetV2_x1_5, MobileNetV2_x2_0
|
||||
from .mobilenet_v3 import MobileNetV3_small_x0_35, MobileNetV3_small_x0_5, MobileNetV3_small_x0_75, MobileNetV3_small_x1_0, MobileNetV3_small_x1_25, MobileNetV3_large_x0_35, MobileNetV3_large_x0_5, MobileNetV3_large_x0_75, MobileNetV3_large_x1_0, MobileNetV3_large_x1_25
|
||||
from .shufflenet_v2 import ShuffleNetV2_x0_25, ShuffleNetV2_x0_33, ShuffleNetV2_x0_5, ShuffleNetV2, ShuffleNetV2_x1_5, ShuffleNetV2_x2_0, ShuffleNetV2_swish
|
||||
from .shufflenet_v2 import ShuffleNetV2_x0_25, ShuffleNetV2_x0_33, ShuffleNetV2_x0_5, ShuffleNetV2_x1_0, ShuffleNetV2_x1_5, ShuffleNetV2_x2_0, ShuffleNetV2_swish
|
||||
from .alexnet import AlexNet
|
||||
from .inception_v3 import InceptionV3
|
||||
from .inception_v4 import InceptionV4
|
||||
from .xception import Xception41, Xception65, Xception71
|
||||
from .xception_deeplab import Xception41_deeplab, Xception65_deeplab, Xception71_deeplab
|
||||
from .resnext101_wsl import ResNeXt101_32x8d_wsl, ResNeXt101_32x16d_wsl, ResNeXt101_32x32d_wsl, ResNeXt101_32x48d_wsl
|
||||
from .shufflenet_v2 import ShuffleNetV2_x0_25, ShuffleNetV2_x0_33, ShuffleNetV2_x0_5, ShuffleNetV2, ShuffleNetV2_x1_5, ShuffleNetV2_x2_0, ShuffleNetV2_swish
|
||||
from .squeezenet import SqueezeNet1_0, SqueezeNet1_1
|
||||
from .vgg import VGG11, VGG13, VGG16, VGG19
|
||||
from .darknet import DarkNet53
|
||||
|
|
|
@ -44,7 +44,6 @@ class ConvBNLayer(nn.Layer):
|
|||
bias_attr=False)
|
||||
bn_name = name + "_bn"
|
||||
|
||||
# In the old version, moving_variance_name was name + "_variance"
|
||||
self._batch_norm = BatchNorm(
|
||||
num_channels=out_channels,
|
||||
act=act,
|
||||
|
@ -53,9 +52,7 @@ class ConvBNLayer(nn.Layer):
|
|||
bias_attr=ParamAttr(
|
||||
name=bn_name + "_offset", regularizer=L2Decay(0.0)),
|
||||
moving_mean_name=bn_name + "_mean",
|
||||
moving_variance_name=name +
|
||||
"_variance" # wrong due to an old typo, will be fixed later.
|
||||
)
|
||||
moving_variance_name=bn_name + "_variance")
|
||||
|
||||
def forward(self, inputs):
|
||||
y = self._conv(inputs)
|
||||
|
|
|
@ -120,7 +120,7 @@ class SplatConv(nn.Layer):
|
|||
stride=stride,
|
||||
groups=groups * radix,
|
||||
act="relu",
|
||||
name=name + "_splat1")
|
||||
name=name + "_1_weights")
|
||||
|
||||
self.avg_pool2d = AdaptiveAvgPool2D(1)
|
||||
|
||||
|
@ -134,7 +134,7 @@ class SplatConv(nn.Layer):
|
|||
stride=1,
|
||||
groups=groups,
|
||||
act="relu",
|
||||
name=name + "_splat2")
|
||||
name=name + "_2_weights")
|
||||
|
||||
# to calc atten
|
||||
self.conv3 = Conv2D(
|
||||
|
@ -145,7 +145,7 @@ class SplatConv(nn.Layer):
|
|||
padding=0,
|
||||
groups=groups,
|
||||
weight_attr=ParamAttr(
|
||||
name=name + "_splat_weights", initializer=KaimingNormal()),
|
||||
name=name + "_weights", initializer=KaimingNormal()),
|
||||
bias_attr=False)
|
||||
|
||||
self.rsoftmax = rSoftmax(radix=radix, cardinality=groups)
|
||||
|
@ -233,7 +233,7 @@ class BottleneckBlock(nn.Layer):
|
|||
bias=False,
|
||||
radix=radix,
|
||||
rectify_avg=rectify_avg,
|
||||
name=name + "_splatconv")
|
||||
name=name + "_splat")
|
||||
else:
|
||||
self.conv2 = ConvBNLayer(
|
||||
num_channels=group_width,
|
||||
|
@ -403,10 +403,10 @@ class ResNeStLayer(nn.Layer):
|
|||
self.inplanes = planes * 4
|
||||
self.bottleneck_block_list = [bottleneck_func]
|
||||
for i in range(1, blocks):
|
||||
name = name + "_bottleneck_" + str(i)
|
||||
curr_name = name + "_bottleneck_" + str(i)
|
||||
|
||||
bottleneck_func = self.add_sublayer(
|
||||
name,
|
||||
curr_name,
|
||||
BottleneckBlock(
|
||||
inplanes=self.inplanes,
|
||||
planes=planes,
|
||||
|
@ -419,7 +419,7 @@ class ResNeStLayer(nn.Layer):
|
|||
dilation=dilation,
|
||||
rectify_avg=rectify_avg,
|
||||
last_gamma=last_gamma,
|
||||
name=name))
|
||||
name=curr_name))
|
||||
self.bottleneck_block_list.append(bottleneck_func)
|
||||
|
||||
def forward(self, x):
|
||||
|
|
|
@ -23,7 +23,7 @@ from paddle.nn.functional import swish
|
|||
|
||||
__all__ = [
|
||||
"ShuffleNetV2_x0_25", "ShuffleNetV2_x0_33", "ShuffleNetV2_x0_5",
|
||||
"ShuffleNetV2", "ShuffleNetV2_x1_5", "ShuffleNetV2_x2_0",
|
||||
"ShuffleNetV2_x1_0", "ShuffleNetV2_x1_5", "ShuffleNetV2_x2_0",
|
||||
"ShuffleNetV2_swish"
|
||||
]
|
||||
|
||||
|
@ -299,7 +299,7 @@ def ShuffleNetV2_x0_5(**args):
|
|||
return model
|
||||
|
||||
|
||||
def ShuffleNetV2(**args):
|
||||
def ShuffleNetV2_x1_0(**args):
|
||||
model = ShuffleNet(scale=1.0, **args)
|
||||
return model
|
||||
|
||||
|
|
Loading…
Reference in New Issue