From db91ba053bbdc892eb020203190a3fe96c11860f Mon Sep 17 00:00:00 2001 From: Chris Ha <15088501+VRandme@users.noreply.github.com> Date: Fri, 7 Feb 2020 19:28:07 +0900 Subject: [PATCH] EcaModule(CamelCase) CamelCased EcaModule. Renamed all instances of ecalayer to EcaModule. eca_module.py->EcaModule.py --- timm/models/{eca_module.py => EcaModule.py} | 8 ++++---- timm/models/resnet.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) rename timm/models/{eca_module.py => EcaModule.py} (96%) diff --git a/timm/models/eca_module.py b/timm/models/EcaModule.py similarity index 96% rename from timm/models/eca_module.py rename to timm/models/EcaModule.py index 5cb52d96..74da3170 100644 --- a/timm/models/eca_module.py +++ b/timm/models/EcaModule.py @@ -36,7 +36,7 @@ from torch import nn from torch.nn.parameter import Parameter -class eca_layer(nn.Module): +class EcaModule(nn.Module): """Constructs a ECA module. Args: @@ -44,7 +44,7 @@ class eca_layer(nn.Module): k_size: Adaptive selection of kernel size """ def __init__(self, channel, k_size=3): - super(eca_layer, self).__init__() + super(EcaModule, self).__init__() assert k_size % 2 == 1 self.avg_pool = nn.AdaptiveAvgPool2d(1) self.conv = nn.Conv1d(1, 1, kernel_size=k_size, padding=(k_size - 1) // 2, bias=False) @@ -79,7 +79,7 @@ class eca_layer(nn.Module): -class ceca_layer(nn.Module): +class CecaModule(nn.Module): """Constructs a circular ECA module. the primary difference is that the conv uses a circular padding rather than zero padding. This is because unlike images, the channels themselves do not have inherent ordering nor @@ -94,7 +94,7 @@ class ceca_layer(nn.Module): k_size: Adaptive selection of kernel size """ def __init__(self, channel, k_size=3): - super(ceca_layer, self).__init__() + super(CecaModule, self).__init__() assert k_size % 2 == 1 self.avg_pool = nn.AdaptiveAvgPool2d(1) #pytorch circular padding mode is bugged as of pytorch 1.4 diff --git a/timm/models/resnet.py b/timm/models/resnet.py index 49395c83..da755373 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -14,7 +14,7 @@ import torch.nn.functional as F from .registry import register_model from .helpers import load_pretrained from .adaptive_avgmax_pool import SelectAdaptivePool2d -from .eca_module import eca_layer +from .EcaModule import EcaModule from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD @@ -157,7 +157,7 @@ class BasicBlock(nn.Module): self.bn2 = norm_layer(outplanes) self.se = SEModule(outplanes, planes // 4) if use_se else None - self.eca = eca_layer(outplanes) if use_eca else None + self.eca = EcaModule(outplanes) if use_eca else None self.act2 = act_layer(inplace=True) self.downsample = downsample @@ -212,7 +212,7 @@ class Bottleneck(nn.Module): self.bn3 = norm_layer(outplanes) self.se = SEModule(outplanes, planes // 4) if use_se else None - self.eca = eca_layer(outplanes) if use_eca else None + self.eca = Eca_Module(outplanes) if use_eca else None self.act3 = act_layer(inplace=True) self.downsample = downsample