-
Notifications
You must be signed in to change notification settings - Fork 825
🚀 feat(data): add backward compatibility methods and update docstring examples #2950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
samet-akcay
merged 18 commits into
open-edge-platform:main
from
samet-akcay:docs/data/add-backward-compatibility
Sep 15, 2025
Merged
🚀 feat(data): add backward compatibility methods and update docstring examples #2950
samet-akcay
merged 18 commits into
open-edge-platform:main
from
samet-akcay:docs/data/add-backward-compatibility
Sep 15, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…base This commit updates various DataLoader instances in the project to enable the option, enhancing performance for data loading on GPU. Changes were made in the following files: - : Updated train and test DataLoader configurations. - : Modified datamodule DataLoader to include . - : Added to evaluation DataLoader. - : Updated DataLoader for datasets to utilize . - : Enabled for reference dataset DataLoader. - : Adjusted inference DataLoader to include . These changes aim to optimize memory usage and improve data transfer speeds during model training and inference. Signed-off-by: samet-akcay <samet.akcay@intel.com>
This commit refactors the function in to utilize a dictionary mapping for decoder architectures, improving readability and maintainability. The previous conditional checks have been replaced with a more efficient approach, enhancing the overall structure of the code. Signed-off-by: samet-akcay <samet.akcay@intel.com>
…nsistency This commit modifies the initialization of the logit_scale parameter in the CLIP model to utilize torch.log instead of np.log. This change ensures consistency in tensor operations and improves compatibility with PyTorch's computation graph. Signed-off-by: samet-akcay <samet.akcay@intel.com>
…lculations This commit modifies the anomaly map generation logic to utilize PyTorch tensors instead of NumPy arrays for various calculations. This change enhances compatibility with the PyTorch computation graph and improves performance by leveraging GPU acceleration. Key updates include the conversion of statistical calculations and tensor operations to use PyTorch functions, ensuring consistency in tensor handling throughout the code. Signed-off-by: samet-akcay <samet.akcay@intel.com>
…istical calculations This commit refactors the anomaly map generation logic to replace NumPy-based statistical calculations with PyTorch equivalents, specifically using the distribution for computing tau. Additionally, it improves precision handling by allowing the use of float64 in high precision mode. The changes streamline the computation process and maintain compatibility with the PyTorch computation graph. Signed-off-by: samet-akcay <samet.akcay@intel.com>
Signed-off-by: samet-akcay <samet.akcay@intel.com>
This commit improves the URL validation in the download function to ensure only http and https schemes are allowed. Additionally, it adds comments to clarify the safety of using under these conditions, enhancing code readability and security awareness. Signed-off-by: samet-akcay <samet.akcay@intel.com>
…Batch classes This commit updates the copyright year in the Numpy and Torch base files to reflect 2024-2025. Additionally, it introduces a new `keys` method in both the `NumpyBatch` and `Batch` classes, allowing users to retrieve field names with an option to include or exclude fields with None values. The `__getitem__` method is also added to enable dictionary-like access to field values. Signed-off-by: [Your Name] <[Your Email]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! two super minor comments
This commit updates the ImageVisualizer class to handle dataset name and category attributes more robustly by using None as the default value instead of empty strings. This change enhances clarity and ensures that the filename generation logic remains consistent when these attributes are not present. Signed-off-by: Samet Akcay samet.akcay@intel.com
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This commit refactors the ImageVisualizer class by renaming the `visualize_image` method to `visualize`, streamlining the interface for users. The updated method signature and examples in the docstring reflect this change, ensuring consistency in how predictions are visualized. Additionally, the copyright year has been updated to 2024-2025. Signed-off-by: Samet Akcay <samet.akcay@intel.com>
…et-akcay/anomalib into docs/data/add-backward-compatibility
ashwinvaidya17
approved these changes
Sep 15, 2025
rajeshgangireddy
approved these changes
Sep 15, 2025
alexriedel1
pushed a commit
to alexriedel1/anomalib
that referenced
this pull request
Oct 6, 2025
… examples (open-edge-platform#2950) * fix(data): enable pin_memory for DataLoader instances across the codebase This commit updates various DataLoader instances in the project to enable the option, enhancing performance for data loading on GPU. Changes were made in the following files: - : Updated train and test DataLoader configurations. - : Modified datamodule DataLoader to include . - : Added to evaluation DataLoader. - : Updated DataLoader for datasets to utilize . - : Enabled for reference dataset DataLoader. - : Adjusted inference DataLoader to include . These changes aim to optimize memory usage and improve data transfer speeds during model training and inference. Signed-off-by: samet-akcay <samet.akcay@intel.com> * refactor(models): streamline decoder retrieval in function This commit refactors the function in to utilize a dictionary mapping for decoder architectures, improving readability and maintainability. The previous conditional checks have been replaced with a more efficient approach, enhancing the overall structure of the code. Signed-off-by: samet-akcay <samet.akcay@intel.com> * fix(model): update logit_scale initialization to use torch.log for consistency This commit modifies the initialization of the logit_scale parameter in the CLIP model to utilize torch.log instead of np.log. This change ensures consistency in tensor operations and improves compatibility with PyTorch's computation graph. Signed-off-by: samet-akcay <samet.akcay@intel.com> * fix(model): update anomaly map generation to use torch tensors for calculations This commit modifies the anomaly map generation logic to utilize PyTorch tensors instead of NumPy arrays for various calculations. This change enhances compatibility with the PyTorch computation graph and improves performance by leveraging GPU acceleration. Key updates include the conversion of statistical calculations and tensor operations to use PyTorch functions, ensuring consistency in tensor handling throughout the code. Signed-off-by: samet-akcay <samet.akcay@intel.com> * refactor(model): enhance anomaly map generation with PyTorch for statistical calculations This commit refactors the anomaly map generation logic to replace NumPy-based statistical calculations with PyTorch equivalents, specifically using the distribution for computing tau. Additionally, it improves precision handling by allowing the use of float64 in high precision mode. The changes streamline the computation process and maintain compatibility with the PyTorch computation graph. Signed-off-by: samet-akcay <samet.akcay@intel.com> * chore(license): update license year Signed-off-by: samet-akcay <samet.akcay@intel.com> * fix(download): enhance URL validation and update download logic This commit improves the URL validation in the download function to ensure only http and https schemes are allowed. Additionally, it adds comments to clarify the safety of using under these conditions, enhancing code readability and security awareness. Signed-off-by: samet-akcay <samet.akcay@intel.com> * 🔧 chore: update copyright year and add keys method to NumpyBatch and Batch classes This commit updates the copyright year in the Numpy and Torch base files to reflect 2024-2025. Additionally, it introduces a new `keys` method in both the `NumpyBatch` and `Batch` classes, allowing users to retrieve field names with an option to include or exclude fields with None values. The `__getitem__` method is also added to enable dictionary-like access to field values. Signed-off-by: [Your Name] <[Your Email]> * fix mypy Signed-off-by: samet-akcay <samet.akcay@intel.com> * refactor: improve dataset name and category handling in ImageVisualizer This commit updates the ImageVisualizer class to handle dataset name and category attributes more robustly by using None as the default value instead of empty strings. This change enhances clarity and ensures that the filename generation logic remains consistent when these attributes are not present. Signed-off-by: Samet Akcay samet.akcay@intel.com * refactor: unify visualization method naming in ImageVisualizer This commit refactors the ImageVisualizer class by renaming the `visualize_image` method to `visualize`, streamlining the interface for users. The updated method signature and examples in the docstring reflect this change, ensuring consistency in how predictions are visualized. Additionally, the copyright year has been updated to 2024-2025. Signed-off-by: Samet Akcay <samet.akcay@intel.com> --------- Signed-off-by: samet-akcay <samet.akcay@intel.com> Signed-off-by: [Your Name] <[Your Email]> Signed-off-by: Samet Akcay samet.akcay@intel.com Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Description
keys()
and__getitem__()
toNumpyBatch
andBatch
dataclasses to provide dictionary-like access to batch fieldsData Classes Changes
keys(include_none: bool = True) -> list[str]
method to bothNumpyBatch
andBatch
classes__getitem__(key: str) -> Any
method to both classes for dictionary-like accessNumpyBatch
andBatch
instead of generic names)Visualization Changes
ImageVisualizer
with additional methods and improved error handlingBackward Compatibility
✨ Changes
Select what type of change your PR is:
✅ Checklist
Before you submit your pull request, please make sure you have completed the following steps:
For more information about code review checklists, see the Code Review Checklist.