eurocropsml.dataset.splits.split_dataset_by_classΒΆ
- split_dataset_by_class(data_dir: Path, split_dir: Path, satellite: list[Literal['S1', 'S2']], year: str, num_samples: dict[str, str | int | list[int | str]], seed: int, pretrain_classes: set[int], finetune_classes: set[int] | None = None, meadow_class: int | None = None, test_size: float = 0.2) NoneΒΆ
Split dataset by classes.
- Parameters:
data_dir β Path that contains .npy files where labels and data are stored.
split_dir β Directory where splits are going to be saved to.
satellite β Whether to build the splits using Sentinel-1 or Sentinel-2 or both.
year β Year for which data are to be processed.
num_samples β Number of samples to sample for finetuning.
seed β Random seed for data split.
pretrain_classes β List with classes used for filtering the data.
finetune_classes β List with classes used for filtering the data.
meadow_class β Meadow class identifier. If specified, for the pre-training split, the meadow class will be downsampled to the median frequency of all other classes If None, no downsampling is taking place.
test_size β Amount of data used for validation (test set). Defaults to 0.2.
- Raises:
Exception β If there are similar samples within pretrain and finetune data-split.