Skip to main content

Hybrid Sample Generation

Python License: GPL v3 Tests Coverage DOI:AMLDS63918.2025.11159383 DOI:AMLDS69611.2026.11723773

This project extracts real anomalies from labelled 2D images or 3D volumes, trains a generative model, creates multiple synthetic variants and places them into original control samples. It is based on the IEEE papers AMLDS63918.2025.11159383 and AMLDS69611.2026.11723773.

Documentation: https://pfleiderer-adrian.github.io/HybridSampleGeneration/

High-level overview of hybrid sample generation

Installation

Python 3.10 or newer is required. Install PyTorch for your CPU/CUDA environment first if you need a specific build, then:

python -m pip install hybrid-sample-generator

For development or the bundled examples, install from a checkout with python -m pip install -e ".[examples]". The installation guide covers optional dependencies such as image harmonization.

Usage

from hybrid_sample_generator.configuration import Configuration
from hybrid_sample_generator.pipeline.hybrid_data_generator import HybridDataGenerator

config = Configuration("study-01", study_folder="results/study-01")
config.extraction.anomaly_size = (1, 32, 32)   # (C, H, W) of the anomaly cutouts
config.model.set_model("cVAE_ConvNeXt_2D")

generator = HybridDataGenerator(config)
generator.ingest_dataset(dataloader)       # yields (image, segmentation, source_name)
generator.extract_anomalies()
generator.train_generator()
generator.generate_synthetic_anomalies()
generator.plan_hybrid_samples()
generator.materialize_hybrid_samples()

hybrids = generator.datasets.hybrid_samples(numpy_mode=True)

dataloader is any iterable over channel-first arrays; anomalous samples have a positive segmentation mask, controls an empty one. The quick start contains a complete script that runs without data files.

Documentation

Topic Pages
Getting started Installation · Quick start
Pipeline Overview · Input data · Extraction · Training · Synthetic variants · Hybrid planning · Fusion
Results Postprocessing · Evaluation · Visualization · Continuing a study
Concepts Data model and storage · Datasets · Glossary
Reference Configuration · Generator models
Benchmark MVTec AD 2
Development Contributing · Tests · Releases

LLM usage statement

LLM-assisted coding, writing, and analysis are becoming standard in both industry and research. While these tools entail risks, we believe that, combined with careful verification of all generated content, they can accelerate scientific progress. This, however, requires uncompromising transparency about which tools contributed to the results and to what extent:

  • Implementation and documentation: Claude (Anthropic) and Codex (OpenAI) were used as assistants for implementing, refactoring, and debugging parts of the framework, and for writing and editing this README and the code comments. All code and documentation were reviewed and validated by the maintainers.
  • Design and experiments: The architecture, the method, and all experimental decisions originate from the maintainers.
  • Models inside the pipeline: Pretrained models that the framework calls at runtime (e.g., the LBM harmonization model) are components of the method, not development assistance.

If you find an error, please open an issue. Thank you!!

Cite this work

@INPROCEEDINGS{11723773,
  author={Pfleiderer, Adrian and Bauer, Bernhard},
  booktitle={2026 2nd International Conference on Advanced Machine Learning and Data Science (AMLDS)},
  title={Hybrid Data Generator as a Generalizable Approach for Optimized Training Data Sets},
  year={2026},
  pages={72-79},
  doi={10.1109/AMLDS69611.2026.11723773}
}

License

This project is licensed under the GNU General Public License v3.0. See LICENSE for the complete terms.

Metadata

Release files for hybrid-sample-generator 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hybrid-sample-generator 1.0.9
File Size Uploaded Provenance Actions
hybrid_sample_generator-1.0.9.tar.gz 5.5 MB With provenance Details for hybrid_sample_generator-1.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hybrid-sample-generator 1.0.9
File Interpreter ABI Platform Actions
hybrid_sample_generator-1.0.9-py3-none-any.whl Python 3 none any Details for hybrid_sample_generator-1.0.9-py3-none-any.whl

Total release size: 5.7 MB

Release files / hybrid_sample_generator-1.0.9.tar.gz

Download URL hybrid_sample_generator-1.0.9.tar.gz
Size 5.5 MB
Tags Source
SHA-256 checksum
How to use checksums
5a7d3a54c81dbac858a89f0f98c721bb6d3c6cb6700d3445030e2639a493f6eb
BLAKE2b-256 checksum
How to use checksums
67b4f70ab2ccf7d1d1b828055f560ea17010dd46043d6766e8d20d1a91e05b96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / hybrid_sample_generator-1.0.9-py3-none-any.whl

Download URL hybrid_sample_generator-1.0.9-py3-none-any.whl
Size 215.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61cd414dae30326c4d594f35dfffa31fc20bcd0ebcfdbd0c2ef35f5343279e46
BLAKE2b-256 checksum
How to use checksums
1fcd91639e110d217b540e73579b8cf7028f7dabc2df4aa308606d16e04b2ad3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for hybrid-sample-generator 1.0.9

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hybrid_sample_generator-1.0.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page