brain_pipe.dataloaders.path.GlobLoader¶
- class GlobLoader(glob_patterns, filter_fns=(), glob_fn=<function iglob>, key='path', chain=<built-in function all>, has_length=True)¶
Bases:
DataLoader
Simple dataloader that loads data based on a glob pattern.
- __init__(glob_patterns, filter_fns=(), glob_fn=<function iglob>, key='path', chain=<built-in function all>, has_length=True)¶
Initialize the GlobLoader.
- Parameters:
glob_patterns (List[str]) – The glob patterns to use for loading the data.
filter_fns (Sequence[Callable[[str], bool]]) – A sequence of functions that return True if the file should be included.
glob_fn (Callable[[str], Sequence[str]]) – The function to use for globbing.
key (str) – The key to use for the data_dict.
chain (Callable[[Sequence[bool]], bool]) – The function to use for chaining the filter functions.
Methods
__init__
(glob_patterns[, filter_fns, ...])Initialize the GlobLoader.
Compute the length of the DataLoader.
path_to_data_dict
(path)Convert a path to a data_dict.
- compute_length()¶
Compute the length of the DataLoader.
- Returns:
The length of the DataLoader.
- Return type:
Notes
This function will be added as the __len__ method if
has_length
is True. You can override this func