You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement Dataclass-based Input/Output in Anomalib
Background
Currently, anomalib handles inputs and outputs using dictionaries. While functional, this approach has several drawbacks, including lack of type safety, potential for typos in key names, and reduced code readability. We propose transitioning to a dataclass-based solution to address these issues.
Proposed Change
Replace the current dictionary-based system with a hierarchy of dataclasses:
DatasetItem: Represents a single item in the dataset
Batch: Contains multiple DatasetItem objects
Dataset: Contains multiple Batch objects
Example Transformation
For example, current approach in a video dataset is as follow: Same will be applied to other modalities.
samet-akcay
changed the title
Feature: Implement Dataclass-based Input/Output in Anomalib
Feature: Dataclass-based Input/Output in Anomalib
Aug 19, 2024
Implement Dataclass-based Input/Output in Anomalib
Background
Currently, anomalib handles inputs and outputs using dictionaries. While functional, this approach has several drawbacks, including lack of type safety, potential for typos in key names, and reduced code readability. We propose transitioning to a dataclass-based solution to address these issues.
Proposed Change
Replace the current dictionary-based system with a hierarchy of dataclasses:
DatasetItem
: Represents a single item in the datasetBatch
: Contains multipleDatasetItem
objectsDataset
: Contains multipleBatch
objectsExample Transformation
For example, current approach in a video dataset is as follow: Same will be applied to other modalities.
Proposed approach:
Benefits
Implementation Steps
DatasetItem
,Batch
,Dataset
).Potential Challenges
Discussion Points
__post_init__
methods for validation?Next Steps
The text was updated successfully, but these errors were encountered: