AnomalyDetectionDataset
anomaly_match.datasets.AnomalyDetectionDataset
¶
Main dataset class for anomaly detection with labeled and unlabeled data.
AnomalyDetectionDataset(cfg, data_source=None, labeled_cache_path=None)
¶
Dataset for binary classification of normal vs anomaly images.
Handles labeled/unlabeled data management, train/test splitting, and
label updates. Image loading is delegated to a TrainingDataSource.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
DotMap
|
Configuration object containing dataset parameters. |
required |
data_source
|
TrainingDataSource | None
|
Optional data source for loading images. If |
None
|
labeled_cache_path
|
str | None
|
Optional path to a |
None
|
Source code in anomaly_match/datasets/AnomalyDetectionDataset.py
unlabeled_filepaths
property
¶
Return unlabeled filepaths.
unlabeled_filenames
property
¶
Return unlabeled filenames.
unlabeled
property
¶
Return unlabeled data in format [[imgs],[filenames]].
train_data
property
¶
Return training data in format [[filenames],[imgs],[labels]].
test_data
property
¶
Return testing data in format [[filenames],[imgs],[labels]].
update_labels(new_labels_df)
¶
Update the dataset with new labels for previously unlabeled images.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_labels_df
|
DataFrame
|
DataFrame with an |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an invalid label is encountered. |
Source code in anomaly_match/datasets/AnomalyDetectionDataset.py
get_metadata_for_file(filename)
¶
Get metadata for a specific file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The filename to get metadata for. |
required |
Returns:
| Type | Description |
|---|---|
dict | None
|
Metadata for the file, or None if not found. |
Source code in anomaly_match/datasets/AnomalyDetectionDataset.py
get_all_metadata()
¶
Get all metadata.
Returns:
| Type | Description |
|---|---|
DataFrame | None
|
The full metadata DataFrame, or None if no metadata loaded. |