Coder Social home page Coder Social logo

guoyang-xie / anodet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openaoi/anodet

0.0 0.0 0.0 5.89 MB

Anomaly detection on images using features from pretrained neural networks.

License: MIT License

Python 2.81% Jupyter Notebook 97.19%

anodet's Introduction

anodet

A set of functions and classes for performing anomaly detection in images using features from pretrained neural networks.

The package includes functions and classes for extracting, modifying and comparing features. It also includes unofficial implementations of PaDiM and PatchCore.

Some code has been borrowed and/or inspired by other repositories, see code reference below.

See wiki for documentation.

Example result with padim on image from MVTEC dataset

Installation

Clone the repository

git clone https://github.com/OpenAOI/anodet.git

Install the package

cd anodet
python -m pip install -r requirements.txt
python -m pip install .

Usage example

# Prepare a dataloader and fit a model to the data
dataloader = DataLoader(...)
padim = anodet.Padim() 
padim.fit(dataloader)

# Prepare some test images and make predictions
batch = ...
image_scores, score_map = padim.predict(batch) 

See notebooks for in depth examples.

Development setup

Install

Install the package in editable mode

python -m pip install --editable [PATH TO REPOSITORY]

Tests

Install packages for testing

python -m pip install pytest pytest-mypy pytest-flake8

Run tests

cd [PATH TO REPOSITORY]
pytest --mypy --flake8

For configuration of pytest, mypy and flake8 edit setup.cfg.

Creating docs

Install pydoc-markdown

python -m pip install pydoc-markdown

Clone docs repository

git clone https://github.com/OpenAOI/anodet.wiki.git

Run script

cd anodet.wiki
python generate_docs.py --source-path=[PATH TO REPOSITORY] --package-name="anodet" --save-path=.

Code Reference

PaDiM: https://arxiv.org/abs/2011.08785

PatchCore: https://arxiv.org/abs/2106.08265

Some parts used in patch_core.py : https://github.com/hcw-00/PatchCore_anomaly_detection

Code in directory sampling_methods : https://github.com/google/active-learning

concatenate_two_layers function in feature_extraction.py : https://github.com/xiahaifeng1995/PaDiM-Anomaly-Detection-Localization-master

pytorch_cov function in utils.py : pytorch/pytorch#19037

anodet's People

Contributors

antonemanuel avatar antonmaxen avatar henrikbjorserud avatar henrikliman avatar victorolof avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.