Skip to main content

A package for generating images with diffusion

Project description

Diffusion-Based Image Generation

Overview

This project implements diffusion-based generative models for image synthesis. It provides a comprehensive framework for training and using diffusion models, with support for various diffusion processes, noise schedules, and sampling methods.

Features

  • Multiple Diffusion Processes: Support for Variance Exploding (VE), Variance Preserving (VP), and other diffusion types
  • Customizable Noise Schedules: Linear, Cosine, and custom noise schedules
  • Various Samplers: Euler-Maruyama, Exponential Integrator, ODE Probability Flow, and Predictor-Corrector samplers
  • Advanced Generation Capabilities:
    • Unconditional image generation
    • Class-conditional image generation
    • Image colorization
    • Image inpainting/imputation
  • Interactive Dashboard: Built with Streamlit for easy model interaction

Installation

Clone the repository:

git clone https://github.com/HectorTablero/image-gen.git
cd image-gen
pip install -e .

Usage

Basic Generation

from diffusion_image_gen.base import GenerativeModel

# Load a pre-trained model
model = GenerativeModel.load("path/to/model.pt")

# Generate images
images = model.generate(num_images=4, n_steps=500, seed=42)

Colorization

# Colorize a grayscale image
colorized = model.colorize(grayscale_image, n_steps=500)

Image Inpainting

# Perform inpainting with a mask
inpainted = model.imputation(image, mask, n_steps=500)

Interactive Dashboard

Run the dashboard to interact with your models:

streamlit run dashboard.py

Documentation

The project includes automatically generated documentation. To view it locally:

# Build the documentation
mkdocs build

# Serve the documentation locally
mkdocs serve

A more comprehensive version of the documentation is available at https://deepwiki.com/HectorTablero/image-gen

Examples

Check the examples/ directory for Jupyter notebooks demonstrating different aspects of the framework:

  • getting_started.ipynb: Basic introduction to the framework
  • diffusers.ipynb: Working with different diffusion processes
  • noise_schedulers.ipynb: Exploring various noise schedules
  • samplers.ipynb: Comparing different sampling methods
  • colorization.ipynb: Image colorization examples
  • imputation.ipynb: Image inpainting examples
  • class_conditioning.ipynb: Class-conditional generation
  • evaluation.ipynb: Evaluating model performance

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

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

diffusion_image_gen-0.4.0.tar.gz (59.0 kB view details)

Uploaded Source

Built Distribution

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

diffusion_image_gen-0.4.0-py3-none-any.whl (79.7 kB view details)

Uploaded Python 3

File details

Details for the file diffusion_image_gen-0.4.0.tar.gz.

File metadata

  • Download URL: diffusion_image_gen-0.4.0.tar.gz
  • Upload date:
  • Size: 59.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for diffusion_image_gen-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d7ae55f5fa396ff019ddbaf1dcae02632b94c8003becda36faf58dd11d28665d
MD5 93cefd59585b8221e37653b78bcfaa7c
BLAKE2b-256 0bff98c9b0d68571a5cb0ff9562b27022320b3c283a78dbb1d72099a17edf45a

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffusion_image_gen-0.4.0.tar.gz:

Publisher: pypi.yml on HectorTablero/diffusion-image-gen-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffusion_image_gen-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for diffusion_image_gen-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a71758b911c13e8447eaca4fb725c8bdfe44f5348dffe9b9cc6423453c21c725
MD5 8f059ee0f3554b497c84f47aa504ac86
BLAKE2b-256 192bd92aa07d493d45861b1495cf2ceb643bf0c20b4b99486d3cbbbeeb050cb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffusion_image_gen-0.4.0-py3-none-any.whl:

Publisher: pypi.yml on HectorTablero/diffusion-image-gen-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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