Skip to content

Commit

Permalink
📚 Add docstrings to dataclasses (#2292)
Browse files Browse the repository at this point in the history
* Reduce rich methods (#2283)

remove rich

Signed-off-by: Ashwin Vaidya <[email protected]>

* Refactor BaseThreshold to Threshold (#2278)

* Refactor BaseThreshold to Threshold

* Add relative import and add tests

Signed-off-by: Samet Akcay <[email protected]>

* Revert threshold.py to base.py

Signed-off-by: Samet Akcay <[email protected]>

* Revert threshold imports

Signed-off-by: Samet Akcay <[email protected]>

* Update tests/unit/metrics/threshold/test_threshold.py

Co-authored-by: Ashwin Vaidya <[email protected]>

---------

Signed-off-by: Samet Akcay <[email protected]>
Co-authored-by: Ashwin Vaidya <[email protected]>

* Enable Ruff Rules: PLW1514 and PLR6201 (#2284)

* pre-commit autoupdate

Signed-off-by: Samet Akcay <[email protected]>

* Enable preview feautures, and disable some of the updated features

* Add missing copyrights

Signed-off-by: Samet Akcay <[email protected]>

* Ignore copyrights in notebooks

* "PLW1514", # Add explicit encoding argument

Signed-off-by: Samet Akcay <[email protected]>

* "PLR6201", # Convert to set

Signed-off-by: Samet Akcay <[email protected]>

---------

Signed-off-by: Samet Akcay <[email protected]>

* Update docstring - FieldDescriptor

* Add docstring to generic.py

Signed-off-by: Samet Akcay <[email protected]>

* Add docstring to numpy.py

Signed-off-by: Samet Akcay <[email protected]>

* Add docstring to torch.py

Signed-off-by: Samet Akcay <[email protected]>

* Update src/anomalib/dataclasses/torch.py

Co-authored-by: Dick Ameln <[email protected]>

* Update src/anomalib/dataclasses/torch.py

Co-authored-by: Dick Ameln <[email protected]>

* Update src/anomalib/dataclasses/generic.py

Co-authored-by: Dick Ameln <[email protected]>

* Update src/anomalib/dataclasses/torch.py

Co-authored-by: Dick Ameln <[email protected]>

* Update src/anomalib/dataclasses/torch.py

Co-authored-by: Dick Ameln <[email protected]>

* Update src/anomalib/dataclasses/torch.py

Co-authored-by: Dick Ameln <[email protected]>

* Update src/anomalib/dataclasses/torch.py

Co-authored-by: Dick Ameln <[email protected]>

* Update src/anomalib/dataclasses/torch.py

Co-authored-by: Ashwin Vaidya <[email protected]>

---------

Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Co-authored-by: Ashwin Vaidya <[email protected]>
Co-authored-by: Ashwin Vaidya <[email protected]>
Co-authored-by: Dick Ameln <[email protected]>
  • Loading branch information
4 people committed Sep 12, 2024
1 parent ec5a877 commit 1500db6
Show file tree
Hide file tree
Showing 4 changed files with 691 additions and 75 deletions.
33 changes: 32 additions & 1 deletion src/anomalib/dataclasses/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
"""Anomalib dataclasses."""
"""Anomalib dataclasses.
This module provides a collection of dataclasses used throughout the Anomalib library
for representing and managing various types of data related to anomaly detection tasks.
The dataclasses are organized into two main categories:
1. Numpy-based dataclasses for handling numpy array data.
2. Torch-based dataclasses for handling PyTorch tensor data.
Key components:
Numpy Dataclasses:
``NumpyImageItem``: Represents a single image item as numpy arrays.
``NumpyImageBatch``: Represents a batch of image data as numpy arrays.
``NumpyVideoItem``: Represents a single video item as numpy arrays.
``NumpyVideoBatch``: Represents a batch of video data as numpy arrays.
Torch Dataclasses:
``Batch``: Base class for torch-based batch data.
``DatasetItem``: Base class for torch-based dataset items.
``DepthItem``: Represents a single depth data item.
``DepthBatch``: Represents a batch of depth data.
``ImageItem``: Represents a single image item as torch tensors.
``ImageBatch``: Represents a batch of image data as torch tensors.
``VideoItem``: Represents a single video item as torch tensors.
``VideoBatch``: Represents a batch of video data as torch tensors.
``InferenceBatch``: Specialized batch class for inference results.
These dataclasses provide a structured way to handle various types of data
in anomaly detection tasks, ensuring type consistency and easy data manipulation
across different components of the Anomalib library.
"""

# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
Expand Down
Loading

0 comments on commit 1500db6

Please sign in to comment.