From 521f3bbbba9f04f48e81d78033c6e1c29a08e515 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 20 Jun 2022 00:09:20 +0200 Subject: Update eff net config --- text_recognizer/networks/efficientnet/efficientnet.py | 17 ++--------------- text_recognizer/networks/efficientnet/utils.py | 10 +++++----- 2 files changed, 7 insertions(+), 20 deletions(-) (limited to 'text_recognizer/networks') diff --git a/text_recognizer/networks/efficientnet/efficientnet.py b/text_recognizer/networks/efficientnet/efficientnet.py index de08457..2a712d8 100644 --- a/text_recognizer/networks/efficientnet/efficientnet.py +++ b/text_recognizer/networks/efficientnet/efficientnet.py @@ -61,14 +61,14 @@ class EfficientNet(nn.Module): """Builds the efficientnet backbone.""" _block_args = block_args()[: self.depth] in_channels = 1 # BW - out_channels = round_filters(32, self.params) + out_channels = round_filters(16, self.params) self._conv_stem = nn.Sequential( nn.ZeroPad2d((0, 1, 0, 1)), nn.Conv2d( in_channels=in_channels, out_channels=out_channels, kernel_size=3, - stride=self.stride, + stride=2, bias=False, ), nn.BatchNorm2d( @@ -98,19 +98,6 @@ class EfficientNet(nn.Module): nn.Conv2d( in_channels, self.out_channels, - kernel_size=2, - stride=self.stride, - bias=False, - ), - nn.BatchNorm2d( - num_features=self.out_channels, - momentum=self.bn_momentum, - eps=self.bn_eps, - ), - nn.Mish(inplace=True), - nn.Conv2d( - self.out_channels, - self.out_channels, kernel_size=1, stride=1, bias=False, diff --git a/text_recognizer/networks/efficientnet/utils.py b/text_recognizer/networks/efficientnet/utils.py index 5234324..770f85b 100644 --- a/text_recognizer/networks/efficientnet/utils.py +++ b/text_recognizer/networks/efficientnet/utils.py @@ -72,13 +72,13 @@ def block_args() -> List[DictConfig]: "se_ratio", ] args = [ - [1, 3, (1, 1), 1, 32, 16, 0.25], + [1, 3, (1, 1), 1, 16, 16, 0.25], [2, 3, (2, 2), 6, 16, 24, 0.25], [2, 5, (2, 2), 6, 24, 40, 0.25], - [3, 3, (2, 2), 6, 40, 80, 0.25], - [3, 5, (1, 1), 6, 80, 112, 0.25], - [4, 5, (2, 2), 6, 112, 192, 0.25], - [1, 3, (1, 1), 6, 192, 320, 0.25], + [3, 3, (2, 1), 6, 40, 80, 0.25], + [3, 5, (2, 1), 6, 80, 112, 0.25], + [4, 5, (2, 1), 6, 112, 192, 0.25], + [1, 3, (2, 1), 6, 192, 320, 0.25], ] block_args_ = [] for row in args: -- cgit v1.2.3-70-g09d2