Skip to content

Commit 58f2f79

Browse files
committed
Remove a duplicate function in mobilenetv3.py: _gen_lcnet is repeated in mobilenetv3.py.Remove the duplicate code.
1 parent f04802f commit 58f2f79

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

timm/models/mobilenetv3.py

-37
Original file line numberDiff line numberDiff line change
@@ -622,43 +622,6 @@ def _gen_lcnet(variant: str, channel_multiplier: float = 1.0, pretrained: bool =
622622
return model
623623

624624

625-
def _gen_lcnet(variant: str, channel_multiplier: float = 1.0, pretrained: bool = False, **kwargs):
626-
""" LCNet
627-
Essentially a MobileNet-V3 crossed with a MobileNet-V1
628-
629-
Paper: `PP-LCNet: A Lightweight CPU Convolutional Neural Network` - https://arxiv.org/abs/2109.15099
630-
631-
Args:
632-
channel_multiplier: multiplier to number of channels per layer.
633-
"""
634-
arch_def = [
635-
# stage 0, 112x112 in
636-
['dsa_r1_k3_s1_c32'],
637-
# stage 1, 112x112 in
638-
['dsa_r2_k3_s2_c64'],
639-
# stage 2, 56x56 in
640-
['dsa_r2_k3_s2_c128'],
641-
# stage 3, 28x28 in
642-
['dsa_r1_k3_s2_c256', 'dsa_r1_k5_s1_c256'],
643-
# stage 4, 14x14in
644-
['dsa_r4_k5_s1_c256'],
645-
# stage 5, 14x14in
646-
['dsa_r2_k5_s2_c512_se0.25'],
647-
# 7x7
648-
]
649-
model_kwargs = dict(
650-
block_args=decode_arch_def(arch_def),
651-
stem_size=16,
652-
round_chs_fn=partial(round_channels, multiplier=channel_multiplier),
653-
norm_layer=partial(nn.BatchNorm2d, **resolve_bn_args(kwargs)),
654-
act_layer=resolve_act_layer(kwargs, 'hard_swish'),
655-
se_layer=partial(SqueezeExcite, gate_layer='hard_sigmoid', force_act_layer=nn.ReLU),
656-
num_features=1280,
657-
**kwargs,
658-
)
659-
model = _create_mnv3(variant, pretrained, **model_kwargs)
660-
return model
661-
662625

663626
def _cfg(url: str = '', **kwargs):
664627
return {

0 commit comments

Comments
 (0)