Skip to main content

Synthetic image metrics - An evaluation framework for your synthetic images

Project description

Simet

Simet is a lightweight, extensible framework for evaluating synthetic image datasets against real datasets. It gives you:

  • A unified pipeline to load images (from local folders or built-in datasets), apply transforms, extract features (Inception-v3 out of the box), and run metrics such as FID, Precision/Recall (FAISS), and ROC-AUC.
  • Restraints (threshold checks) to enforce quality bars (e.g., FID ≤ 40, ROC-AUC ≥ 0.85) and return a single pass/fail.
  • A CLI for simple or fully-configurable runs, and a clean Python API for scripting.
  • Practical scalability features: feature caching, subsampling, FAISS IVF indexes, optional AMP, and deterministic seeding.

Installation

pip install simet

Python 3.12 is needed. CUDA is optional (for faster feature extraction and FAISS GPU support).


Quick start

1) Fast check with the CLI (simple two-paths mode)

simet simple /path/to/real_images /path/to/synth_images

Runs a minimal pipeline (no restraints) using default transforms and Inception-v3 feature extraction, printing metric (FID, Precision/Recall, ROC AUC) results.

2) Full pipeline from YAML

simet pipeline pipeline.yaml

pipeline.yaml example:

pipeline:
  loader:
    real_provider:
      type: LocalProviderWithoutClass
      path: data/real
    synth_provider:
      type: LocalProviderWithoutClass
      path: data/synth
    provider_transform:
      type: InceptionTransform
    feature_extractor:
      type: InceptionFeatureExtractor

  restraints:
    - type: FIDRestraint
      upper_bound: 40.0
    - type: PrecisionRecallRestraint
      lower_bound: [0.70, 0.60]
    - type: RocAucRestraint
      lower_bound: 0.85

CLI returns exit code 0 if all restraints pass.


Python API

from pathlib import Path
from simet.dataset_loaders import DatasetLoader
from simet.feature_extractor import InceptionFeatureExtractor
from simet.pipeline import Pipeline
from simet.providers import LocalProviderWithoutClass
from simet.restraints import FIDRestraint, PrecisionRecallRestraint, RocAucRestraint
from simet.services import LoggingService, SeedingService
from simet.transforms import InceptionTransform

LoggingService.setup_logging()
SeedingService.set_global_seed(42)

loader = DatasetLoader(
    real_provider=LocalProviderWithoutClass(Path("data/real")),
    synth_provider=LocalProviderWithoutClass(Path("data/synth")),
    provider_transform=InceptionTransform(),
    feature_extractor=InceptionFeatureExtractor(),
)

pipeline = Pipeline(
    loader=loader,
    restraints=[
        FIDRestraint(upper_bound=40.0),
        PrecisionRecallRestraint(lower_bound=[0.70, 0.60]),
        RocAucRestraint(lower_bound=0.85),
    ],
)

ok = pipeline.run()
print("PASS" if ok else "FAIL")

CLI reference

simet simple REAL_PATH SYNTH_PATH [--log-path LOG_DIR]

Run a simple pipeline with default settings.

simet simple-pipeline CONFIG_PATH [--log-path LOG_DIR]

Run YAML mode without restraints.

Example simple.yaml:

pipeline:
  real_path: data/real
  synth_path: data/synth
  metrics: [FID, PrecisionRecall, RocAuc]

Specifying no metrics will run all available (FID, Precision/Recall, ROC AUC).

simet pipeline CONFIG_PATH [--log-path LOG_DIR]

Run the full configurable pipeline (providers, transforms, feature extractor, restraints).


Concepts & Extensibility

  • Providerssimet.providers: local or built-in datasets.
  • Transformssimet.transforms: image preprocessing (e.g. InceptionTransform).
  • Feature Extractorssimet.feature_extractor: cached Inception-v3 features.
  • Metricssimet.metrics: FID, Precision/Recall (FAISS), ROC-AUC.
  • Restraintssimet.restraints: wrap metrics with thresholds.
  • Services → logging, seeding, caching, subsampling.

Add custom components by subclassing:

Provider → providers.base.Provider
Transform → transforms.base.Transform
Feature Extractor → feature_extractor.FeatureExtractor
Metric → metrics.base.Metric
Restraint → restraints.base.Restraint[T]

and register them via the corresponding *Parser.


Scalability notes

  • FAISS IVF & batched search for large sets
  • GPU / AMP support
  • Feature caching per dataset hash
  • Subsampling to balance dataset sizes
  • Deterministic seeding via SeedingService

Examples

See main for a complete demo.


License

MIT (or your chosen license)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simet-1.0.0.post1.tar.gz (60.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simet-1.0.0.post1-py3-none-any.whl (86.9 kB view details)

Uploaded Python 3

File details

Details for the file simet-1.0.0.post1.tar.gz.

File metadata

  • Download URL: simet-1.0.0.post1.tar.gz
  • Upload date:
  • Size: 60.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.23

File hashes

Hashes for simet-1.0.0.post1.tar.gz
Algorithm Hash digest
SHA256 663a93e78cd61a936adfc2f510592bcf1311bf4927f61372a6c8ebca5ad7fa04
MD5 31e0483f223932df92d9d11e51254520
BLAKE2b-256 27ea11a91c75a04abc00ebbd48e3181434b0d037ac2641ce5eb119e7465107a4

See more details on using hashes here.

File details

Details for the file simet-1.0.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for simet-1.0.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c17f5d6a7a8824e146cefc2d859ce5f3493f9c738a76f185f0a41b6fc3b609a
MD5 75dc156485eccef37a2f30a9c16cbd82
BLAKE2b-256 11e562c73d654fb50ee014953e085628647b3680e9f8bd808fb9b153b6037adb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page