Skip to main content

ImagenHub is a one-stop library to standardize the inference and evaluation of all the conditional image generation models.

Project description

๐Ÿ–ผ๏ธ ImagenHub

arXiv

Docs

contributors license GitHub Hits

ImagenHub: Standardizing the evaluation of conditional image generation models
ICLR 2024

ImagenHub is a one-stop library to standardize the inference and evaluation of all the conditional image generation models.

  • We define 7 prominent tasks and curate 7 high-quality evaluation datasets for each task.
  • We built a unified inference pipeline to ensure fair comparison. We currently support around 30 models.
  • We designed two human evaluation scores, i.e. Semantic Consistency and Perceptual Quality, along with comprehensive guidelines to evaluate generated images.
  • We provide code for visualization, autometrics and Amazon mechanical turk templates.

๐Ÿ“ฐ News

๐Ÿ“„ Table of Contents

๐Ÿ› ๏ธ Installation ๐Ÿ”

Install from PyPI:

pip install imagen-hub

Or build from source:

git clone https://github.com/TIGER-AI-Lab/ImagenHub.git
cd ImagenHub
conda env create -f env_cfg/imagen_environment.yml
conda activate imagen
pip install -e .

For models like Dall-E, DreamEdit, and BLIPDiffusion, please see Extra Setup

For some models (Stable Diffusion, SDXL, CosXL, etc.), you need to login through huggingface-cli.

huggingface-cli login

๐Ÿ‘จโ€๐Ÿซ Get Started ๐Ÿ”

Benchmarking

To reproduce our experiment reported in the paper:

Example for text-guided image generation:

python3 benchmarking.py -cfg benchmark_cfg/ih_t2i.yml

Note that the expected output structure would be:

result_root_folder
โ””โ”€โ”€ experiment_basename_folder
    โ”œโ”€โ”€ input (If applicable)
    โ”‚   โ””โ”€โ”€ image_1.jpg ...
    โ”œโ”€โ”€ model1
    โ”‚   โ””โ”€โ”€ image_1.jpg ...
    โ”œโ”€โ”€ model2
    โ”‚   โ””โ”€โ”€ image_1.jpg ...
    โ”œโ”€โ”€ ...

Then after running the experiment, you can run

python3 visualize.py --cfg benchmark_cfg/ih_t2i.yml

to produce a index.html file for visualization.

The file would look like something like this. We hosted our experiment results on Imagen Museum.

Infering one model

import imagen_hub

model = imagen_hub.load("SDXL")
image = model.infer_one_image(prompt="people reading pictures in a museum, watercolor", seed=1)
image

Running Metrics

from imagen_hub.metrics import MetricLPIPS
from imagen_hub.utils import load_image, save_pil_image, get_concat_pil_images

def evaluate_one(model, real_image, generated_image):
  score = model.evaluate(real_image, generated_image)
  print("====> Score : ", score)

image_I = load_image("https://chromaica.github.io/Museum/ImagenHub_Text-Guided_IE/input/sample_102724_1.jpg")
image_O = load_image("https://chromaica.github.io/Museum/ImagenHub_Text-Guided_IE/DiffEdit/sample_102724_1.jpg")
show_image = get_concat_pil_images([image_I, image_O], 'h')

model = MetricLPIPS()
evaluate_one(model, image_I, image_O) # ====> Score :  0.11225218325853348

show_image

๐Ÿ“˜ Documentation ๐Ÿ”

The tutorials and API documentation are hosted on imagenhub.readthedocs.io.

๐Ÿง  Philosophy ๐Ÿ”

By streamlining research and collaboration, ImageHub plays a pivotal role in propelling the field of Image Generation and Editing.

  • Purity of Evaluation: We ensure a fair and consistent evaluation for all models, eliminating biases.
  • Research Roadmap: By defining tasks and curating datasets, we provide clear direction for researchers.
  • Open Collaboration: Our platform fosters the exchange and cooperation of related technologies, bringing together minds and innovations.

Implemented Models

We included more than 30 Models in image synthesis. See the full list here:

Method Venue Type
Stable Diffusion - Text-To-Image Generation
Stable Diffusion XL arXiv'23 Text-To-Image Generation
DeepFloyd-IF - Text-To-Image Generation
OpenJourney - Text-To-Image Generation
Dall-E - Text-To-Image Generation
Kandinsky - Text-To-Image Generation
MagicBrush arXiv'23 Text-guided Image Editing
InstructPix2Pix CVPR'23 Text-guided Image Editing
DiffEdit ICLR'23 Text-guided Image Editing
Imagic CVPR'23 Text-guided Image Editing
CycleDiffusion ICCV'23 Text-guided Image Editing
SDEdit ICLR'22 Text-guided Image Editing
Prompt-to-Prompt ICLR'23 Text-guided Image Editing
Text2Live ECCV'22 Text-guided Image Editing
Pix2PixZero SIGGRAPH'23 Text-guided Image Editing
GLIDE ICML'22 Mask-guided Image Editing
Blended Diffusion CVPR'22 Mask-guided Image Editing
Stable Diffusion Inpainting - Mask-guided Image Editing
Stable Diffusion XL Inpainting - Mask-guided Image Editing
TextualInversion ICLR'23 Subject-driven Image Generation
BLIP-Diffusion arXiv'23 Subject-Driven Image Generation
DreamBooth(+ LoRA) CVPR'23 Subject-Driven Image Generation
Photoswap arXiv'23 Subject-Driven Image Editing
DreamEdit arXiv'23 Subject-Driven Image Editing
Custom Diffusion CVPR'23 Multi-Subject-Driven Generation
ControlNet arXiv'23 Control-guided Image Generation
UniControl arXiv'23 Control-guided Image Generation

Comprehensive Functionality

  • Common Metrics for GenAI
  • Visualization tool
  • Amazon Mechanical Turk Templates (Coming Soon)

High quality software engineering standard.

  • Documentation
  • Type Hints
  • Code Coverage (Coming Soon)

๐Ÿ™Œ Contributing ๐Ÿ”

For the Community

Community contributions are encouraged!

ImagenHub is still under development. More models and features are going to be added and we always welcome contributions to help make ImagenHub better. If you would like to contribute, please check out CONTRIBUTING.md.

We believe that everyone can contribute and make a difference. Whether it's writing code ๐Ÿ’ป, fixing bugs ๐Ÿ›, or simply sharing feedback ๐Ÿ’ฌ, your contributions are definitely welcome and appreciated ๐Ÿ™Œ

And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:

  • Star the project
  • Tweet about it
  • Refer this project in your project's readme
  • Mention the project at local meetups and tell your friends/colleagues

For the Researchers:

๐Ÿ–Š๏ธ Citation ๐Ÿ”

Please kindly cite our paper if you use our code, data, models or results:

@inproceedings{
ku2024imagenhub,
title={ImagenHub: Standardizing the evaluation of conditional image generation models},
author={Max Ku and Tianle Li and Kai Zhang and Yujie Lu and Xingyu Fu and Wenwen Zhuang and Wenhu Chen},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=OuV9ZrkQlc}
}
@article{ku2023imagenhub,
  title={ImagenHub: Standardizing the evaluation of conditional image generation models},
  author={Max Ku and Tianle Li and Kai Zhang and Yujie Lu and Xingyu Fu and Wenwen Zhuang and Wenhu Chen},
  journal={arXiv preprint arXiv:2310.01596},
  year={2023}
}

๐Ÿค Acknowledgement ๐Ÿ”

Please refer to ACKNOWLEDGEMENTS.md

๐ŸŽซ License ๐Ÿ”

This project is released under the License.

โญ Star History ๐Ÿ”

Star History Chart

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

imagen_hub-0.3.0.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

imagen_hub-0.3.0-py3-none-any.whl (3.9 MB view details)

Uploaded Python 3

File details

Details for the file imagen_hub-0.3.0.tar.gz.

File metadata

  • Download URL: imagen_hub-0.3.0.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.18

File hashes

Hashes for imagen_hub-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1ff7e813700bda22ed2672b37c68ec8b6356e65588a465e9fee7542c995a6486
MD5 48d0ac5cd5207be31dd86738a1675185
BLAKE2b-256 1ede0f789ecd96f25ce6e5ef3595bcef5857eecb0f4418298615602aa509fd02

See more details on using hashes here.

File details

Details for the file imagen_hub-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: imagen_hub-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.18

File hashes

Hashes for imagen_hub-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7d74c0489faa094f8a0e4e38ddf3db3db80e02f71d0f257b1b0294cf37ec7a5
MD5 5731da1189b3570b9366a9cf80d2ab06
BLAKE2b-256 053dab398cce8f41f4e11f5bc3a35e677e8526e1b02bb99fdd14d08c3c8a43bf

See more details on using hashes here.

Supported by

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