summaryrefslogtreecommitdiff
path: root/text_recognizer
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-10-03 00:32:26 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-10-03 00:32:26 +0200
commit790c6321941226cd650ff5fa1729dd8c19966f4f (patch)
tree2a5869c548453d95a9361a7e058bbe875724cfd1 /text_recognizer
parent1d5e1e57c324e5c5f3521abc7c2173f84104a080 (diff)
Add target transform to IAM Lines
Diffstat (limited to 'text_recognizer')
-rw-r--r--text_recognizer/data/iam_lines.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/text_recognizer/data/iam_lines.py b/text_recognizer/data/iam_lines.py
index 0e45c68..7a063c1 100644
--- a/text_recognizer/data/iam_lines.py
+++ b/text_recognizer/data/iam_lines.py
@@ -24,8 +24,8 @@ from text_recognizer.data.base_dataset import (
split_dataset,
)
from text_recognizer.data.emnist_mapping import EmnistMapping
-from text_recognizer.data.iam_paragraphs import get_target_transform
from text_recognizer.data.iam import IAM
+from text_recognizer.data.iam_paragraphs import get_target_transform
ImageFile.LOAD_TRUNCATED_IMAGES = True
@@ -35,6 +35,7 @@ PROCESSED_DATA_DIRNAME = BaseDataModule.data_dirname() / "processed" / "iam_line
IMAGE_HEIGHT = 56
IMAGE_WIDTH = 1024
MAX_LABEL_LENGTH = 89
+MAX_WORD_PIECE_LENGTH = 72
@attr.s(auto_attribs=True, repr=False)
@@ -94,7 +95,9 @@ class IAMLines(BaseDataModule):
x_train,
y_train,
transform=get_transform(IMAGE_WIDTH, self.augment),
- target_transform=get_target_transform(self.word_pieces),
+ target_transform=get_target_transform(
+ self.word_pieces, max_len=MAX_WORD_PIECE_LENGTH
+ ),
)
self.data_train, self.data_val = split_dataset(
@@ -116,7 +119,9 @@ class IAMLines(BaseDataModule):
x_test,
y_test,
transform=get_transform(IMAGE_WIDTH),
- target_transform=get_target_transform(self.word_pieces),
+ target_transform=get_target_transform(
+ self.word_pieces, max_len=MAX_WORD_PIECE_LENGTH
+ ),
)
if stage is None: