summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--text_recognizer/data/iam_lines.py4
-rw-r--r--text_recognizer/data/iam_paragraphs.py4
-rw-r--r--text_recognizer/models/base.py12
3 files changed, 15 insertions, 5 deletions
diff --git a/text_recognizer/data/iam_lines.py b/text_recognizer/data/iam_lines.py
index 705cfa3..13dd379 100644
--- a/text_recognizer/data/iam_lines.py
+++ b/text_recognizer/data/iam_lines.py
@@ -43,7 +43,9 @@ class IAMLines(BaseDataModule):
augment: bool = attr.ib(default=True)
fraction: float = attr.ib(default=0.8)
- dims: Tuple[int, int, int] = attr.ib(init=False, default=(1, IMAGE_HEIGHT, IMAGE_WIDTH))
+ dims: Tuple[int, int, int] = attr.ib(
+ init=False, default=(1, IMAGE_HEIGHT, IMAGE_WIDTH)
+ )
output_dims: Tuple[int, int] = attr.ib(init=False, default=(MAX_LABEL_LENGTH, 1))
def __attrs_post_init__(self) -> None:
diff --git a/text_recognizer/data/iam_paragraphs.py b/text_recognizer/data/iam_paragraphs.py
index 9977978..de32875 100644
--- a/text_recognizer/data/iam_paragraphs.py
+++ b/text_recognizer/data/iam_paragraphs.py
@@ -41,7 +41,9 @@ class IAMParagraphs(BaseDataModule):
augment: bool = attr.ib(default=True)
train_fraction: float = attr.ib(default=0.8)
word_pieces: bool = attr.ib(default=False)
- dims: Tuple[int, int, int] = attr.ib(init=False, default=(1, IMAGE_HEIGHT, IMAGE_WIDTH))
+ dims: Tuple[int, int, int] = attr.ib(
+ init=False, default=(1, IMAGE_HEIGHT, IMAGE_WIDTH)
+ )
output_dims: Tuple[int, int] = attr.ib(init=False, default=(MAX_LABEL_LENGTH, 1))
def __attrs_post_init__(self) -> None:
diff --git a/text_recognizer/models/base.py b/text_recognizer/models/base.py
index 3b83056..3e02261 100644
--- a/text_recognizer/models/base.py
+++ b/text_recognizer/models/base.py
@@ -31,9 +31,15 @@ class BaseLitModel(LightningModule):
loss_fn: Type[nn.Module] = attr.ib(init=False)
- train_acc: torchmetrics.Accuracy = attr.ib(init=False, default=torchmetrics.Accuracy())
- val_acc: torchmetrics.Accuracy = attr.ib(init=False, default=torchmetrics.Accuracy())
- test_acc: torchmetrics.Accuracy = attr.ib(init=False, default=torchmetrics.Accuracy())
+ train_acc: torchmetrics.Accuracy = attr.ib(
+ init=False, default=torchmetrics.Accuracy()
+ )
+ val_acc: torchmetrics.Accuracy = attr.ib(
+ init=False, default=torchmetrics.Accuracy()
+ )
+ test_acc: torchmetrics.Accuracy = attr.ib(
+ init=False, default=torchmetrics.Accuracy()
+ )
@loss_fn.default
def configure_criterion(self) -> Type[nn.Module]: