summaryrefslogtreecommitdiff
path: root/text_recognizer/data
diff options
context:
space:
mode:
Diffstat (limited to 'text_recognizer/data')
-rw-r--r--text_recognizer/data/emnist.py2
-rw-r--r--text_recognizer/data/emnist_lines.py2
-rw-r--r--text_recognizer/data/iam.py8
-rw-r--r--text_recognizer/data/iam_extended_paragraphs.py4
-rw-r--r--text_recognizer/data/iam_lines.py2
-rw-r--r--text_recognizer/data/iam_paragraphs.py4
-rw-r--r--text_recognizer/data/iam_synthetic_paragraphs.py14
-rw-r--r--text_recognizer/data/transforms/image.py4
-rw-r--r--text_recognizer/data/transforms/line.py2
-rw-r--r--text_recognizer/data/transforms/paragraph.py1
-rw-r--r--text_recognizer/data/utils/sentence_generator.py2
11 files changed, 22 insertions, 23 deletions
diff --git a/text_recognizer/data/emnist.py b/text_recognizer/data/emnist.py
index b5db075..4a14521 100644
--- a/text_recognizer/data/emnist.py
+++ b/text_recognizer/data/emnist.py
@@ -11,10 +11,10 @@ import numpy as np
import toml
from loguru import logger as log
+import text_recognizer.metadata.emnist as metadata
from text_recognizer.data.base_data_module import BaseDataModule, load_and_print_info
from text_recognizer.data.base_dataset import BaseDataset, split_dataset
from text_recognizer.data.utils.download_utils import download_dataset
-import text_recognizer.metadata.emnist as metadata
class EMNIST(BaseDataModule):
diff --git a/text_recognizer/data/emnist_lines.py b/text_recognizer/data/emnist_lines.py
index 4ae4787..aaec93f 100644
--- a/text_recognizer/data/emnist_lines.py
+++ b/text_recognizer/data/emnist_lines.py
@@ -9,13 +9,13 @@ import torch
from loguru import logger as log
from torch import Tensor
+import text_recognizer.metadata.emnist_lines as metadata
from text_recognizer.data.base_data_module import BaseDataModule, load_and_print_info
from text_recognizer.data.base_dataset import BaseDataset, convert_strings_to_labels
from text_recognizer.data.emnist import EMNIST
from text_recognizer.data.tokenizer import Tokenizer
from text_recognizer.data.transforms.line import LineStem
from text_recognizer.data.utils.sentence_generator import SentenceGenerator
-import text_recognizer.metadata.emnist_lines as metadata
class EMNISTLines(BaseDataModule):
diff --git a/text_recognizer/data/iam.py b/text_recognizer/data/iam.py
index 8a31205..e1f6c21 100644
--- a/text_recognizer/data/iam.py
+++ b/text_recognizer/data/iam.py
@@ -4,18 +4,18 @@ Which encompasses both paragraphs and lines, with associated utilities.
"""
import os
-from pathlib import Path
-from typing import Any, Dict, List
import xml.etree.ElementTree as ElementTree
import zipfile
+from pathlib import Path
+from typing import Any, Dict, List
+import toml
from boltons.cacheutils import cachedproperty
from loguru import logger as log
-import toml
+import text_recognizer.metadata.iam as metadata
from text_recognizer.data.base_data_module import BaseDataModule, load_and_print_info
from text_recognizer.data.utils.download_utils import download_dataset
-import text_recognizer.metadata.iam as metadata
class IAM(BaseDataModule):
diff --git a/text_recognizer/data/iam_extended_paragraphs.py b/text_recognizer/data/iam_extended_paragraphs.py
index 3f3500f..3f730ab 100644
--- a/text_recognizer/data/iam_extended_paragraphs.py
+++ b/text_recognizer/data/iam_extended_paragraphs.py
@@ -3,13 +3,13 @@ from typing import Callable, Optional
from torch.utils.data import ConcatDataset
+import text_recognizer.metadata.iam_paragraphs as metadata
from text_recognizer.data.base_data_module import BaseDataModule, load_and_print_info
from text_recognizer.data.iam_paragraphs import IAMParagraphs
from text_recognizer.data.iam_synthetic_paragraphs import IAMSyntheticParagraphs
-from text_recognizer.data.transforms.pad import Pad
from text_recognizer.data.tokenizer import Tokenizer
+from text_recognizer.data.transforms.pad import Pad
from text_recognizer.data.transforms.paragraph import ParagraphStem
-import text_recognizer.metadata.iam_paragraphs as metadata
class IAMExtendedParagraphs(BaseDataModule):
diff --git a/text_recognizer/data/iam_lines.py b/text_recognizer/data/iam_lines.py
index 800e0d7..443386c 100644
--- a/text_recognizer/data/iam_lines.py
+++ b/text_recognizer/data/iam_lines.py
@@ -12,6 +12,7 @@ from loguru import logger as log
from PIL import Image, ImageFile, ImageOps
from torch import Tensor
+import text_recognizer.metadata.iam_lines as metadata
from text_recognizer.data.base_data_module import BaseDataModule, load_and_print_info
from text_recognizer.data.base_dataset import (
BaseDataset,
@@ -22,7 +23,6 @@ from text_recognizer.data.iam import IAM
from text_recognizer.data.tokenizer import Tokenizer
from text_recognizer.data.transforms.line import IamLinesStem
from text_recognizer.data.utils import image_utils
-import text_recognizer.metadata.iam_lines as metadata
ImageFile.LOAD_TRUNCATED_IMAGES = True
diff --git a/text_recognizer/data/iam_paragraphs.py b/text_recognizer/data/iam_paragraphs.py
index 0d53d6b..247b54d 100644
--- a/text_recognizer/data/iam_paragraphs.py
+++ b/text_recognizer/data/iam_paragraphs.py
@@ -9,6 +9,7 @@ from loguru import logger as log
from PIL import Image, ImageOps
from tqdm import tqdm
+import text_recognizer.metadata.iam_paragraphs as metadata
from text_recognizer.data.base_data_module import BaseDataModule, load_and_print_info
from text_recognizer.data.base_dataset import (
BaseDataset,
@@ -16,10 +17,9 @@ from text_recognizer.data.base_dataset import (
split_dataset,
)
from text_recognizer.data.iam import IAM
-from text_recognizer.data.transforms.pad import Pad
from text_recognizer.data.tokenizer import Tokenizer
+from text_recognizer.data.transforms.pad import Pad
from text_recognizer.data.transforms.paragraph import ParagraphStem
-import text_recognizer.metadata.iam_paragraphs as metadata
class IAMParagraphs(BaseDataModule):
diff --git a/text_recognizer/data/iam_synthetic_paragraphs.py b/text_recognizer/data/iam_synthetic_paragraphs.py
index 5743bcc..45d7904 100644
--- a/text_recognizer/data/iam_synthetic_paragraphs.py
+++ b/text_recognizer/data/iam_synthetic_paragraphs.py
@@ -6,23 +6,23 @@ import numpy as np
from loguru import logger as log
from PIL import Image
+import text_recognizer.metadata.iam_synthetic_paragraphs as metadata
from text_recognizer.data.base_data_module import load_and_print_info
from text_recognizer.data.base_dataset import BaseDataset, convert_strings_to_labels
from text_recognizer.data.iam import IAM
-from text_recognizer.data.iam_paragraphs import (
- IAMParagraphs,
- get_dataset_properties,
- resize_image,
-)
from text_recognizer.data.iam_lines import (
line_crops_and_labels,
load_line_crops_and_labels,
save_images_and_labels,
)
+from text_recognizer.data.iam_paragraphs import (
+ IAMParagraphs,
+ get_dataset_properties,
+ resize_image,
+)
from text_recognizer.data.tokenizer import Tokenizer
-from text_recognizer.data.transforms.paragraph import ParagraphStem
from text_recognizer.data.transforms.pad import Pad
-import text_recognizer.metadata.iam_synthetic_paragraphs as metadata
+from text_recognizer.data.transforms.paragraph import ParagraphStem
class IAMSyntheticParagraphs(IAMParagraphs):
diff --git a/text_recognizer/data/transforms/image.py b/text_recognizer/data/transforms/image.py
index f04b3a0..05c9d94 100644
--- a/text_recognizer/data/transforms/image.py
+++ b/text_recognizer/data/transforms/image.py
@@ -1,7 +1,7 @@
-from PIL import Image
import torch
-from torch import Tensor
import torchvision.transforms as T
+from PIL import Image
+from torch import Tensor
class ImageStem:
diff --git a/text_recognizer/data/transforms/line.py b/text_recognizer/data/transforms/line.py
index 6c38213..e4473eb 100644
--- a/text_recognizer/data/transforms/line.py
+++ b/text_recognizer/data/transforms/line.py
@@ -1,8 +1,8 @@
import random
from typing import Any, Dict
-from PIL import Image
import torchvision.transforms as T
+from PIL import Image
import text_recognizer.metadata.iam_lines as metadata
from text_recognizer.data.transforms.image import ImageStem
diff --git a/text_recognizer/data/transforms/paragraph.py b/text_recognizer/data/transforms/paragraph.py
index b364f91..639bb59 100644
--- a/text_recognizer/data/transforms/paragraph.py
+++ b/text_recognizer/data/transforms/paragraph.py
@@ -4,7 +4,6 @@ import torchvision.transforms as T
import text_recognizer.metadata.iam_paragraphs as metadata
from text_recognizer.data.transforms.image import ImageStem
-
IMAGE_HEIGHT, IMAGE_WIDTH = metadata.IMAGE_HEIGHT, metadata.IMAGE_WIDTH
IMAGE_SHAPE = metadata.IMAGE_SHAPE
diff --git a/text_recognizer/data/utils/sentence_generator.py b/text_recognizer/data/utils/sentence_generator.py
index c40373d..8ea345a 100644
--- a/text_recognizer/data/utils/sentence_generator.py
+++ b/text_recognizer/data/utils/sentence_generator.py
@@ -5,8 +5,8 @@ import string
from typing import Optional
import nltk
-from nltk.corpus.reader.util import ConcatenatedCorpusView
import numpy as np
+from nltk.corpus.reader.util import ConcatenatedCorpusView
import text_recognizer.metadata.shared as metadata