Sinapsis Anomalib
Train, export and run industrial/visual anomaly detectors with anomalib.
Overview
sinapsis-anomalib — Templates for anomaly detection with computer vision using anomalib library.
Anomaly detection is useful when normal examples are abundant but defect examples are rare. Templates expose training, checkpoint export and inference so an inspection system can evolve without rewriting its surrounding data flow.
Where it fits
Model assumptions and threshold calibration matter, especially when deployment conditions differ from training. Optional logging and VLM features are not required for baseline anomaly detection.
Installation
Requires Python 3.13 or later, as declared in this package’s manifest. Install the base distribution using your preferred package manager:
uv pip install sinapsis-anomalib
# or
pip install sinapsis-anomalib
Optional features and dependencies
The base installation includes the dependencies required by the package. The following extras are declared in this package’s pyproject.toml; install only those needed by your workflow. They are standard Python optional dependencies, not separate execution profiles.
| Extra | Adds / when to select it |
|---|---|
vlm |
Vision-language model integration. Dependencies: python-dotenv, transformers, openai, ollama |
loggers |
Additional training or experiment logging. Dependencies: comet, mlflow, tensorboard, wandb |
all |
Bundle declared by this package; its manifest includes vlm, loggers. |
For example:
uv pip install "sinapsis-anomalib[vlm]"
The manifest also defines development-only dependency groups: dev (pre-commit, ruff, ty). These support source development and testing and are not runtime extras.
🚀 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.
For example, for CflowTrain use sinx templates example-config CflowTrain to produce the following example config:
agent:
name: my_sinapsis_anomalib_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: CflowTrain
class_name: CflowTrain
template_input: InputTemplate
attributes:
folder_attributes:
name: 'dataset'
root: null
normal_dir: 'images/normal'
abnormal_dir: null
normal_test_dir: null
mask_dir: null
normal_split_ratio: 0.2
extensions: null
train_batch_size: 32
eval_batch_size: 32
num_workers: 8
test_split_mode:
- from_dir
test_split_ratio: 0.2
val_split_mode:
- from_test
val_split_ratio: 0.5
seed: null
callbacks: null
normalization: null
threshold: null
image_metrics: null
pixel_metrics: null
logger: null
callback_configs: null
logger_configs: null
ckpt_path: null
train_root: null
trainer_args:
devices: auto
accelerator: cpu
min_epochs: 1
max_epochs: 5
cflow_init:
backbone: wide_resnet50_2
layers:
- layer2
- layer3
- layer4
pre_trained: true
fiber_batch_size: 64
decoder: freia-cflow
condition_vector: 128
coupling_blocks: 8
clamp_alpha: 1.9
permute_soft: false
lr: 0.0001
pre_processor: true
post_processor: true
evaluator: true
visualizer: true
🚫 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.
Example Agent
The following is adapted directly from the package’s shipped torch_demo.yml configuration. Save it as my_anomalib_agent.yaml. The example may require model checkpoints, input files, additional Template packages, or provider credentials as described in its configuration.
agent:
name: my_anomalib_agent
description: "Agent to perform torch classificaction inference and draw resulting label."
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: AnomalibTorchInference
class_name: AnomalibTorchInference
template_input: InputTemplate
attributes:
model_path: "artifacts/exported_models/weights/torch/model.pt"
device: "cuda"
- template_name: BBoxDrawer
class_name: BBoxDrawer
template_input: AnomalibTorchInference
attributes:
randomized_color: false
draw_classification_label: false
- template_name: SegmentationMaskDrawer
class_name: SegmentationMaskDrawer
template_input: BBoxDrawer
attributes:
overwrite: true
randomized_color: false
draw_classification_label: false
sinx jobs run my_anomalib_agent.yaml
More configurations: export_from_ckpt_path.yaml, torch_demo.yml, openvino_demo.yml, train.yaml, patchcore_train_export_unsupervised.yaml, train_export.yaml, train_export_unsupervised.yaml, torch_from_dataset.yml, openvino_from_dataset.yml, cflow_train_export_unsupervised.yaml.
Documentation
License
Sinapsis open-source components are available under your choice of the MIT License or the Apache License 2.0, unless otherwise noted.
Metadata
Release files for sinapsis-anomalib 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sinapsis_anomalib-1.0.0.tar.gz | 277.2 kB | Without provenance | Details for sinapsis_anomalib-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sinapsis_anomalib-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sinapsis_anomalib-1.0.0-py3-none-any.whl |
Total release size: 311.5 kB
Release files / sinapsis_anomalib-1.0.0.tar.gz
| Download URL | sinapsis_anomalib-1.0.0.tar.gz |
|---|---|
| Size | 277.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
706c9b5227e9cfbcd8c8f5f8aee1a6a03e3adae8fb59d01e0f600a85b9bf0a93
|
|
BLAKE2b-256 checksum How to use checksums |
6bda4b14a05ab206967726dd8aab3de8113f7dababf735d628f985873e03e0d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Release files / sinapsis_anomalib-1.0.0-py3-none-any.whl
| Download URL | sinapsis_anomalib-1.0.0-py3-none-any.whl |
|---|---|
| Size | 34.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa25009d6479d6999a84b79663bc085de1fdb1198d1de25313adc0f17d61070b
|
|
BLAKE2b-256 checksum How to use checksums |
a13298619aa00488fb880042600a54a4ec29c8413ef43c64ac590c443d3b745b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Security for sinapsis-anomalib 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.