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

efficient ad #1128

Merged
merged 3 commits into from
Aug 21, 2024
Merged

efficient ad #1128

merged 3 commits into from
Aug 21, 2024

Conversation

samuel-wj-chapman
Copy link
Collaborator

@samuel-wj-chapman samuel-wj-chapman commented Jul 18, 2024

Pull Request Description:

Addition of anomaly detection model

Checklist before requesting a review:

  • I set the appropriate labels on the pull request.
  • I have added/updated the release note draft (if necessary).
  • I have updated the documentation to reflect my changes (if necessary).
  • All function and files are well documented.
  • All function and classes have type hints.
  • There is a licenses in all file.
  • The function and variable names are informative.
  • I have checked for code duplications.
  • I have added new unittest (if necessary).

@Idan-BenAmi
Copy link
Collaborator

Hi Samuel, several comments:

  • Dataset link - maybe require a note about mvtec license?
  • Function names - keep our coding conventions (function names with snack case, classes with camel case)
  • Training - very nice, let's talk if it this is not out of context.
  • notebook Text - use US english speller, for alignment (..my apologies :)
  • notebook Text - add links (to Mvtec, to efficientAD paper)
  • New files/functions - let's talk where to locate the new files
  • Link to the new tutorial from imx500 notebooks README

@samuel-wj-chapman
Copy link
Collaborator Author

@Idan-BenAmi should be good for review

# * Uninfied version of model combining the three subversions
# ==============================================================================
"""
Yolov8n Object Detection Model - PyTorch implementation
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo

sample, target = super().__getitem__(index)
return sample, target, path

def InfiniteDataloader(loader):
Copy link
Collaborator

Choose a reason for hiding this comment

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

rename to snack case: infinite_dataloader

sample, _ = super().__getitem__(index)
return sample

class ImageFolderWithPath(datasets.ImageFolder):
Copy link
Collaborator

Choose a reason for hiding this comment

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

we already have a similar function, maybe can be reused..

"""Apply transformations to the training images."""
return DEFAULT_TRANSFORM(image), DEFAULT_TRANSFORM(TRANSFORM_AE(image))

def benchmark(unified_model, name):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if this code more isn't more suitable for "metric evaluation" folder.

"\n",
"Anomaly detection models are useful as they only require your typical images to train and can in theory determin anything that is not typical.\n",
"\n",
"We use Efficient ad, one of the top performing anomaly detection models on the mvtec benchmark. benchmark leader board can be found [here](https://paperswithcode.com/sota/anomaly-detection-on-mvtec-ad)\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We use Efficient ad --> add link
on the mvtec benchmark --> add link (if available)

"id": "tGqXJH15oLvm"
},
"source": [
"Download and extract the mvtec benchmark dataset. This is used for both training and evaluation. Link below is a direct linkk from the mcvtec website."
Copy link
Collaborator

Choose a reason for hiding this comment

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

direct linkk -- >direct link
from the mcvtec website -- >add link


This code contains a PyTorch implementation of efficient ad model, following
https://github.com/nelson1425/EfficientAD. This implementation includes a unified version of the model that combines the three submodels
into one to ease the process of quantisation and deployment.
Copy link
Collaborator

Choose a reason for hiding this comment

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

quantisation --> quantization

"source": [
"Classification models are powerful and reliable, but what if you have little or no examples of one of your classes, what if one of your classes contains too much unpredictable variation?\n",
"\n",
"Here we go through the process of building, training and quantising an anomaly detection model designed to solve exactly these problems.\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

quantising --> quantizing

"id": "_fPTNtJLgPc5"
},
"source": [
"## Quantised model benchmark\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Quantised --> Quantized

"source": [
"## Conclusion\n",
"\n",
"In this notebook we provide examples on how to quantise and benchmark the latest anomaly detection model as well as providing code to visulize the models output."
Copy link
Collaborator

Choose a reason for hiding this comment

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

quantise --> quantize

@samuel-wj-chapman samuel-wj-chapman merged commit 5a30132 into sony:main Aug 21, 2024
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants