diff options
| author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-01-26 23:17:14 +0100 | 
|---|---|---|
| committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-01-26 23:17:14 +0100 | 
| commit | 9b6c99172f80b45030279e7268aaa80e5a1ed574 (patch) | |
| tree | 5049b225927e786dd462265ec8bca9a0f8084f18 /text_recognizer | |
| parent | 5e81d11e18cc28c383a30c10c53b8b477ada3c0a (diff) | |
fix: lint and format
Diffstat (limited to 'text_recognizer')
| -rw-r--r-- | text_recognizer/data/iam_paragraphs.py | 5 | ||||
| -rw-r--r-- | text_recognizer/data/iam_synthetic_paragraphs.py | 8 | ||||
| -rw-r--r-- | text_recognizer/networks/efficientnet/efficientnet.py | 4 | ||||
| -rw-r--r-- | text_recognizer/networks/efficientnet/mbconv.py | 5 | 
4 files changed, 4 insertions, 18 deletions
diff --git a/text_recognizer/data/iam_paragraphs.py b/text_recognizer/data/iam_paragraphs.py index a8d5e0d..033b93e 100644 --- a/text_recognizer/data/iam_paragraphs.py +++ b/text_recognizer/data/iam_paragraphs.py @@ -86,10 +86,7 @@ class IAMParagraphs(BaseDataModule):                  length=self.output_dims[0],              )              return BaseDataset( -                data, -                targets, -                transform=transform, -                target_transform=target_transform, +                data, targets, transform=transform, target_transform=target_transform,              )          log.info(f"Loading IAM paragraph regions and lines for {stage}...") diff --git a/text_recognizer/data/iam_synthetic_paragraphs.py b/text_recognizer/data/iam_synthetic_paragraphs.py index 351e052..ea59098 100644 --- a/text_recognizer/data/iam_synthetic_paragraphs.py +++ b/text_recognizer/data/iam_synthetic_paragraphs.py @@ -46,13 +46,7 @@ class IAMSyntheticParagraphs(IAMParagraphs):          log.info("Preparing IAM lines for synthetic paragraphs dataset.")          log.info("Cropping IAM line regions and loading labels.") -        iam = IAM( -            mapping=EmnistMapping( -                extra_symbols={ -                    NEW_LINE_TOKEN, -                } -            ) -        ) +        iam = IAM(mapping=EmnistMapping(extra_symbols=(NEW_LINE_TOKEN,)))          iam.prepare_data()          crops_train, labels_train = line_crops_and_labels(iam, "train") diff --git a/text_recognizer/networks/efficientnet/efficientnet.py b/text_recognizer/networks/efficientnet/efficientnet.py index bc0cdeb..4c9ed75 100644 --- a/text_recognizer/networks/efficientnet/efficientnet.py +++ b/text_recognizer/networks/efficientnet/efficientnet.py @@ -88,9 +88,7 @@ class EfficientNet(nn.Module):              for _ in range(num_repeats):                  self._blocks.append(                      MBConvBlock( -                        **args, -                        bn_momentum=self.bn_momentum, -                        bn_eps=self.bn_eps, +                        **args, bn_momentum=self.bn_momentum, bn_eps=self.bn_eps,                      )                  )                  args.in_channels = args.out_channels diff --git a/text_recognizer/networks/efficientnet/mbconv.py b/text_recognizer/networks/efficientnet/mbconv.py index 6324191..beb7d57 100644 --- a/text_recognizer/networks/efficientnet/mbconv.py +++ b/text_recognizer/networks/efficientnet/mbconv.py @@ -158,10 +158,7 @@ class MBConvBlock(nn.Module):      def _configure_padding(self) -> Tuple[int, int, int, int]:          """Set padding for convolutional layers."""          if self.stride == (2, 2): -            return ( -                (self.kernel_size - 1) // 2 - 1, -                (self.kernel_size - 1) // 2, -            ) * 2 +            return ((self.kernel_size - 1) // 2 - 1, (self.kernel_size - 1) // 2,) * 2          return ((self.kernel_size - 1) // 2,) * 4      def __attrs_post_init__(self) -> None:  |