datamodules.RolfFormat.datasets package
Submodules
datamodules.RolfFormat.datasets.dataset module
Load a dataset of historic documents by specifying the folder where its located.
- class DatasetRolfFormat(dataset_specs: List[DatasetSpecs], image_dims: ImageDimensions, is_test: bool = False, image_transform: Optional[callable] = None, target_transform: Optional[callable] = None, twin_transform: Optional[callable] = None)[source]
Bases:
Dataset
Dataset that loads the data in the Rolf format. Each file name has a fixed structure of name_{file_number}.jpg. The file number is a number between 0 and 9999. The different splits are defined by giving a range and a root folder for each split.
- Parameters:
dataset_specs (List[DatasetSpecs]) – The dataset specs that specify the location of the data and ground truth files.
image_dims (ImageDimensions) – The dimensions of the images.
is_test (bool) – Is it the test dataset?
image_transform (callable) – Transformations that should be applied to the image.
target_transform (callable) – Transformations that should be applied to the ground truth.
twin_transform (callable) – Transformations that should be applied to both the image and the ground truth.
- static get_img_gt_path_list(list_specs: List[DatasetSpecs]) List[Tuple[Path, Path]] [source]
Returns a list of tuples that contain the path to the gt and image that belong together.
- Parameters:
list_specs (List[DatasetSpecs]) – The dataset specs that specify the location of the data and ground truth files.
- Returns:
A list of tuples that contain the path to the gt and image that belong together.
- Return type:
List[Tuple[Path, Path]]
- class DatasetSpecs(data_root: str, doc_dir: str, doc_names: str, gt_dir: str, gt_names: str, range_from: int, range_to: int)[source]
Bases:
object
This class is used to specify the location of the data and ground truth files. It can also be used to specify a range of files that should be used. This is useful if you want to split the data into train/val/test and want to use the same data root for all three splits.
- data_root: str
- doc_dir: str
- doc_names: str
- gt_dir: str
- gt_names: str
- range_from: int
- range_to: int