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 frameworkdiffusers.ipynb: Working with different diffusion processesnoise_schedulers.ipynb: Exploring various noise schedulessamplers.ipynb: Comparing different sampling methodscolorization.ipynb: Image colorization examplesimputation.ipynb: Image inpainting examplesclass_conditioning.ipynb: Class-conditional generationevaluation.ipynb: Evaluating model performance
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
- Héctor Tablero Díaz - hector.tablerodiaz@gmail.com
- Álvaro Martínez Gamo - alva00003@gmail.com
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ae55f5fa396ff019ddbaf1dcae02632b94c8003becda36faf58dd11d28665d
|
|
| MD5 |
93cefd59585b8221e37653b78bcfaa7c
|
|
| BLAKE2b-256 |
0bff98c9b0d68571a5cb0ff9562b27022320b3c283a78dbb1d72099a17edf45a
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
diffusion_image_gen-0.4.0.tar.gz -
Subject digest:
d7ae55f5fa396ff019ddbaf1dcae02632b94c8003becda36faf58dd11d28665d - Sigstore transparency entry: 210642211
- Sigstore integration time:
-
Permalink:
HectorTablero/diffusion-image-gen-pypi@f6e31921144df6f1200ec4f4fe688bdb813eb5d5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/HectorTablero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@f6e31921144df6f1200ec4f4fe688bdb813eb5d5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file diffusion_image_gen-0.4.0-py3-none-any.whl.
File metadata
- Download URL: diffusion_image_gen-0.4.0-py3-none-any.whl
- Upload date:
- Size: 79.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a71758b911c13e8447eaca4fb725c8bdfe44f5348dffe9b9cc6423453c21c725
|
|
| MD5 |
8f059ee0f3554b497c84f47aa504ac86
|
|
| BLAKE2b-256 |
192bd92aa07d493d45861b1495cf2ceb643bf0c20b4b99486d3cbbbeeb050cb1
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
diffusion_image_gen-0.4.0-py3-none-any.whl -
Subject digest:
a71758b911c13e8447eaca4fb725c8bdfe44f5348dffe9b9cc6423453c21c725 - Sigstore transparency entry: 210642217
- Sigstore integration time:
-
Permalink:
HectorTablero/diffusion-image-gen-pypi@f6e31921144df6f1200ec4f4fe688bdb813eb5d5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/HectorTablero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@f6e31921144df6f1200ec4f4fe688bdb813eb5d5 -
Trigger Event:
push
-
Statement type: