From 9b8e14d89f0ef2508ed11f994f73af624155fe1d Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 27 Sep 2022 01:44:49 +0200 Subject: Update data modules --- .../conf/datamodule/iam_extended_paragraphs.yaml | 13 +++++++--- training/conf/datamodule/iam_lines.yaml | 8 ++++-- training/conf/datamodule/target_transform/pad.yaml | 4 --- .../conf/datamodule/test_transform/default.yaml | 2 -- training/conf/datamodule/test_transform/lines.yaml | 6 ----- .../conf/datamodule/test_transform/paragraphs.yaml | 6 ----- training/conf/datamodule/transform/default.yaml | 2 -- .../conf/datamodule/transform/emnist_lines.yaml | 14 ---------- training/conf/datamodule/transform/lines.yaml | 23 ----------------- training/conf/datamodule/transform/paragraphs.yaml | 30 ---------------------- 10 files changed, 16 insertions(+), 92 deletions(-) delete mode 100644 training/conf/datamodule/target_transform/pad.yaml delete mode 100644 training/conf/datamodule/test_transform/default.yaml delete mode 100644 training/conf/datamodule/test_transform/lines.yaml delete mode 100644 training/conf/datamodule/test_transform/paragraphs.yaml delete mode 100644 training/conf/datamodule/transform/default.yaml delete mode 100644 training/conf/datamodule/transform/emnist_lines.yaml delete mode 100644 training/conf/datamodule/transform/lines.yaml delete mode 100644 training/conf/datamodule/transform/paragraphs.yaml (limited to 'training') diff --git a/training/conf/datamodule/iam_extended_paragraphs.yaml b/training/conf/datamodule/iam_extended_paragraphs.yaml index 0921b25..c46714c 100644 --- a/training/conf/datamodule/iam_extended_paragraphs.yaml +++ b/training/conf/datamodule/iam_extended_paragraphs.yaml @@ -3,9 +3,16 @@ batch_size: 4 num_workers: 12 train_fraction: 0.8 pin_memory: true -transform: transform/paragraphs.yaml -test_transform: test_transform/paragraphs.yaml -target_transform: target_transform/pad.yaml +transform: + _target_: text_recognizer.data.stems.paragraph.ParagraphStem + augment: true +test_transform: + _target_: text_recognizer.data.stems.paragraph.ParagraphStem + augment: false +target_transform: + _target_: text_recognizer.data.transforms.pad.Pad + max_len: 682 + pad_index: 3 mapping: _target_: text_recognizer.data.mappings.EmnistMapping extra_symbols: ["\n"] diff --git a/training/conf/datamodule/iam_lines.yaml b/training/conf/datamodule/iam_lines.yaml index 85a023b..4f1f1b8 100644 --- a/training/conf/datamodule/iam_lines.yaml +++ b/training/conf/datamodule/iam_lines.yaml @@ -3,7 +3,11 @@ batch_size: 8 num_workers: 12 train_fraction: 0.9 pin_memory: true -transform: transform/lines.yaml -test_transform: test_transform/lines.yaml +transform: + _target_: text_recognizer.data.stems.line.IamLinesStem + augment: true +test_transform: + _target_: text_recognizer.data.stems.line.IamLinesStem + augment: false mapping: _target_: text_recognizer.data.mappings.EmnistMapping diff --git a/training/conf/datamodule/target_transform/pad.yaml b/training/conf/datamodule/target_transform/pad.yaml deleted file mode 100644 index 854c24c..0000000 --- a/training/conf/datamodule/target_transform/pad.yaml +++ /dev/null @@ -1,4 +0,0 @@ -pad: - _target_: text_recognizer.data.transforms.pad.Pad - max_len: 682 - pad_index: 3 diff --git a/training/conf/datamodule/test_transform/default.yaml b/training/conf/datamodule/test_transform/default.yaml deleted file mode 100644 index d6f6d78..0000000 --- a/training/conf/datamodule/test_transform/default.yaml +++ /dev/null @@ -1,2 +0,0 @@ -to_tensor: - _target_: torchvision.transforms.ToTensor diff --git a/training/conf/datamodule/test_transform/lines.yaml b/training/conf/datamodule/test_transform/lines.yaml deleted file mode 100644 index a14ec82..0000000 --- a/training/conf/datamodule/test_transform/lines.yaml +++ /dev/null @@ -1,6 +0,0 @@ -embed_crop: - _target_: text_recognizer.data.transforms.embed_crop.EmbedCrop - augment: true - -to_tensor: - _target_: torchvision.transforms.ToTensor diff --git a/training/conf/datamodule/test_transform/paragraphs.yaml b/training/conf/datamodule/test_transform/paragraphs.yaml deleted file mode 100644 index a69eae9..0000000 --- a/training/conf/datamodule/test_transform/paragraphs.yaml +++ /dev/null @@ -1,6 +0,0 @@ -center_crop: - _target_: torchvision.transforms.CenterCrop - size: [576, 640] - -to_tensor: - _target_: torchvision.transforms.ToTensor diff --git a/training/conf/datamodule/transform/default.yaml b/training/conf/datamodule/transform/default.yaml deleted file mode 100644 index d6f6d78..0000000 --- a/training/conf/datamodule/transform/default.yaml +++ /dev/null @@ -1,2 +0,0 @@ -to_tensor: - _target_: torchvision.transforms.ToTensor diff --git a/training/conf/datamodule/transform/emnist_lines.yaml b/training/conf/datamodule/transform/emnist_lines.yaml deleted file mode 100644 index 986ba20..0000000 --- a/training/conf/datamodule/transform/emnist_lines.yaml +++ /dev/null @@ -1,14 +0,0 @@ -to_tensor: - _target_: torchvision.transforms.ToTensor - -color_jitter: - _target_: torchvision.transforms.ColorJitter - brightness: [0.5, 1.0] - -random_affine: - _target_: torchvision.transforms.RandomAffine - degrees: 3 - translate: [0.0, 0.05] - scale: [0.4, 1.1] - shear: [-40, 50] - fill: 0 diff --git a/training/conf/datamodule/transform/lines.yaml b/training/conf/datamodule/transform/lines.yaml deleted file mode 100644 index 6bd35ef..0000000 --- a/training/conf/datamodule/transform/lines.yaml +++ /dev/null @@ -1,23 +0,0 @@ -embed_crop: - _target_: text_recognizer.data.transforms.embed_crop.EmbedCrop - augment: false - -color_jitter: - _target_: torchvision.transforms.ColorJitter - brightness: [0.8, 1.6] - -random_affine: - _target_: torchvision.transforms.RandomAffine - degrees: 1 - shear: [-10, 10] - interpolation: BILINEAR - fill: 0 - -random_perspective: - _target_: torchvision.transforms.RandomPerspective - distortion_scale: 0.05 - p: 0.25 - fill: 0 - -to_tensor: - _target_: torchvision.transforms.ToTensor diff --git a/training/conf/datamodule/transform/paragraphs.yaml b/training/conf/datamodule/transform/paragraphs.yaml deleted file mode 100644 index 4f260d0..0000000 --- a/training/conf/datamodule/transform/paragraphs.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# random_crop: -# _target_: torchvision.transforms.RandomCrop -# size: [576, 640] -# padding: null -# pad_if_needed: true -# fill: 0 -# padding_mode: constant - -center_crop: - _target_: torchvision.transforms.CenterCrop - size: [576, 640] - -color_jitter: - _target_: torchvision.transforms.ColorJitter - brightness: [0.8, 1.6] - -random_affine: - _target_: torchvision.transforms.RandomAffine - degrees: 1 - shear: [-5, 5] - interpolation: BILINEAR - -random_perspective: - _target_: torchvision.transforms.RandomPerspective - distortion_scale: 0.05 - p: 0.25 - fill: 0 - -to_tensor: - _target_: torchvision.transforms.ToTensor -- cgit v1.2.3-70-g09d2