Skip to content
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

🔨 v2 - Refactor: Add missing auxiliary attributes to AnomalibModule #2460

Conversation

samet-akcay
Copy link
Contributor

@samet-akcay samet-akcay commented Dec 9, 2024

📝 Description

This pull request introduces enhancements to the AnomalibModule and Engine classes within the Anomalib library. The changes standardize the component configuration pattern across pre-processors, post-processors, evaluators, and visualizers, with a particular focus on refactoring the post-processor implementation.

✨ Changes

  1. Post-Processor Refactoring:

    • Added _resolve_post_processor method to standardize post-processor configuration
    • Introduced configure_post_processor classmethod to provide default post-processor setup
    • Implemented learning-type-based post-processor configuration (e.g., OneClassPostProcessor for one-class learning)
    • Added type validation and error handling for post-processor configuration
  2. Component Configuration Pattern:

    • Standardized the configuration pattern across all components using resolve/configure methods:
      _resolve_<component>: Handles type validation and resolution
      configure_<component>: Provides default configuration
    • Updated configure_callbacks to handle all components uniformly
    • Components now support three configuration modes:
      • True: Use default configuration
      • False: Disable the component
      • Component instance: Use provided configuration
  3. Documentation and Type Hints:

    • Added comprehensive docstrings with usage examples

Select what type of change your PR is:

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🔨 Refactor (non-breaking change which refactors the code base)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔒 Security update

✅ Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • 📋 I have summarized my changes in the CHANGELOG and followed the guidelines for my type of change (skip for minor changes, documentation updates, and test enhancements).
  • 📚 I have made the necessary updates to the documentation (if applicable).
  • 🧪 I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).

For more information about code review checklists, see the Code Review Checklist.

Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
…lly include available callbacks (pre-processor, post-processor, evaluator, visualizer) based on their existence. Update docstring for clarity on return values.
…or and metrics callbacks. Simplify callback configuration to streamline the process and enhance maintainability.
@samet-akcay samet-akcay changed the title Add missing auxil 🔨 v2 - Refactor: Add missing auxiliary attributes to AnomalibModule Dec 9, 2024
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 10 lines in your changes missing coverage. Please review.

Please upload report for BASE (release/v2.0.0@8bd06a9). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...anomalib/models/components/base/anomalib_module.py 70.58% 10 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/v2.0.0    #2460   +/-   ##
=================================================
  Coverage                  ?   78.41%           
=================================================
  Files                     ?      303           
  Lines                     ?    12974           
  Branches                  ?        0           
=================================================
  Hits                      ?    10173           
  Misses                    ?     2801           
  Partials                  ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Samet Akcay <samet.akcay@intel.com>
@samet-akcay samet-akcay merged commit c235ca1 into openvinotoolkit:release/v2.0.0 Dec 11, 2024
7 checks passed
@samet-akcay samet-akcay deleted the add-missing-aux-components branch December 11, 2024 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants