🚀 REALEDIT:用於圖像變換的大規模實證數據集Reddit編輯
REALEDIT是一個基於Reddit編輯的大規模實證圖像變換數據集,為圖像轉換相關的研究和應用提供了豐富的數據支持。項目提供了兩種推理方式,方便用戶根據自身需求進行圖像編輯。
🚀 快速開始
有兩種運行推理的方式:通過🧨Diffusers或原始的InstructPix2Pix管道。
✨ 主要特性
- 提供基於Diffusers和InstructPix2Pix兩種推理方式。
- 利用Reddit編輯數據構建大規模圖像變換數據集。
📦 安裝指南
方式一:使用🧨Diffusers
安裝必要的庫:
pip install torch==2.7.0 diffusers==0.33.1 transformers==4.51.3 accelerate==1.6.0 pillow==11.2.1 requests==2.32.3
方式二:通過InstructPix2Pix管道
克隆倉庫並設置目錄結構:
git clone https://github.com/timothybrooks/instruct-pix2pix.git
cd instruct-pix2pix
mkdir checkpoints
將微調後的檢查點下載到checkpoints
目錄:
cd checkpoints
返回倉庫根目錄,並按照InstructPix2Pix安裝指南設置環境。
💻 使用示例
基礎用法
方式一:使用🧨Diffusers
import torch
import requests
import PIL
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
model_id = "peter-sushko/RealEdit"
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
model_id,
torch_dtype=torch.float16,
safety_checker=None
)
pipe.to("cuda")
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
url = "https://raw.githubusercontent.com/AyanaBharadwaj/RealEdit/refs/heads/main/example_imgs/simba.jpg"
def download_image(url):
image = PIL.Image.open(requests.get(url, stream=True).raw)
image = PIL.ImageOps.exif_transpose(image)
image = image.convert("RGB")
return image
image = download_image(url)
prompt = "give him a crown"
result = pipe(prompt, image=image, num_inference_steps=50, image_guidance_scale=2).images[0]
result.save("output.png")
方式二:通過InstructPix2Pix管道
編輯單張圖像:
python edit_cli.py \
--input [YOUR_IMG_PATH] \
--output imgs/output.jpg \
--edit "YOUR EDIT INSTRUCTION" \
--ckpt checkpoints/realedit_model.ckpt
📚 詳細文檔
- 項目頁面:https://peter-sushko.github.io/RealEdit/
- 數據:https://huggingface.co/datasets/peter-sushko/RealEdit
📄 許可證
本項目採用CC(Creative Commons)許可證。
📦 數據集信息
屬性 |
詳情 |
模型類型 |
image-to-image |
訓練數據 |
peter-sushko/RealEdit |
📖 引用
如果您發現此檢查點有幫助,請引用:
@misc{sushko2025realeditredditeditslargescale,
title={REALEDIT: Reddit Edits As a Large-scale Empirical Dataset for Image Transformations},
author={Peter Sushko and Ayana Bharadwaj and Zhi Yang Lim and Vasily Ilin and Ben Caffee and Dongping Chen and Mohammadreza Salehi and Cheng-Yu Hsieh and Ranjay Krishna},
year={2025},
eprint={2502.03629},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.03629},
}