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

PIMO #1726

Merged
merged 62 commits into from
Sep 20, 2024
Merged

PIMO #1726

merged 62 commits into from
Sep 20, 2024

Conversation

jpcbertoldo
Copy link
Contributor

@jpcbertoldo jpcbertoldo commented Feb 9, 2024

📝 Description

Replace #1557, which replaces the PRs from https://gist.github.com/jpcbertoldo/12553b7eaa97cfbf3e55bfd7d1cafe88 .

Implements refactors from https://github.com/jpcbertoldo/anomalib/blob/metrics/refactors/src/anomalib/utils/metrics/perimg/.refactors .

arxiv: https://arxiv.org/abs/2401.01984
medium post: https://medium.com/p/c653ac30e802
GSoC deliverable: https://gist.github.com/jpcbertoldo/12553b7eaa97cfbf3e55bfd7d1cafe88

Closes #1728 1728

✨ 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
Copy link
Contributor Author

another unresolved issue from the previous PR

[about "ATTENTION..." in docstrings]

@ashwinvaidya17

Same here. We need to consider how these docstrings will be rendered in sphinx.

how can i check that?

@samet-akcay
Copy link
Contributor

samet-akcay commented Feb 9, 2024

another unresolved issue from the previous PR

[about "ATTENTION..." in docstrings]

@ashwinvaidya17

Same here. We need to consider how these docstrings will be rendered in sphinx.

how can i check that?

The documentation is built here based on your changes
image

@jpcbertoldo
Copy link
Contributor Author

another unresolved issue from the previous PR
[about "ATTENTION..." in docstrings]
@ashwinvaidya17

Same here. We need to consider how these docstrings will be rendered in sphinx.

how can i check that?

The documentation is built here based on your changes

there are some [metadata] stuff showing up, idk why

apparently sphinx doesnt like dataclasses?
https://anomalib--1726.org.readthedocs.build/en/1726/markdown/guides/reference/metrics/index.html#id5
this field is in the class AUPIMOResult but it's showing as if it was a function or w/e in the root (?)
while AUPIMOResult doesnt show at all

@samet-akcay
Copy link
Contributor

another unresolved issue from the previous PR
[about "ATTENTION..." in docstrings]
@ashwinvaidya17

Same here. We need to consider how these docstrings will be rendered in sphinx.

how can i check that?

The documentation is built here based on your changes

there are some [metadata] stuff showing up, idk why

apparently sphinx doesnt like dataclasses? https://anomalib--1726.org.readthedocs.build/en/1726/markdown/guides/reference/metrics/index.html#id5 this field is in the class AUPIMOResult but it's showing as if it was a function or w/e in the root (?) while AUPIMOResult doesnt show at all

Tree structure is also messed up a bit. It might be an idea to split each metric into a separate section.

@jpcbertoldo
Copy link
Contributor Author

another unresolved issue from the previous PR
[about "ATTENTION..." in docstrings]
@ashwinvaidya17

Same here. We need to consider how these docstrings will be rendered in sphinx.

how can i check that?

The documentation is built here based on your changes

https://anomalib--1726.org.readthedocs.build/en/1726/markdown/guides/reference/metrics/index.html

it's not quite working as expected

  1. i expected per_image to show as submenu in metrics, how could I do that?

  2. it seems not to like dataclasses; there are attributes of PIMOResult and AUPIMOResult showing as if it was a function (?) and the classes themselves dont' show

@samet-akcay samet-akcay added this to the v1.1.0 milestone Feb 29, 2024
@samet-akcay samet-akcay added Feature and removed Dependencies Pull requests that update a dependency file Tests labels Mar 25, 2024
@samet-akcay samet-akcay modified the milestones: v1.1.0, v1.2.0 May 14, 2024
Copy link
Collaborator

@ashwinvaidya17 ashwinvaidya17 left a comment

Choose a reason for hiding this comment

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

A lot has changed since this PR was submitted, but I've finally gotten around to reviewing it. This is a huge PR with a lot of efforts behind it. However, I have some concerns. I've gone over it once but I think I'll require a few more passes for a more thorough review. But meanwhile we can start the discussions for the current opens.

src/anomalib/metrics/per_image/binclf_curve.py Outdated Show resolved Hide resolved
src/anomalib/metrics/per_image/_binclf_curve_numba.py Outdated Show resolved Hide resolved
requirements/base.txt Outdated Show resolved Hide resolved
tests/unit/metrics/per_image/test_utils.py Outdated Show resolved Hide resolved
src/anomalib/metrics/per_image/_validate.py Outdated Show resolved Hide resolved
src/anomalib/metrics/per_image/utils.py Outdated Show resolved Hide resolved
src/anomalib/metrics/per_image/binclf_curve_numpy.py Outdated Show resolved Hide resolved
src/anomalib/metrics/per_image/pimo_numpy.py Outdated Show resolved Hide resolved
src/anomalib/metrics/per_image/pimo_numpy.py Show resolved Hide resolved
Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
@jpcbertoldo
Copy link
Contributor Author

Thanks! I think we are almost there. I have two major comments remaining. First, the author tag in the headers is not consistent with the rest of the repo. The current scans check third-party-programs.txt to verify the license and proper attribution for codes taken from other repositories. Second, numba adds complexity to the codebase. If it is not strictly necessary, let's not include it. But I am happy to hear other opinions.

I removed the author tag and add the original code's repo to third-party-programs.txt.

I think the decision for numba is rather up to y`all as maintainers, but it does give a nice speedup.

For the record (if i get it well), it only has two requirements:

install_requires = [
    'llvmlite >={},<{}'.format(min_llvmlite_version, max_llvmlite_version),
    'numpy >={},<{}'.format(min_numpy_run_version, max_numpy_run_version),
    'importlib_metadata; python_version < "3.9"',
]

https://github.com/numba/numba/blob/d4460feb8c91213e7b89f97b632d19e34a776cd3/setup.py#L369-L373

min_numpy_run_version = "1.22"
max_numpy_run_version = "1.27"
min_llvmlite_version = "0.41.0dev0"
max_llvmlite_version = "0.42"

https://github.com/numba/numba/blob/d4460feb8c91213e7b89f97b632d19e34a776cd3/setup.py#L25-L28

I copied these from numba==0.58.1, which is the minimum here.

Copy link
Contributor

@djdameln djdameln left a comment

Choose a reason for hiding this comment

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

I'm getting the following error when I try to use the AUPIMO metric to evaluate an anomalib model. Can you check it out?

ValueError: The `.compute()` return of the metric logged as 'pixel_AUPIMO' must be a tensor. Found (PIMOResult(shared_fpr_metric='mean-per-image-fpr'), AUPIMOResult(shared_fpr_metric='mean-per-image-fpr', fpr_lower_bound=1e-05, fpr_upper_bound=0.0001, num_threshs=48480))

src/anomalib/metrics/per_image/pimo_numpy.py Show resolved Hide resolved
src/anomalib/metrics/per_image/pimo.py Outdated Show resolved Hide resolved
src/anomalib/__init__.py Outdated Show resolved Hide resolved
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import numba
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also a bit hesitant to add the numba requirement. I can see the benefit that it brings, but at the same time it adds an unnecessary dependency and it increases the complexity of the code. Without Numba we could have a pure pytorch implementation of the metric, which would be much cleaner and more in line with the rest of the library.

@jpcbertoldo
Copy link
Contributor Author

I'm getting the following error when I try to use the AUPIMO metric to evaluate an anomalib model. Can you check it out?

ValueError: The `.compute()` return of the metric logged as 'pixel_AUPIMO' must be a tensor. Found (PIMOResult(shared_fpr_metric='mean-per-image-fpr'), AUPIMOResult(shared_fpr_metric='mean-per-image-fpr', fpr_lower_bound=1e-05, fpr_upper_bound=0.0001, num_threshs=48480))

This is normal because aupimo returns many values so it was encapsulated in that dataclass.
We could create an option in the torchmetrics interface to optionally return this and (by default) return just the average aupimo instead.
Sounds good?

@djdameln
Copy link
Contributor

djdameln commented Jul 9, 2024

This is normal because aupimo returns many values so it was encapsulated in that dataclass.
We could create an option in the torchmetrics interface to optionally return this and (by default) return just the average aupimo instead.
Sounds good?

I think that would be a good idea. With the default setting the metric should be fully compatible with Anomalib's pipeline. So users should be able to enable it from the config/cli or API to have Anomalib report the average AUPIMO value.

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
@jpcbertoldo
Copy link
Contributor Author

This is normal because aupimo returns many values so it was encapsulated in that dataclass.
We could create an option in the torchmetrics interface to optionally return this and (by default) return just the average aupimo instead.
Sounds good?

I think that would be a good idea. With the default setting the metric should be fully compatible with Anomalib's pipeline. So users should be able to enable it from the config/cli or API to have Anomalib report the average AUPIMO value.

@djdameln Done : )

i think the only missing issue is about numba (here #1726 (comment))

i can remove it if that's better, but it is already optional like you suggested in your last comment

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
@jpcbertoldo
Copy link
Contributor Author

@samet-akcay could you launch a code check here please?

About CDO, I think it is ok to apply the correction? But I'm not 100% sure (don't want to mess up the commit history 😬 )

@samet-akcay
Copy link
Contributor

@samet-akcay could you launch a code check here please?

About CDO, I think it is ok to apply the correction? But I'm not 100% sure (don't want to mess up the commit history 😬 )

done

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
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.

@jpcbertoldo, thanks for creating this huuuge and amazing PR! Also, thanks for your patience. Took me a while to go through this.

I've got some comments/questions.

Clarity vs Conciseness in Naming

  • When reading the code, I would prefer clarity over conciseness. I find the abbreviations hard to follow, which overall slows me down reading the code. Overall, I would prefer full words over abbreviations. Something like;
    classification_curve.py or binary_classification_curve.py
    thresholds instead of threshs

Validation

  • I'm wondering how important the validation stuff for this metric evaluation?
    • Is it possible to carry out these checks multiple times? Or just in the correct place.
    • Is it possible to store validators in more organized way. currently there is a _validation.py, but there are quite a bit of validators scattered across the sub-package.

Structure of the sub-package

  • I feel we could organise the sub-package a bit more. For example, instead of placing multiple modules horizontally like pimo.py, pimo_numpy.py, we could potentially create a pimo sub package that organises these, which would be easier to follow. Similarly, it might be an idea to create something like utils/... , even maybe curves/..?

  • For example, the actual PIMO implementation starts in Line 700ish. As a reader, I would expect to see AUPIMO(Metric) in aupimo.py and PIMO(Metric) in pimo.py almost right after imports. The rest of the stuff is sort of util to me

I'm working on something similar in PR #2305 to structure sub packages in data, for easier navigation

data
├── __init__.py
├── dataclasses
│   ├── __init__.py
│   ├── generic.py
│   ├── numpy
│   │   ├── __init__.py
│   │   ├── base.py
│   │   ├── depth.py
│   │   ├── image.py
│   │   └── video.py
│   └── torch
│       ├── __init__.py
│       ├── base.py
│       ├── depth.py
│       ├── image.py
│       └── video.py
├── datamodules
│   ├── __init__.py
│   ├── base
│   │   ├── __init__.py
│   │   ├── image.py
│   │   └── video.py
│   ├── depth
│   │   ├── __init__.py
│   │   ├── folder_3d.py
│   │   └── mvtec_3d.py
│   ├── image
│   │   ├── __init__.py
│   │   ├── btech.py
│   │   ├── folder.py
│   │   ├── kolektor.py
│   │   ├── mvtec.py
│   │   └── visa.py
│   └── video
│       ├── __init__.py
│       ├── avenue.py
│       ├── shanghaitech.py
│       └── ucsd_ped.py
├── datasets
│   ├── __init__.py
│   ├── base
│   │   ├── __init__.py
│   │   ├── depth.py
│   │   ├── image.py
│   │   └── video.py
│   ├── depth
│   │   ├── __init__.py
│   │   ├── folder_3d.py
│   │   └── mvtec_3d.py
│   ├── image
│   │   ├── __init__.py
│   │   ├── btech.py
│   │   ├── folder.py
│   │   ├── kolektor.py
│   │   ├── mvtec.py
│   │   └── visa.py
│   └── video
│       ├── __init__.py
│       ├── avenue.py
│       ├── shanghaitech.py
│       └── ucsd_ped.py
├── ...
├── transforms
│   └── ...
├── utils
│   └── ...
└── validators
    ├── __init__.py
    ├── numpy
    │   ├── __init__.py
    │   ├── depth.py
    │   ├── image.py
    │   └── video.py
    ├── path.py
    └── torch
        ├── __init__.py
        ├── depth.py
        ├── image.py
        └── video.py

Given your other commitments these days, one possibility would be to work on it together by merging it to a feature branch? Any thoughts? @jpcbertoldo, @ashwinvaidya17, @djdameln ?

path: str | Path,
base_dir: str | Path | None = None,
should_exist: bool = True,
accepted_extensions: tuple[str, ...] | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think extensions would be sufficient in this case

Suggested change
accepted_extensions: tuple[str, ...] | None = None,
extensions: tuple[str, ...] | None = None,

"""Validate the path.

Args:
path (str | Path): Path to validate.
base_dir (str | Path): Base directory to restrict file access.
should_exist (bool): If True, do not raise an exception if the path does not exist.
accepted_extensions (tuple[str, ...] | None): Accepted extensions for the path. An exception is raised if the
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
accepted_extensions (tuple[str, ...] | None): Accepted extensions for the path. An exception is raised if the
extensions (tuple[str, ...] | None): Accepted extensions for the path. An exception is raised if the

@@ -213,6 +220,11 @@ def validate_path(path: str | Path, base_dir: str | Path | None = None, should_e
msg = f"Read or execute permissions denied for the path: {path}"
raise PermissionError(msg)

# Check if the path has one of the accepted extensions
if accepted_extensions is not None and path.suffix not in accepted_extensions:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if accepted_extensions is not None and path.suffix not in accepted_extensions:
if extensions is not None and path.suffix not in extensions:

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

from .binclf_curve import per_image_binclf_curve, per_image_fpr, per_image_tpr
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a question regarding .binclf: Is there any case where the classification is not binary? If binary only, can we assume that the abbreviation bin is redundant?

During reading the code, I find it a bit hard to follow these abbreviations



class BinclfThreshsChoice(Enum):
"""Sequence of thresholds to use."""
Copy link
Contributor

Choose a reason for hiding this comment

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

I think expanding the docstring would be good to explain what each choice would do. For example, why would a user, choose given over minmax_linspace, or mean_fpr_optimized

return utils_numpy.compare_models_pairwise_ttest_rel(scores_per_model_with_arrays, alternative, higher_is_better)


def compare_models_pairwise_wilcoxon(
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Comment on lines +38 to +39
HI: str = "hi"
LO: str = "lo"
Copy link
Contributor

Choose a reason for hiding this comment

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

why not
HIGH, instead of HI, and LOW, instead LO?

- 'image_idx': Index of the image in `per_image_scores` whose score is the closest to the statistic's value.
- 'score': The score of the image at index `image_idx` (not necessarily the same as `stat_value`).

The list is sorted by increasing `stat_value`.
Copy link
Contributor

Choose a reason for hiding this comment

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

As a reader/user, I would love to see an example to understand how to use this

# =========================================== ARGS VALIDATION ===========================================


def _validate_is_anomaly_maps(anomaly_maps: Tensor) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be an idea to move these validation utils to _validate.py? these functions already use functions from validate.


Returns:
PIMOResult: PIMO curves dataclass object. See `PIMOResult` for details.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

I think examples section here would be really useful. Like what do I need to run AUPIMO with some basic torch input and output

Copy link
Collaborator

@ashwinvaidya17 ashwinvaidya17 left a comment

Choose a reason for hiding this comment

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

I agree with Samet’s suggestion to move all validation checks to a separate module, as it would significantly improve the clarity and organization of pimo.py. Furthermore, I propose we also consider removing the NumPy-based computations. Since we aren’t using NumPy for other metrics in Anomalib, and there doesn’t seem to be a current need for NumPy in our metric computations, eliminating it could further simplify the codebase.
As Samet suggested, we can target this change to a feature branch so that the rest of the team can assist in reducing your workload, especially given the significant amount of work you’ve already done.

@jpcbertoldo
Copy link
Contributor Author

I agree with Samet’s suggestion to move all validation checks to a separate module, as it would significantly improve the clarity and organization of pimo.py. Furthermore, I propose we also consider removing the NumPy-based computations. Since we aren’t using NumPy for other metrics in Anomalib, and there doesn’t seem to be a current need for NumPy in our metric computations, eliminating it could further simplify the codebase. As Samet suggested, we can target this change to a feature branch so that the rest of the team can assist in reducing your workload, especially given the significant amount of work you’ve already done.

Ok, no worries. So shoul I remove the *_numpy.py stuff and move the code to the torch onlye versions ?

Just one warning. PIMO is fast to compute thanks to

https://github.com/jpcbertoldo/anomalib/blob/241df0e2aea82373bb69c216e73a7e43106aee22/src/anomalib/metrics/per_image/binclf_curve_numpy.py#L98

which is in numpy, so that specific one would be worth keeping.

Using torchmetrics (even on GPU) is slower. The constraint is that the thresholds are shared across images, but the binary classification (for multiple thresholds) are computed per image.

If this one is removed, then we need a torch-based implementation, which I'm sure is significantly slower for evaluation on the original resolution of images (1000-ish), which was a major argument in the paper. This is a topic we went through last year, but I can try to find the graphs to put numbers in this difference of execution time.

So, do we keep or remove this one? (_binclf_one_curve_python)

@ashwinvaidya17
Copy link
Collaborator

Okay, then let's keep bin_clfcurve_numpy.py. I wonder how will this affect the computation when we support distributed training. Anyway, we can look into that later. Let's get this merged.

@jpcbertoldo
Copy link
Contributor Author

Okay, then let's keep bin_clfcurve_numpy.py. I wonder how will this affect the computation when we support distributed training. Anyway, we can look into that later. Let's get this merged.

(just guessing) In the torchmetrics class, there isn't much happening in the update(), it basically stores score maps and masks. The compute() method will do everything. It' pretty much what torchmetrics does with AUROC. So it should be ok?

@ashwinvaidya17 ashwinvaidya17 changed the base branch from main to feature/pimo September 20, 2024 08:15
@ashwinvaidya17 ashwinvaidya17 merged commit 29cb912 into openvinotoolkit:feature/pimo Sep 20, 2024
3 of 5 checks passed
ashwinvaidya17 added a commit that referenced this pull request Oct 2, 2024
* PIMO (#1726)

* update

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* test binclf curves numpy and numba and fixes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct som docstrings

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* torch interface and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* torch interface and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* constants regrouped in dataclass as class vars

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* result class was unneccesary for per_image_binclf_curve

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* factorize function _get_threshs_minmax_linspace

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* small docs fixes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add pimo numpy version and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* move validation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add `shared_fpr_metric` option

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add pimo torch functional version and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add torchmetrics interface and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* renames and put things in init

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* validate inputs in result objects

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* result objects to from dict and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add save and load methods to result objects and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor validations and minor changes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* test result objects' properties

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor refactors

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add missing docstrings

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minore vocabulary fix for consistency

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add per image scores statistics and test it

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor constants notation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add stats tests and test it

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* change the meaning of AUPIMO.num_thresh

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* interface to format pairwise test results

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* improve doc

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

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

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove frozen from dataclasses and some done todos

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* review headers

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* doc modifs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor `score_less_than_thresh` in `_binclf_one_curve_python`

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct license comments

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix doc

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* numba as extra requirement

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor copyrights from jpcbertoldo

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove from __future__ import annotations

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor validations names

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* dedupe file path validation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* Add todo

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor enums

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* only logger.warning

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor test imports

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor docs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor some docs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct pre commit errors

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove author tag

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add thrid party program

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

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

* move HAS_NUMBA

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove PIMOSharedFPRMetric

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* make torchmetrics compute avg by dft

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* pre-commit hooks corrections

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct numpy.trapezoid

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🗑️ Remove numba (#2313)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* add third-party-programs.txt

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🗑️ Remove unused methods (#2315)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PIMO: Port Numpy → Torch (#2316)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* replace numpy with torch

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🔨Refactor methods across files (#2321)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* replace numpy with torch

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* refactor code

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* refactor
move functional inside update
remove path from the metric

* Add changes from comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove model to model comparison (#2325)

* rename to pimo

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* minor refactor

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove model to model comparison

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix test

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Minor refactor

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove unused enums

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* update doc strings

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* update param names

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* add aupimo basic usage tutorial notebook (#2330)

* add aupimo basic usage tutorial notebook

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update scipy import

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add cite us

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* modify texts and add illustration

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* udpate working dir

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>
Co-authored-by: Joao P C Bertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>
samet-akcay added a commit that referenced this pull request Oct 16, 2024
* Update timm requirement from <=1.0.7,>=1.0.7 to >=1.0.7,<=1.0.9 (#2274)

* Update timm requirement from <=1.0.7,>=1.0.7 to >=1.0.7,<=1.0.9

Updates the requirements on [timm](https://github.com/huggingface/pytorch-image-models) to permit the latest version.
- [Release notes](https://github.com/huggingface/pytorch-image-models/releases)
- [Commits](huggingface/pytorch-image-models@v1.0.7...v1.0.9)

---
updated-dependencies:
- dependency-name: timm
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update pyproject.toml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🐞Update `setuptools` requirement for PEP 660 support (#2320)

Update setup tools

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Fix transforms for draem, dsr and rkde (#2324)

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Add check before loading metrics data from checkpoint (#2323)

Add check before loading from checkpoint

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* Add PIMO (#2329)

* PIMO (#1726)

* update

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* test binclf curves numpy and numba and fixes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct som docstrings

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* torch interface and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* torch interface and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* constants regrouped in dataclass as class vars

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* result class was unneccesary for per_image_binclf_curve

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* factorize function _get_threshs_minmax_linspace

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* small docs fixes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add pimo numpy version and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* move validation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add `shared_fpr_metric` option

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add pimo torch functional version and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add torchmetrics interface and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* renames and put things in init

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* validate inputs in result objects

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* result objects to from dict and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add save and load methods to result objects and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor validations and minor changes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* test result objects' properties

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor refactors

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add missing docstrings

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minore vocabulary fix for consistency

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add per image scores statistics and test it

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor constants notation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add stats tests and test it

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* change the meaning of AUPIMO.num_thresh

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* interface to format pairwise test results

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* improve doc

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

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

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove frozen from dataclasses and some done todos

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* review headers

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* doc modifs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor `score_less_than_thresh` in `_binclf_one_curve_python`

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct license comments

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix doc

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* numba as extra requirement

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor copyrights from jpcbertoldo

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove from __future__ import annotations

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor validations names

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* dedupe file path validation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* Add todo

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor enums

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* only logger.warning

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor test imports

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor docs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor some docs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct pre commit errors

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove author tag

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add thrid party program

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

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

* move HAS_NUMBA

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove PIMOSharedFPRMetric

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* make torchmetrics compute avg by dft

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* pre-commit hooks corrections

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct numpy.trapezoid

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🗑️ Remove numba (#2313)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* add third-party-programs.txt

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🗑️ Remove unused methods (#2315)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PIMO: Port Numpy → Torch (#2316)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* replace numpy with torch

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🔨Refactor methods across files (#2321)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* replace numpy with torch

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* refactor code

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* refactor
move functional inside update
remove path from the metric

* Add changes from comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove model to model comparison (#2325)

* rename to pimo

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* minor refactor

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove model to model comparison

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix test

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Minor refactor

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove unused enums

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* update doc strings

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* update param names

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* add aupimo basic usage tutorial notebook (#2330)

* add aupimo basic usage tutorial notebook

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update scipy import

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add cite us

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* modify texts and add illustration

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* udpate working dir

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>
Co-authored-by: Joao P C Bertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* Makes batch size dynamic (#2339)

Made batch dimension of ONNX export dynamic when specifying input shape.

* Add pimo tutorial advanced i (fixed) (#2336)

* uset all padim features to make it deterministic

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add aupimo notebook advanced i

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* modify changelog

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct again

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor corrections

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* Pimo tutorials/02 advanced ii (#2347)

* uset all padim features to make it deterministic

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add aupimo notebook advanced i

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* modify changelog

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct again

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor corrections

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add aupimo notebook advanced ii (pimo curve and integration bounds)

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix links

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct change log

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* Create epic.yaml

* 🔨 Update the issue templates (#2363)

* Update epic.yaml

* Update epic.yaml

* Update epic.yaml

* Update epic.yaml

* Update task.yaml

* Create user_story.yaml

* Update epic.yaml

* Pimo tutorials/03 advanced iii (#2348)

* add aupimo notebook advanced iii (aupimo score of a random model)

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add cite us

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update notebooks readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🔨 Deprecate try import and replace it with Lightning's package_available (#2373)

Replace try_import with lightnings package_available function

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Refactor folder3d to avoid complex-structure (C901) issue (#2185)

* Refactored-make_folder3d_dataset-ruff-error-C901 (#1926)

Signed-off-by: sahusiddharth <siddharth.sahu@plaksha.edu.in>

* Simplify folder 3d dataset (#2184)

---------

Signed-off-by: sahusiddharth <siddharth.sahu@plaksha.edu.in>
Co-authored-by: Siddharth Sahu <112792547+sahusiddharth@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>
Signed-off-by: sahusiddharth <siddharth.sahu@plaksha.edu.in>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Blaž Rolih <61357777+blaz-r@users.noreply.github.com>
Co-authored-by: Ashwin Vaidya <ashwin.vaidya@intel.com>
Co-authored-by: Joao P C Bertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Marcus Pertlwieser <116986601+Marcus1506@users.noreply.github.com>
Co-authored-by: Siddharth Sahu <112792547+sahusiddharth@users.noreply.github.com>
samet-akcay added a commit that referenced this pull request Nov 15, 2024
* Update timm requirement from <=1.0.7,>=1.0.7 to >=1.0.7,<=1.0.9 (#2274)

* Update timm requirement from <=1.0.7,>=1.0.7 to >=1.0.7,<=1.0.9

Updates the requirements on [timm](https://github.com/huggingface/pytorch-image-models) to permit the latest version.
- [Release notes](https://github.com/huggingface/pytorch-image-models/releases)
- [Commits](huggingface/pytorch-image-models@v1.0.7...v1.0.9)

---
updated-dependencies:
- dependency-name: timm
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update pyproject.toml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🐞Update `setuptools` requirement for PEP 660 support (#2320)

Update setup tools

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Fix transforms for draem, dsr and rkde (#2324)

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Add check before loading metrics data from checkpoint (#2323)

Add check before loading from checkpoint

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* Add PIMO (#2329)

* PIMO (#1726)

* update

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* test binclf curves numpy and numba and fixes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct som docstrings

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* torch interface and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* torch interface and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* constants regrouped in dataclass as class vars

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* result class was unneccesary for per_image_binclf_curve

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* factorize function _get_threshs_minmax_linspace

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* small docs fixes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add pimo numpy version and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* move validation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add `shared_fpr_metric` option

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add pimo torch functional version and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add torchmetrics interface and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* renames and put things in init

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* validate inputs in result objects

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* result objects to from dict and tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add save and load methods to result objects and test

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor validations and minor changes

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* test result objects' properties

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor refactors

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add missing docstrings

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minore vocabulary fix for consistency

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add per image scores statistics and test it

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor constants notation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add stats tests and test it

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* change the meaning of AUPIMO.num_thresh

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* interface to format pairwise test results

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* improve doc

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

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

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove frozen from dataclasses and some done todos

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* review headers

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* doc modifs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor `score_less_than_thresh` in `_binclf_one_curve_python`

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct license comments

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix doc

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* numba as extra requirement

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor copyrights from jpcbertoldo

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove from __future__ import annotations

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor validations names

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* dedupe file path validation

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix tests

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* Add todo

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor enums

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* only logger.warning

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor test imports

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor docs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* refactor some docs

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct pre commit errors

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove author tag

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add thrid party program

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

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

* move HAS_NUMBA

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* remove PIMOSharedFPRMetric

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* make torchmetrics compute avg by dft

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* pre-commit hooks corrections

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct numpy.trapezoid

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🗑️ Remove numba (#2313)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* add third-party-programs.txt

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🗑️ Remove unused methods (#2315)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PIMO: Port Numpy → Torch (#2316)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* replace numpy with torch

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🔨Refactor methods across files (#2321)

* remove numba

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix pre-commit checks

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove all unused methods

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* replace numpy with torch

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* refactor code

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* refactor
move functional inside update
remove path from the metric

* Add changes from comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove model to model comparison (#2325)

* rename to pimo

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* minor refactor

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove model to model comparison

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* fix test

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Minor refactor

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove unused enums

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* update doc strings

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* update param names

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* add aupimo basic usage tutorial notebook (#2330)

* add aupimo basic usage tutorial notebook

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update scipy import

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add cite us

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* modify texts and add illustration

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* udpate working dir

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>
Co-authored-by: Joao P C Bertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* Makes batch size dynamic (#2339)

Made batch dimension of ONNX export dynamic when specifying input shape.

* Add pimo tutorial advanced i (fixed) (#2336)

* uset all padim features to make it deterministic

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add aupimo notebook advanced i

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* modify changelog

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct again

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor corrections

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* Pimo tutorials/02 advanced ii (#2347)

* uset all padim features to make it deterministic

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add aupimo notebook advanced i

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* modify changelog

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct again

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* minor corrections

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add aupimo notebook advanced ii (pimo curve and integration bounds)

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix links

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* correct change log

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* Create epic.yaml

* 🔨 Update the issue templates (#2363)

* Update epic.yaml

* Update epic.yaml

* Update epic.yaml

* Update epic.yaml

* Update task.yaml

* Create user_story.yaml

* Update epic.yaml

* Pimo tutorials/03 advanced iii (#2348)

* add aupimo notebook advanced iii (aupimo score of a random model)

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add cite us

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* update notebooks readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🔨 Deprecate try import and replace it with Lightning's package_available (#2373)

Replace try_import with lightnings package_available function

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Refactor folder3d to avoid complex-structure (C901) issue (#2185)

* Refactored-make_folder3d_dataset-ruff-error-C901 (#1926)

Signed-off-by: sahusiddharth <siddharth.sahu@plaksha.edu.in>

* Simplify folder 3d dataset (#2184)

---------

Signed-off-by: sahusiddharth <siddharth.sahu@plaksha.edu.in>
Co-authored-by: Siddharth Sahu <112792547+sahusiddharth@users.noreply.github.com>

* 🚀 Add datumaro annotation dataloader (#2377)

* Add datumaro annotation dataloader

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Update changelog

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add examples

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Pimo tutorials/04 advanced iv  (#2352)

* add notebook 701e_aupimo_advanced_iv on load/save and statistical comparisons

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* make `AUPIMOResult.num_thresholds` optional

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* add aupimo notebook advanced iv (load/save and statistical tests)

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* simplify cite us and mention intal

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

* fix readme

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>

---------

Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🐞 Defer OpenVINO import to avoid unnecessary warnings (#2385)

* Fix openvino import issue

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Fix pre-commit issues

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

---------

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* 🚀 Add VLM based Anomaly Model (#2344)

* [Draft] Llm on (#2165)

* Add TaskType Explanation

Signed-off-by: Bepitic <bepitic@gmail.com>

* Add llm model

Signed-off-by: Bepitic <bepitic@gmail.com>

* add ollama

Signed-off-by: Bepitic <bepitic@gmail.com>

* better description for descr in title

Signed-off-by: Bepitic <bepitic@gmail.com>

* add text of llm into imageResult visualization

* add text of llm into imageResult visualization

Signed-off-by: Bepitic <bepitic@gmail.com>

* latest changes

Signed-off-by: Bepitic <bepitic@gmail.com>

* add wip llava/llava_next

Signed-off-by: Bepitic <bepitic@gmail.com>

* add init

Signed-off-by: Bepitic <bepitic@gmail.com>

* add text of llm into imageResult visualization

Signed-off-by: Bepitic <bepitic@gmail.com>

* latest changes

Signed-off-by: Bepitic <bepitic@gmail.com>

* upd Lint

Signed-off-by: Bepitic <bepitic@gmail.com>

* fix visualization with description

Signed-off-by: Bepitic <bepitic@gmail.com>

* show the images every batch

Signed-off-by: Bepitic <bepitic@gmail.com>

* fix docstring and error management

Signed-off-by: Bepitic <bepitic@gmail.com>

* Add compatibility for TaskType.EXPLANATION.

Signed-off-by: Bepitic <bepitic@gmail.com>

* Remove, show in the engine-Visualization.

* fix visualization and llm openai multishot.

* fix Circular import problem

* Add HugginFace To LLavaNext

Signed-off-by: Bepitic <bepitic@gmail.com>

---------

Signed-off-by: Bepitic <bepitic@gmail.com>

* 🔨 Scaffold for refactor (#2340)

* initial scafold

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Apply PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* rename dir

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add ChatGPT (#2341)

* initial scafold

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Apply PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* rename dir

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* delete llm_ollama

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add ChatGPT

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add ChatGPT

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove LLM model

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add Huggingface (#2343)

* initial scafold

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Apply PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* rename dir

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* delete llm_ollama

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add ChatGPT

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add ChatGPT

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove LLM model

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add transformers

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Remove llava

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🔨 Minor Refactor (#2345)

Refactor

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* undo changes

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* undo changes

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* undo changes to image.py

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Add explanation visualizer (#2351)

* Add explanation visualizer

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* bug-fix

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🔨 Allow setting API keys from env (#2353)

Allow setting API keys from env

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* 🧪 Add tests (#2355)

* Add tests

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* remove explanation task type

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* minor fixes

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Update changelog

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Fix tests

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Address PR comments

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* update name

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

* Update src/anomalib/models/image/vlm_ad/lightning_model.py

Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* update name

Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>

---------

Signed-off-by: Bepitic <bepitic@gmail.com>
Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>
Co-authored-by: Paco <bepitic@gmail.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* Add ensembling methods for tiling to Anomalib (#1226)

* Fixed broken links in readme

* Fixed inference command in readme

* Add tiling for ensemble

* Add tests for tiling for ensemble

* Moved ensemble tiler to separate file

* Modify padim config for ensemble

* Add tiling to dataset

* Revert changes to train

* Add tiling to collate fn

* Fix tiling in collate

* Change val. function to protected

* Add tile number logic

* Move collate fn to separate file

* Update tests for tiler

* Add training loop for ensemble

* Add model input size setup

* Move ens config to separate file

* Revert mvtec modifications

* Remove unused imports in mvtec

* Add batch adjustment to untiling

* Add predict step to ensemble

* Add comment and docstring to tile joining function

* Move tile joining to separate function

* Add joining for all tiled data

* Add joining for all box data

* Refactor pred. joining as modular class

* Fix box joining

* Add label and score joining

* Add ensemble visualization

* Add end of predict hook

* Add metric computation

* Fix metric thresholds

* Add removal of individual visualization

* Add demo1 notebook

* Add docstrings and cleanup

* Add memory benchmark

* Add modular class for storing predictions

* Add metric to separate class

* Refactor to support prediction data class

* Rename predictions class

* Add filesystem predictions class

* Add resized predictions class

* Fix joiner for classification task

* Add page peak to memory benchmark

* Add global stats calculation

* Add docstrings to stats calculation

* Refactor joiner for pipeline

* Refactor stats into pipeline

* Refactor metrics as pipeline block

* Refactor visualization as pipeline block

* Refactor postprocessing into a pipeline

* Add normalization and thresholding on joined predictions

* Refactor tiler to accept config file

* Add smoothing of tile joins.

* Refactor ensemble datamodule preparation

* Remove unused changes in dataloader

* Fix metric configuration

* Fix box coordinates in joining

* Add ensemble callbacks preparation function

* Fix box prediction bug in postprocess

* Add ensemble params to config

* Refactor postprocessing.

* Refactor post-processing

* Refactor predictions

* Code cleanup

* Optimize prediction storage

* Make join smoothing configurable

* Cleanup before PR

* Fix stats pipeline

* Fix logging strings

* Fix memory benchmark

* Fix tiler issues

* Fix import issues

* Fix naming in metrics and visualization

* Fix cyclic import

* Make logging lazy

* Refactor tiler tests

* Added collate tiling tests

* Added ensemble helper functions tests

* Refactor for dummy ensemble config

* Refactor for dummy base config

* Add tests for prediction storage

* Add tests for prediction joiner

* Add tests for visualization

* Fix small issues in tests

* Add metrics test

* Add post-processing tests

* Fix tiler to work with different instance

* Move seed setting inside train loop

* Fix pipeline stats bug

* Rename ensemble config fixture

* Add pipeline tests

* Fix config in pipeline tests

* Add training script test

* Fix types and docstrings

* Move and rename to tiled_ensemble

* Fix bug in label joining.

* Remove memory benchmark

* Cleanup files

* Fix metrics setup

* Rename collate function

* Add license to test files

* Rename fixtures

* Add more comments to tiled ensemble training

* Add start of training log message

* Refactor tiler to have explicit arguments

* Refactor pred. storage to have explicit arguments

* Refactor metrics to have explicit arguments

* Refactor visualization to have explicit arguments

* Refactor post-processing to have explicit arguments

* Sort imports

* Add test ensemble script

* Fix join smoothing bug

* Add more documentation to doc-strings

* Remove unused import

* Add brief tiled ensemble documentation

* Update typehints

* Make training args more clear

* Revert addition of no threshold option.

* Refactor normalization and threshold config

* Remove tiled ensemble from docs index

* Add comments to clarify parts of ensemble config

* Improve ensemble config comments

* Add num_tiles attribute to tiler.

* Fix metrics process docstring

* Fix visualization bug and cover with test

* Replace strings with enum

* Improve comments in joiner.

* Fix bug when model doesn't have anomaly maps.

* Improve docstrings (types, clarify).

* Fix visualization tests

* Fix dict membership checks

* Add saving of ensemble config file

* Update test script args

* Cover test script with tests

* Update export warning

* Fix case when no test or val data

* Improve documentation images

* Add images for documentation

* Add codacy suggestion

* Refactor joiner to single class

* Refactor storage names and config

* Update normalization and threshold stage names

* Add transforms independent input size to models

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Make collate function a datamodule attribute

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor tiled ensemble train into pipeline step

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor tiled ensemble prediction into pipeline step

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor tiled ensemble merging into pipeline step

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor tiled ensemble seam smoothing into pipeline step

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor tiled stats calculation into pipeline step

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix ckpt loading when predicting on test set.

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Add logging and add tqdm to pipeline steps.

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor normalization pipeline step

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor thresholding into new pipeline job

* Fix transforms issue when predicting with dataloader

* Add visualization as new pipeline step

* Add metrics as new pipeline step

* Format the code and address some lint problems

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Add code to skip test if test split is none

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Add accelerator to metrics and smoothing

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Make threshold acq helper function and add to threshold to metrics

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Make a separate test pipeline

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Restructure tiled ensemble files into directories

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Pipeline code cleanup

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

* Remove old tiled ensemble files

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Remove old post processing files

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix sigma value read in smoothing

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Update stats calc and normalization

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Update args naming convention

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor code for nice config

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Update docs structure for new system

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Cleanup train code

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix test script args

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Update box merging

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor helper function tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Small changes in helper and engine

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor merging tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor tiling tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor metrics test

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Add support for different threshold methods

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Format tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Change test to predict

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor stats calculation tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor prediction data tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Update metrics tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Move metrics tests to components

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor seam smoothing tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor normalization tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Move mock stats to conftest

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix typehints for generator

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Refactor threshold tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Temporarily disable box minmax

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Add tiled ensemble integration test

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix normalization tests and add additional merging test

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Add tile collater tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Change dataset in tests to dummy

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Format and fix linter errors

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Format and some cleanup

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Rename predict to eval

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Update docs for refactored version of code

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Cleanup the docs

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Update ensemble engine

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Remove boxes from pipelines and tests

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix TODO comment issue

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix unused model in ens. engine

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Fix path case in test

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Change temporary dir to project_path

Signed-off-by: blaz-r <blaz.rolih@gmail.com>

* Change mvtec to MVTec in test path

Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>

---------

Signed-off-by: blaz-r <blaz.rolih@gmail.com>
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 📚 Add training from a checkpoint example (#2389)

* Add training from a checkpoint example

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Replace patchcore example with efficient-ad

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

---------

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Export experiment duration in seconds in CSV. (#2392)

* Export experiment duration in seconds in CSV.

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

* Update CHANGELOG

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

* Log fit and test durations separately.

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

---------

Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* Make single GPU benchmarking 5x more efficient (#2390)

* Use SerialRunner if only one CUDA device is available.

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

* Resolve PLR6201.

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

* Update CHANGELOG.

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

* Keep the same logging level in benchmarking.

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

---------

Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* 🐞 Fix installation package issues (#2395)

* Update the coverage settings

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Remove VlmAd's relative import

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Revert relative imports

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Add type checking

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

---------

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Export the flattened config in benchmark CSV. (#2391)

* Export the flattened config in benchmark CSV.

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

* Update CHANGELOG

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

* Reuse the existing flatten_dict().

Signed-off-by: Weilin Xu <weilin.xu@intel.com>

---------

Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>

* `v1.2.0` Release (#2397)

Prepare v1.2.0 release (#2396)

* Update changelog



* Update the version in __init__



---------

Signed-off-by: Samet Akcay <samet.akcay@intel.com>

* Bump Anomalib version to `2.0.0dev` in `main` (#2402)

Update __init__.py

* 🐞Replace package_available with module_available (#2407)

* fix datumaro config

* fix edge case in benchmarking pipeline

* fix vlm ad

* remove ensemble tiling in preparation of refactor

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>
Signed-off-by: sahusiddharth <siddharth.sahu@plaksha.edu.in>
Signed-off-by: Bepitic <bepitic@gmail.com>
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>
Co-authored-by: Blaž Rolih <61357777+blaz-r@users.noreply.github.com>
Co-authored-by: Ashwin Vaidya <ashwin.vaidya@intel.com>
Co-authored-by: Joao P C Bertoldo <24547377+jpcbertoldo@users.noreply.github.com>
Co-authored-by: Marcus Pertlwieser <116986601+Marcus1506@users.noreply.github.com>
Co-authored-by: Siddharth Sahu <112792547+sahusiddharth@users.noreply.github.com>
Co-authored-by: Paco <bepitic@gmail.com>
Co-authored-by: Weilin Xu <weilin.xu@intel.com>
Co-authored-by: Harim Kang <harim.kang@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add PIMO metric to anomalib
4 participants