Templates for anomaly detection with computer vision using anomalib library.
Project description
Sinapsis Anomalib
Module to provide anomaly detection training, inference and export with Anomalib.
🐍 Installation • 🚀 Features • 📚 Usage Example • 📙 Documentation • 🔍 License
🐍 Installation
Install using your package manager of choice. We encourage the use of uv
Example with uv:
uv pip install sinapsis-anomalib --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-anomalib --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Templates in each package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
with uv:
uv pip install sinapsis-anomalib[all] --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-anomalib[all] --extra-index-url https://pypi.sinapsis.tech
🚀 Features
Templates Supported
The Sinapsis Anomalib provides a powerful and flexible implementation for anomaly detection with Anomalib library.
- AnomalibTorchInference
Run anomaly detection inference using PyTorch models. - AnomalibOpenVINOInference
Perform optimized inference using OpenVINO-accelerated models. - AnomalibTrain
Train custom anomaly detection models with Anomalib. - AnomalibExport
Export trained models for deployment in different formats.
[!TIP] Use CLI command
sinapsis info --all-template-namesto show a list with all the available Template names installed with Sinapsis Anomalib.
[!TIP] Use CLI command
sinapsis info --example-template-config TEMPLATE_NAMEto produce an example Agent config for the Template specified in TEMPLATE_NAME.
For example, for CfaTrain use sinapsis info --example-template-config CfaTrain to produce the following example config:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: CfaTrain
class_name: CfaTrain
template_input: InputTemplate
attributes:
folder_attributes_config_path: null
generic_key: 'my_generic_key'
callbacks: null
normalization: null
threshold: null
image_metrics: null
pixel_metrics: null
logger: null
default_root_dir: null
callback_configs: null
logger_configs: null
max_epochs: null
ckpt_path: null
cfa_init:
backbone: wide_resnet50_2
gamma_c: 1
gamma_d: 1
num_nearest_neighbors: 3
num_hard_negative_features: 3
radius: 1.0e-05
🚫 Excluded Models
Some models that required additional configuration have been excluded and support for this will be included in future releases.
- EfficientAd
- VlmAd
- Cfa
- Dfkde
- Fastflow
- Supersimplenet
- AiVad
For all other supported models, refer to the Anomalib documentation linked above.
📚 Usage Example
Below is an example configuration for **Sinapsis Anomalib** using a CFLOW model. This setup trains an anomaly detection model with configurable hyperparameters, including learning rate and epochs, and exports it in OpenVINO format for optimized inference. The pipeline includes training, model export, and predefined paths for outputs.Example config
agent:
name: anomalib_train_export
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: CflowTrain
class_name: CflowTrain
attributes:
folder_attributes_config_path: "configs/datamodule_config.yml"
default_root_dir: "results/model"
max_epochs: 1
cflow_init:
lr: 0.0001
- template_name: CflowExport
class_name: CflowExport
attributes:
generic_key_chkpt: "CflowTrain"
export_type: "openvino"
export_root: "results/model/exported"
This configuration defines an agent and a sequence of templates to train and export a model based on a certain data configuration.
[!IMPORTANT] Attributes specified under the
*_initkeys (e.g.,cflow_init) correspond directly to the Anomalib models parameters. Ensure that values are assigned correctly according to the official Anomalib documentation, as they affect the behavior and performance of the model.
To run the config, use the CLI:
sinapsis run name_of_config.yml
📙 Documentation
Documentation for this and other sinapsis packages is available on the sinapsis website
Tutorials for different projects within sinapsis are available at sinapsis tutorials page
🔍 License
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sinapsis_anomalib-0.1.6.tar.gz.
File metadata
- Download URL: sinapsis_anomalib-0.1.6.tar.gz
- Upload date:
- Size: 28.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54d2dc5f9a61cc4225132cbb9a2a403d1043f8580abf670d9dab71508384dc9b
|
|
| MD5 |
1da55d29e44731a770b06ca72d0feb0a
|
|
| BLAKE2b-256 |
d9132a9aa73b138349684734a704e92526813d8198a425cb38434342ab630937
|
File details
Details for the file sinapsis_anomalib-0.1.6-py3-none-any.whl.
File metadata
- Download URL: sinapsis_anomalib-0.1.6-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bf830092231b6c60532428fa86a19393bceec8d51f03e498842fda25871f5ba
|
|
| MD5 |
f8513003a37daaebebbf5e848f12eb3f
|
|
| BLAKE2b-256 |
2387f763add3fcca74298d825cbe260114eea110ece3701a88889b17c44d93d7
|