Skip to content
Snippets Groups Projects
Verified Commit 55698f0c authored by Mélodie's avatar Mélodie Committed by Mélodie Boillet
Browse files

Load images using Torch

parent 3dfe694e
No related branches found
No related tags found
1 merge request!224Fix version 0.2.0-dev3 and later
This commit is part of merge request !224. Comments created here will be created in the context of that merge request.
......@@ -244,7 +244,10 @@ class OCRCollateFunction:
labels = [batch_data[i]["token_label"] for i in range(len(batch_data))]
labels = pad_sequences_1D(labels, padding_value=self.label_padding_value).long()
imgs = [batch_data[i]["img"] for i in range(len(batch_data))]
imgs = [
torch.from_numpy(batch_data[i]["img"]).permute(2, 0, 1)
for i in range(len(batch_data))
]
imgs = pad_images(imgs)
formatted_batch_data = {
......
......@@ -11,7 +11,6 @@ from albumentations.augmentations import (
Affine,
CoarseDropout,
ColorJitter,
Downscale,
ElasticTransform,
GaussianBlur,
GaussNoise,
......@@ -226,11 +225,7 @@ def get_augmentation_transforms() -> SomeOf:
Downscale(scale_min=0.5, scale_max=0.9, interpolation=INTER_NEAREST),
ToGray(),
],
n=2,
p=0.9,
)
],
p=0.9
)
......
......@@ -107,7 +107,7 @@ This page lists data augmentation transforms used in DAN.
| Examples | ![](../../assets/augmentations/line_dropout.png) ![](../../assets/augmentations/document_dropout.png) |
| CPU time (seconds/10 images) | 0.02 (3013x128 pixels) / 0.02 (1116x581 pixels) |
### Downscale
### DPIAdjusting
| | Downscale |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
......@@ -117,7 +117,7 @@ This page lists data augmentation transforms used in DAN.
| Examples | ![](../../assets/augmentations/line_downscale.png) ![](../../assets/augmentations/document_downscale.png) |
| CPU time (seconds/10 images) | 0.03 (3013x128 pixels) / 0.03 (1116x581 pixels) |
### Grayscale
### ToGray
| | Grayscale |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment