Skip to content

Releases: joheras/imgad

imgad 0.6.0

Choose a tag to compare

@joheras joheras released this 17 Oct 12:01
566090b

Zero- and few-shot detection

  • zero_shot detector: anomaly scores from text prompts describing normal and anomalous findings, with no training images.
    • With a few normal images it also uses their distance to the test image (few-shot).
    • Prompt sets per modality are in imgad.prompts.
    • Works with CLIP/SigLIP, BiomedCLIP, MedSigLIP and the retinal vision–language models FLAIR and RetiZero (zoo:flair-clip, zoo:retizero-clip; imgad models --zero-shot).
  • Few-shot protocol: k_shots=[0, 1, 2, 4, …] (--k-shots) runs every configuration with k normal images per seed. The report adds learning curves.
  • Fault-tolerant benchmarks: a run that fails is recorded with its error and the benchmark continues.
    • Covered failures: model loading, feature extraction, detector, Anomalib, and dead worker processes.
    • --stop-on-error restores stopping at the first failure.
  • kNN works from a single training image.

Guide: https://joheras.github.io/imgad/guide/zero-shot/

This work is partially supported by Agencia de Desarrollo Económico de La Rioja [ADER 2022-I-IDI-00015].

imgad 0.5.0

Choose a tag to compare

@joheras joheras released this 17 Oct 10:51
c8181db

Ophthalmology

  • Retinal foundation models in the zoo (imgad models -m fundus, -m oct):

    • RETFound (CFP, OCT, DINOv2; official gated weights);
    • RETFound-Green;
    • VisionFM (fundus, OCT);
    • RetiZero;
    • FLAIR;
    • UrFound;
    • public timm copies of RETFound.

    Each comes with its access, license and intended use.

  • Raw checkpoints in the timm extractor:

    • checkpoint (hf-hub:org/repo/file, a URL, gdrive:<id>/<name> or a path), checkpoint_key, checkpoint_prefix and data_config;
    • read with torch.load(weights_only=True), so no code from the file is executed;
    • LoRA adapters merged, position embeddings resampled, missing weights reported.
  • Ophthalmology guide: https://joheras.github.io/imgad/ophthalmology/ covers the models, the retinal anomaly-detection literature, benchmarks (BMAD, MVFA, BenchReAD) and eye-specific evaluation pitfalls.

Install: pip install "imgad[medical]"

This work is partially supported by Agencia de Desarrollo Económico de La Rioja [ADER 2022-I-IDI-00015].

imgad 0.4.0

Choose a tag to compare

@joheras joheras released this 17 Oct 10:25
07da016

Medical imaging

  • 16-bit, DICOM and NIfTI images with configurable intensity rules (auto, minmax, percentile:lo,hi, window:lo,hi, dicom), slice references (file.nii.gz::z=42) and volume_slices() for volumes. Patient metadata is never read or stored.
  • Medical model zoo (imgad models): curated extractors per modality (RAD-DINO, MedSigLIP, BiomedCLIP, UNI/UNI2-h, Virchow2, H-optimus-0, Prov-GigaPath, Phikon-v2 and general baselines) with access, license and intended use; zoo:<name> in pipelines and benchmark YAML, --check for Hub access, --yaml to generate a benchmark block.
  • timm extractor (type: timm) with auto/cls/mean/cls+mean pooling, including hf-hub: checkpoints.
  • Documentation website: https://joheras.github.io/imgad/

Install: pip install "imgad[medical]"

This work is partially supported by Agencia de Desarrollo Económico de La Rioja [ADER 2022-I-IDI-00015].

imgad 0.3.0

Choose a tag to compare

@joheras joheras released this 17 Oct 09:43
6d95499
pip install --upgrade imgad

New

  • Parallel benchmarks with several models per GPU.
    • Run with imgad benchmark -j 8 --devices auto, or benchmark(..., n_jobs=8, devices="auto") from Python.
    • Each feature extractor and each Anomalib run is a GPU job.
    • Availability checks: GPUs and free memory are read with nvidia-smi/NVML. A job starts only when its estimated memory fits in the free memory. The estimate starts from the checkpoint size, then uses the peak measured for that model.
    • Out of memory: a job that runs out of memory is retried alone on an idle device.
    • Pipelining: detector runs start on a CPU process pool as soon as the features are ready.
    • Identical results: same rows as the sequential run.
    • Options: --jobs, --devices, --gpu-jobs, --gpu-mem-gb, or a parallel: section in the YAML.
  • imgad devices [--config cfg.yaml]: shows the GPUs, their free memory, and the estimated memory of each model in a benchmark.

On a laptop GPU (8 GB), a benchmark with three ViT extractors, five detectors and PatchCore went from 59 s to 32 s, with identical results.

This work is partially supported by Agencia de Desarrollo Económico de La Rioja [ADER 2022-I-IDI-00015].

imgad 0.2.0

Choose a tag to compare

@joheras joheras released this 16 Oct 13:48
ca1cc8b
pip install --upgrade imgad

New

  • Gated and private Hugging Face models (e.g. DINOv3):
    • Token: taken from token= / --hf-token-file, the HF_TOKEN environment variable, or imgad hf-login. It is never saved in pipelines, configs, cache keys, reports or logs.
    • Clear errors: GatedModelError explains what to do (accept the conditions, log in, or replace a rejected token).
    • Check access: imgad hf-check MODEL... or imgad hf-check --config cfg.yaml.
    • Benchmark preflight: benchmarks check access to every Hub model before doing any work.
    • Local cache: without access, a model that is already in the local Hugging Face cache is loaded from there.
  • Benchmark progress reporting:
    • plan, current phase, and one line per finished run with a global counter, metrics, elapsed time and an ETA estimated per kind of work;
    • the exact step is logged when a run fails;
    • -q, -v and --log-file for imgad benchmark and imgad report.

Fixes

  • Reports no longer emit nanmean warnings for configurations without pixel metrics.

This work is partially supported by Agencia de Desarrollo Económico de La Rioja [ADER 2022-I-IDI-00015].

imgad 0.1.0

Choose a tag to compare

@joheras joheras released this 16 Oct 12:43
d4f0b52

First public release of imgad, a framework for image anomaly detection in the one-class setting.

pip install imgad                 # core
pip install "imgad[anomalib]"     # + Anomalib models
pip install "imgad[report]"       # + figures in benchmark reports

Highlights

  • Foundation-model features + classical detectors. Any Hugging Face vision model (CLIP, SigLIP, DINOv2…) or open_clip checkpoint can be used, with pooling and intermediate layers. There are 13 one-class detectors (kNN, Mahalanobis, LOF, OCSVM, Isolation Forest, PCA, ensembles, sklearn/PyOD wrappers…). The threshold is calibrated on out-of-sample normal scores.
  • Anomalib backend. Includes PatchCore, PaDiM, EfficientAD, FastFlow, STFPM… with pixel-level anomaly maps, heatmap/mask export and pixel metrics (pixel-AUROC, AUPRO).
  • Inference tools. AnomalyPredictor works on images or folders, with CSV/JSON output, threshold calibration (f1, youden, fpr, tpr) and streaming for large folders.
  • Benchmarking. Covers extractor × detector grids and Anomalib models, repeated runs with seeds and training subsets, and bootstrap confidence intervals. Statistical tests include DeLong, paired bootstrap, Friedman + Nemenyi with a CD diagram, and Wilcoxon-Holm.
  • Automatic markdown reports (imgad benchmark --report DIR). They include data analysis, methods, results with figures, and a discussion.
  • CLI: imgad list | fit | predict | calibrate | info | benchmark | stats | report.

Example results: benchmarks/mvtec_4categories/ (5 extractors × 11 detectors on 4 MVTec AD categories).

This work is partially supported by Agencia de Desarrollo Económico de La Rioja [ADER 2022-I-IDI-00015].