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

Add PIMO #2329

Merged
merged 12 commits into from
Oct 2, 2024
Merged

Add PIMO #2329

merged 12 commits into from
Oct 2, 2024

Conversation

ashwinvaidya17
Copy link
Collaborator

πŸ“ Description

✨ Changes

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.

jpcbertoldo and others added 6 commits September 20, 2024 10:18
* update

Signed-off-by: jpcbertoldo <[email protected]>

* test binclf curves numpy and numba and fixes

Signed-off-by: jpcbertoldo <[email protected]>

* correct som docstrings

Signed-off-by: jpcbertoldo <[email protected]>

* torch interface and tests

Signed-off-by: jpcbertoldo <[email protected]>

* torch interface and tests

Signed-off-by: jpcbertoldo <[email protected]>

* constants regrouped in dataclass as class vars

Signed-off-by: jpcbertoldo <[email protected]>

* result class was unneccesary for per_image_binclf_curve

Signed-off-by: jpcbertoldo <[email protected]>

* factorize function _get_threshs_minmax_linspace

Signed-off-by: jpcbertoldo <[email protected]>

* small docs fixes

Signed-off-by: jpcbertoldo <[email protected]>

* add pimo numpy version and test

Signed-off-by: jpcbertoldo <[email protected]>

* move validation

Signed-off-by: jpcbertoldo <[email protected]>

* add `shared_fpr_metric` option

Signed-off-by: jpcbertoldo <[email protected]>

* add pimo torch functional version and test

Signed-off-by: jpcbertoldo <[email protected]>

* add torchmetrics interface and test

Signed-off-by: jpcbertoldo <[email protected]>

* renames and put things in init

Signed-off-by: jpcbertoldo <[email protected]>

* validate inputs in result objects

Signed-off-by: jpcbertoldo <[email protected]>

* result objects to from dict and tests

Signed-off-by: jpcbertoldo <[email protected]>

* add save and load methods to result objects and test

Signed-off-by: jpcbertoldo <[email protected]>

* refactor validations and minor changes

Signed-off-by: jpcbertoldo <[email protected]>

* test result objects' properties

Signed-off-by: jpcbertoldo <[email protected]>

* minor refactors

Signed-off-by: jpcbertoldo <[email protected]>

* add missing docstrings

Signed-off-by: jpcbertoldo <[email protected]>

* minore vocabulary fix for consistency

Signed-off-by: jpcbertoldo <[email protected]>

* add per image scores statistics and test it

Signed-off-by: jpcbertoldo <[email protected]>

* refactor constants notation

Signed-off-by: jpcbertoldo <[email protected]>

* add stats tests and test it

Signed-off-by: jpcbertoldo <[email protected]>

* change the meaning of AUPIMO.num_thresh

Signed-off-by: jpcbertoldo <[email protected]>

* interface to format pairwise test results

Signed-off-by: jpcbertoldo <[email protected]>

* improve doc

Signed-off-by: jpcbertoldo <[email protected]>

* add optional `paths` to result objects and some minor fixes and refactors

Signed-off-by: jpcbertoldo <[email protected]>

* remove frozen from dataclasses and some done todos

Signed-off-by: jpcbertoldo <[email protected]>

* review headers

Signed-off-by: jpcbertoldo <[email protected]>

* doc modifs

Signed-off-by: jpcbertoldo <[email protected]>

* refactor `score_less_than_thresh` in `_binclf_one_curve_python`

Signed-off-by: jpcbertoldo <[email protected]>

* correct license comments

Signed-off-by: jpcbertoldo <[email protected]>

* fix doc

Signed-off-by: jpcbertoldo <[email protected]>

* numba as extra requirement

Signed-off-by: jpcbertoldo <[email protected]>

* refactor copyrights from jpcbertoldo

Signed-off-by: jpcbertoldo <[email protected]>

* remove from __future__ import annotations

Signed-off-by: jpcbertoldo <[email protected]>

* refactor validations names

Signed-off-by: jpcbertoldo <[email protected]>

* dedupe file path validation

Signed-off-by: jpcbertoldo <[email protected]>

* fix tests

Signed-off-by: jpcbertoldo <[email protected]>

* Add todo

Signed-off-by: jpcbertoldo <[email protected]>

* refactor enums

Signed-off-by: jpcbertoldo <[email protected]>

* only logger.warning

Signed-off-by: jpcbertoldo <[email protected]>

* refactor test imports

Signed-off-by: jpcbertoldo <[email protected]>

* refactor docs

Signed-off-by: jpcbertoldo <[email protected]>

* refactor some docs

Signed-off-by: jpcbertoldo <[email protected]>

* correct pre commit errors

Signed-off-by: jpcbertoldo <[email protected]>

* remove author tag

Signed-off-by: jpcbertoldo <[email protected]>

* add thrid party program

Signed-off-by: jpcbertoldo <[email protected]>

* Update src/anomalib/metrics/per_image/pimo.py

* move HAS_NUMBA

Signed-off-by: jpcbertoldo <[email protected]>

* remove PIMOSharedFPRMetric

Signed-off-by: jpcbertoldo <[email protected]>

* make torchmetrics compute avg by dft

Signed-off-by: jpcbertoldo <[email protected]>

* pre-commit hooks corrections

Signed-off-by: jpcbertoldo <[email protected]>

* correct numpy.trapezoid

Signed-off-by: jpcbertoldo <[email protected]>

---------

Signed-off-by: jpcbertoldo <[email protected]>
Co-authored-by: Samet Akcay <[email protected]>
* remove numba

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

* fix pre-commit checks

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

* add third-party-programs.txt

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

---------

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

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

* fix pre-commit checks

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

* remove all unused methods

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

---------

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

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

* fix pre-commit checks

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

* remove all unused methods

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

* replace numpy with torch

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

---------

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

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

* fix pre-commit checks

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

* remove all unused methods

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

* replace numpy with torch

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

* refactor code

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

* refactor
move functional inside update
remove path from the metric

* Add changes from comments

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

---------

Signed-off-by: Ashwin Vaidya <[email protected]>
* rename to pimo

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

* minor refactor

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

* remove model to model comparison

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

* fix test

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

* PR comments

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

* Minor refactor

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

---------

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

@samet-akcay samet-akcay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, some minor comments only.

overall, can we rename all the thresh to threshold and threshs to thresholds

src/anomalib/metrics/pimo/binary_classification_curve.py Outdated Show resolved Hide resolved
src/anomalib/metrics/pimo/dataclasses.py Outdated Show resolved Hide resolved
src/anomalib/metrics/pimo/dataclasses.py Outdated Show resolved Hide resolved
src/anomalib/metrics/pimo/functional.py Outdated Show resolved Hide resolved
src/anomalib/metrics/pimo/pimo.py Outdated Show resolved Hide resolved
tests/unit/metrics/pimo/test_binclf_curve.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 77.34513% with 128 lines in your changes missing coverage. Please review.

Project coverage is 80.78%. Comparing base (f473df8) to head (297f0ca).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/anomalib/metrics/pimo/_validate.py 67.96% 66 Missing ⚠️
src/anomalib/metrics/pimo/dataclasses.py 72.28% 23 Missing ⚠️
src/anomalib/metrics/pimo/functional.py 81.63% 18 Missing ⚠️
...omalib/metrics/pimo/binary_classification_curve.py 86.95% 12 Missing ⚠️
src/anomalib/metrics/pimo/pimo.py 87.83% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2329      +/-   ##
==========================================
- Coverage   80.93%   80.78%   -0.16%     
==========================================
  Files         247      254       +7     
  Lines       10899    11463     +564     
==========================================
+ Hits         8821     9260     +439     
- Misses       2078     2203     +125     
Flag Coverage Ξ”
?

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
ashwinvaidya17 and others added 3 commits October 1, 2024 10:17
Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
* add aupimo basic usage tutorial notebook

Signed-off-by: jpcbertoldo <[email protected]>

* update scipy import

Signed-off-by: jpcbertoldo <[email protected]>

* add cite us

Signed-off-by: jpcbertoldo <[email protected]>

* minor

Signed-off-by: jpcbertoldo <[email protected]>

* modify texts and add illustration

Signed-off-by: jpcbertoldo <[email protected]>

* udpate working dir

Signed-off-by: jpcbertoldo <[email protected]>

---------

Signed-off-by: jpcbertoldo <[email protected]>
Copy link

Check out this pull request onΒ  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ashwinvaidya17 ashwinvaidya17 enabled auto-merge (squash) October 2, 2024 11:45
@ashwinvaidya17 ashwinvaidya17 merged commit 191e21f into main Oct 2, 2024
7 of 9 checks passed
@ashwinvaidya17 ashwinvaidya17 deleted the feature/pimo branch October 2, 2024 11:46
@jpcbertoldo
Copy link
Contributor

Yay!

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.

3 participants