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 CFA model #783

Merged
merged 56 commits into from
Jan 11, 2023
Merged

Add CFA model #783

merged 56 commits into from
Jan 11, 2023

Conversation

samet-akcay
Copy link
Contributor

@samet-akcay samet-akcay commented Dec 12, 2022

Description

TODO:

  • Create the benchmark results.

Changes

  • 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)
  • This change requires a documentation update

Checklist

  • My code follows the pre-commit style and check guidelines of this project.
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

@github-actions github-actions bot added the Tests label Dec 12, 2022
@samet-akcay samet-akcay marked this pull request as ready for review December 13, 2022 16:21
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.

Thanks for the efforts! I have a few minor comments.


### Image-Level AUC

| | ResNet-18 | Wide ResNet50 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor issue but we use a horizontal layout in other models.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, but we need to scroll to the side when we have the horizontal layout. I think this one looks better than the old one. If you guys also agree, we could maybe change the layout for other models?

anomalib/models/cfa/README.md Show resolved Hide resolved
configs/model/cfa.yaml Show resolved Hide resolved
normalize: bool = True,
border_type: str = "reflect",
padding: str = "same",
) -> None:
"""Initialize model, setup kernel etc..

Args:
kernel_size (Union[Tuple[int, int], int]): size of the Gaussian kernel to use.
sigma (Union[Tuple[float, float], float]): standard deviation to use for constructing the Gaussian kernel.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not part of this PR but should we move these init_args above to make it consistent with other classes?

anomalib/models/cfa/config.yaml Show resolved Hide resolved
anomalib/models/cfa/torch_model.py Outdated Show resolved Hide resolved
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 have a few comments, all minor

anomalib/models/cfa/config.yaml Show resolved Hide resolved
anomalib/models/cfa/config.yaml Outdated Show resolved Hide resolved
anomalib/models/cfa/lightning_model.py Show resolved Hide resolved
anomalib/models/cfa/torch_model.py Show resolved Hide resolved
anomalib/models/cfa/torch_model.py Show resolved Hide resolved
anomalib/models/cfa/torch_model.py Outdated Show resolved Hide resolved
anomalib/models/cfa/torch_model.py Outdated Show resolved Hide resolved
Returns:
int: Kernel size.
"""
return 2 * int(4.0 * sigma_val + 0.5) + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

We use the same computation in Padim (here), and maybe other models as well. Would be good to use this function there as well.

@samet-akcay samet-akcay enabled auto-merge (squash) January 11, 2023 09:57
@samet-akcay samet-akcay disabled auto-merge January 11, 2023 09:57
@samet-akcay samet-akcay merged commit 875cb85 into main Jan 11, 2023
@samet-akcay samet-akcay deleted the feature/model/cfa branch January 11, 2023 09:57
NagatoYuki0943 added a commit to NagatoYuki0943/anomalib that referenced this pull request Jan 12, 2023
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.

Implementing "CFA for Target-Oriented Anomaly Localization"
3 participants