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
- Providers →
simet.providers: local or built-in datasets. - Transforms →
simet.transforms: image preprocessing (e.g.InceptionTransform). - Feature Extractors →
simet.feature_extractor: cached Inception-v3 features. - Metrics →
simet.metrics: FID, Precision/Recall (FAISS), ROC-AUC. - Restraints →
simet.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
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 simet-1.0.0.tar.gz.
File metadata
- Download URL: simet-1.0.0.tar.gz
- Upload date:
- Size: 59.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
853805065241f26480218c09960e303aab610fed048a32d7027014c20088496c
|
|
| MD5 |
e92aaf9581816100a2f6cd4245e16164
|
|
| BLAKE2b-256 |
bd6cd89c5f75fc1d936e830352d73f6431d807ebe0bb8ada07e1907e96e9e2b4
|
File details
Details for the file simet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: simet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 86.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1303f094bd4a9bf466dc2a0173da73f95293429b74784b9c4159421468f4bbc5
|
|
| MD5 |
bdd49f495f3019145613c84e094c23b9
|
|
| BLAKE2b-256 |
ac7712e55d39783a54be594fba3bb244c6c0b19a0de4df4c5dbcd74d151ba327
|