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

metrics[0]: add per-image overlap (pimo) [GSoC 2023 @ OpenVINO] #1247

Merged
merged 40 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a67b35f
add per-image overlap (pimo)
jpcbertoldo Jul 27, 2023
6376942
modif plot pimo curves
jpcbertoldo Jul 28, 2023
d999729
add warning about memory
jpcbertoldo Jul 28, 2023
3df9849
tiny bug
jpcbertoldo Jul 28, 2023
2b16061
add tuto ipynb
jpcbertoldo Jul 28, 2023
cacb653
make image classes a return
jpcbertoldo Aug 1, 2023
56b0bcd
fix ipynb
jpcbertoldo Aug 1, 2023
1476a56
add tests for binclf curve
jpcbertoldo Aug 1, 2023
5557db1
add test to binclf
jpcbertoldo Aug 1, 2023
70f9d37
add aupimo tests
jpcbertoldo Aug 1, 2023
0b05edd
ruff
jpcbertoldo Aug 1, 2023
0c7444e
Configure readthedocs via `.readthedocs.yaml` file (#1229)
samet-akcay Aug 3, 2023
b844261
Update binclf_curve.py
jpcbertoldo Aug 4, 2023
784767f
🚚 Refactor Benchmarking Script (#1216)
ashwinvaidya17 Aug 4, 2023
5a46d03
Update CODEOWNERS
samet-akcay Aug 6, 2023
3ffc3f6
Enable training with only normal images for MVTec (#1241)
djdameln Aug 7, 2023
a62cd92
Revert "🚚 Refactor Benchmarking Script" (#1239)
samet-akcay Aug 7, 2023
09ad1d4
Update benchmarking notebook (#1242)
samet-akcay Aug 8, 2023
0b639d4
add per-image overlap (pimo)
jpcbertoldo Jul 27, 2023
543db2b
modif plot pimo curves
jpcbertoldo Jul 28, 2023
c8537c7
add warning about memory
jpcbertoldo Jul 28, 2023
0cb153b
tiny bug
jpcbertoldo Jul 28, 2023
c076165
add tuto ipynb
jpcbertoldo Jul 28, 2023
ba6a5a6
make image classes a return
jpcbertoldo Aug 1, 2023
974d3bb
fix ipynb
jpcbertoldo Aug 1, 2023
1ff1832
add tests for binclf curve
jpcbertoldo Aug 1, 2023
241fb2e
add test to binclf
jpcbertoldo Aug 1, 2023
b8c588f
add aupimo tests
jpcbertoldo Aug 1, 2023
77355a7
ruff
jpcbertoldo Aug 1, 2023
4b67ced
Update binclf_curve.py
jpcbertoldo Aug 4, 2023
311a1e5
Merge branch 'jpcbertoldo/gsoc23-segementation-metrics' of github.com…
jpcbertoldo Aug 9, 2023
7b1eb80
refactor from future pr
jpcbertoldo Aug 9, 2023
6516491
Merge branch 'feature/pimo' into metrics/root
samet-akcay Aug 9, 2023
55f84c8
correct tests
jpcbertoldo Aug 15, 2023
596ebad
add test
jpcbertoldo Aug 15, 2023
0327861
fix test
jpcbertoldo Aug 15, 2023
b439e15
add plots tests
jpcbertoldo Aug 15, 2023
35a91ef
Merge branch 'feature/pimo' into metrics/root
jpcbertoldo Aug 16, 2023
e2a5b91
correct codacy stuff
jpcbertoldo Aug 16, 2023
3d995e0
correct codacy stuff
jpcbertoldo Aug 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
647 changes: 647 additions & 0 deletions notebooks/500_use_cases/502_perimg_metrics.ipynb

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion src/anomalib/utils/metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@
from .collection import AnomalibMetricCollection
from .min_max import MinMax
from .optimal_f1 import OptimalF1
from .perimg import AUPImO, PerImageBinClfCurve, PImO
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be per_img instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to name PerImageBinClfCurve something more explicit. BinClf may not be obvious initially. Do you think if PerImageBinaryClassificationCurve would be too verbose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used PerImageBinaryClassificationCurve at first but it feels very wordy and some lines will become tough to read.
binclf is what I found in torchmetrics so i copied them.

per_img i think it's ok; put it in the list of refactors.

from .pro import PRO

__all__ = ["AUROC", "AUPR", "AUPRO", "OptimalF1", "AnomalyScoreThreshold", "AnomalyScoreDistribution", "MinMax", "PRO"]
__all__ = [
"AUROC",
"AUPR",
"AUPRO",
"OptimalF1",
"AnomalyScoreThreshold",
"AnomalyScoreDistribution",
"MinMax",
"PRO",
"PerImageBinClfCurve",
"PImO",
"AUPImO",
]


def metric_collection_from_names(metric_names: list[str], prefix: str | None) -> AnomalibMetricCollection:
Expand Down
27 changes: 27 additions & 0 deletions src/anomalib/utils/metrics/perimg/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# temporary file to manage branches/PRs so they are simpler

fpr.py


tpr.py





slogroc.py


tpatfp.py



fp_requirement.py



precisionroc.py



scratch.py
15 changes: 15 additions & 0 deletions src/anomalib/utils/metrics/perimg/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Per-Image Metrics.

Overall approach:
Thresholds are computed across all images, but the metrics are computed per-image.
Metrics here are based on binary classification metrics (e.g. FPR, TPR, Precision) over a range of thresholds.
"""

from .binclf_curve import PerImageBinClfCurve
from .pimo import AUPImO, PImO

__all__ = [
"PerImageBinClfCurve",
"PImO",
"AUPImO",
]
Loading