anomalib.data.utils.split¶
Dataset Split Utils.
This module contains function in regards to splitting normal images in training set, and creating validation sets from test sets.
- These function are useful
when the test set does not contain any normal images.
when the dataset doesn’t have a validation set.
Module Contents¶
Functions¶
Split normal images in train set. |
|
Craete Validation Set from Test Set. |
- anomalib.data.utils.split.split_normal_images_in_train_set(samples: pandas.core.frame.DataFrame, split_ratio: float = 0.1, seed: Optional[int] = None, normal_label: str = 'good') pandas.core.frame.DataFrame[source]¶
Split normal images in train set.
This function splits the normal images in training set and assigns the values to the test set. This is particularly useful especially when the test set does not contain any normal images.
This is important because when the test set doesn’t have any normal images, AUC computation fails due to having single class.
- Parameters
samples (DataFrame) – Dataframe containing dataset info such as filenames, splits etc.
split_ratio (float, optional) – Train-Test normal image split ratio. Defaults to 0.1.
seed (int, optional) – Random seed to ensure reproducibility. Defaults to 0.
normal_label (str) – Name of the normal label. For MVTec AD, for instance, this is normal_label.
- Returns
Output dataframe where the part of the training set is assigned to test set.
- Return type
DataFrame
- anomalib.data.utils.split.create_validation_set_from_test_set(samples: pandas.core.frame.DataFrame, seed: Optional[int] = None, normal_label: str = 'good') pandas.core.frame.DataFrame[source]¶
Craete Validation Set from Test Set.
This function creates a validation set from test set by splitting both normal and abnormal samples to two.
- Parameters
samples (DataFrame) – Dataframe containing dataset info such as filenames, splits etc.
seed (int, optional) – Random seed to ensure reproducibility. Defaults to 0.
normal_label (str) – Name of the normal label. For MVTec AD, for instance, this is normal_label.