diff options
Diffstat (limited to 'src/text_recognizer')
-rw-r--r-- | src/text_recognizer/datasets/util.py | 1 | ||||
-rw-r--r-- | src/text_recognizer/networks/misc.py | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/text_recognizer/datasets/util.py b/src/text_recognizer/datasets/util.py index 321bc67..76bd85f 100644 --- a/src/text_recognizer/datasets/util.py +++ b/src/text_recognizer/datasets/util.py @@ -46,6 +46,7 @@ def fetch_data_loaders( """ def check_dataset_args(args: Dict, split: str) -> Dict: + """Adds train flag to the dataset args.""" args["train"] = True if split == "train" else False return args diff --git a/src/text_recognizer/networks/misc.py b/src/text_recognizer/networks/misc.py index 9440f9d..2fbab8f 100644 --- a/src/text_recognizer/networks/misc.py +++ b/src/text_recognizer/networks/misc.py @@ -21,8 +21,9 @@ def sliding_window( """ unfold = Unfold(kernel_size=patch_size, stride=stride) - patches = unfold(images) + # Preform the slidning window, unsqueeze as the channel dimesion is lost. + patches = unfold(images).unsqueeze(1) patches = rearrange( - patches, "b (h w) c -> b c h w", h=patch_size[0], w=patch_size[1] + patches, "b c (h w) t -> b t c h w", h=patch_size[0], w=patch_size[1] ) return patches |