以下の内容はhttps://touch-sp.hatenablog.com/entry/2025/03/10/113721より取得しました。


【Diffusers】OmniGen ④ バーチャル試着

はじめに

以前にも「OOTDiffusion」や「Magic Clothing」というモデルを使ってバーチャル試着を試したことがあります。
touch-sp.hatenablog.com
touch-sp.hatenablog.com
今回はOmniGenを使ってみます。

目的

命題:『この顔の人物にこの服を着させて下さい』



用意したのはこの2枚の画像のみです。

結果


犬のイラストが少し変わってますが、人物の再現度は高いです。

Pythonスクリプト

import torch
from diffusers import OmniGenPipeline
from diffusers.utils import load_image 

pipe = OmniGenPipeline.from_pretrained(
    "Shitao/OmniGen-v1-diffusers",
    torch_dtype=torch.bfloat16
)
pipe.to("cuda")

prompt="A woman is walking down the street, wearing black T-shirt with dog print.The woman is <img><|image_1|></img>. The T-shirt is <img><|image_2|></img>."
input_image_1 = load_image("lady.jpg")
input_image_2 = load_image("shirt.jpg")
input_images=[input_image_1, input_image_2]
image = pipe(
    prompt=prompt, 
    input_images=input_images, 
    height=1024,
    width=1024,
    guidance_scale=2.5, 
    img_guidance_scale=1.6,
    generator=torch.Generator(device="cpu").manual_seed(666)
).images[0]
image.save("output.png")

その他のOmniGenの記事

touch-sp.hatenablog.com
touch-sp.hatenablog.com
touch-sp.hatenablog.com





以上の内容はhttps://touch-sp.hatenablog.com/entry/2025/03/10/113721より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14