Home
Softono
Image-Editing-Framework

Image-Editing-Framework

Open source
21
Stars
1
Forks
0
Issues
1
Watchers
2 years
Last Commit

About Image-Editing-Framework

Image-Editing-Framework is a unified software repository that standardizes four pivotal image editing algorithms: Prompt-to-Prompt, MasaCtrl, Plug-and-Play, and Pix2Pix-Zero. Designed to resolve compatibility issues caused by varying environment requirements and diffusers versions, this tool normalizes these methods to the latest diffusers release (0.27). It supports multiple Stable Diffusion versions including 1.5, 2.1, and XL, enabling seamless switching between models. The codebase is structured to clarify underlying editing logic, making similarities and differences between methods transparent for researchers. It integrates various inversion techniques and provides direct access to the PIE Benchmark for consistent performance testing across algorithms. A key feature is the removal of method-specific engineering optimizations like masks or edit directions to ensure fair comparative analysis, though users can easily reintegrate them. The framework includes examples for editing real and synthetic images, tes

Platforms

Web Self-hosted

Links

Editing-Framework

Introduction

Welcome to this repository, a comprehensive collection of the four pivotal algorithms in the [specific domain] domain: P2P, MasaCtrl, PnP, and Pix2Pix-zero. This repository aims to provide an accessible, well-documented, and easy-to-understand resource for both beginners and experienced practitioners looking to explore and implement these algorithms.

Why do I make this repository?

Different editing methods demand specific environments, making it challenging to compare them due to varying requirements, such as diffusers versions. This often complicates the research process for those needing to install numerous environments. Our project standardizes these methods and is updated for the latest diffusers version (0.27), simplifying comparisons.

Difference with official repositories

  1. The project integrates various inversion methods and interfaces for different stable diffusion versions (1.5, 2.1, XL), allowing researchers to easily switch between methods.
  2. It clarifies the logic behind editing methods by structuring the codes, helping researchers understand their similarities and differences.
  3. It Provides access to the PIE Benchmark, facilitating testing of editing methods on the same benchmark.
  4. Importantly, to ensure fairness in comparing different methods, specific engineering techniques unique to each method (such as using masks for local editing in p2p, or the use of Edit Directions in p2p-zero) are omitted. However, researchers can easily incorporate these elements.

Environment

Python

pip install -r requirements.txt

We assume that you have already installed the pytorch.

Weights

You could download the weights of SD from huggingface, and modify the file sd_mapping.py for each method.

Getting Started

We give three simple examples for using. All methods share the same structure.

Edit the real image using p2p

cd p2p
python edit_real.py --sd_version 1.5 --device 0 --seed 0 --source_prompt "a gray horse in the field" --target_prompt "a whie horse in the field" --source_image ./test.jpg --inversion_type null-text

Edit the synthesis image using pnp

cd pnp
python edit_syn.py --xx xx..

Test masactrl method on PIE-Bench

First you should download the PIE-Bench dataset.

cd masactrl
python test.py

Acknowledgement

Our code is based on prompt-to-prompt, MasaCtrl, pix2pix-zero , Plug-and-Play, DirectionInversion thanks to all the contributors!