JoyAI-Image-Edit is a multimodal foundation model specialized in instruction-guided image editing. It enables precise and controllable edits by leveraging strong spatial understanding, including scene parsing, relational grounding, and instruction decomposition, allowing complex modifications to be applied accurately to specified regions.
Requirements: Python >= 3.10, CUDA-capable GPU
Note: JoyImageEditPipeline will be included in the next official diffusers release (>0.38.0). Until then, install from source as shown above.
pip install torch transformers torchvision
pip install git+https://github.com/huggingface/diffusers.git
import torch
from PIL import Image
from diffusers import JoyImageEditPipeline
pipeline = JoyImageEditPipeline.from_pretrained("jdopensource/JoyAI-Image-Edit-Diffusers")
pipeline.to(torch.bfloat16)
pipeline.to("cuda")
pipeline.set_progress_bar_config(disable=None)
print("pipeline loaded")
img_path = "./test_images/input.png"
prompt = "Remove the construction structure from the top of the crane."
image = Image.open(img_path).convert("RGB")
inputs = {
"image": image,
"prompt": prompt,
"generator": torch.manual_seed(0),
"num_inference_steps": 40,
"guidance_scale": 4.0,
}
print("run pipeline...")
with torch.inference_mode():
output = pipeline(**inputs)
image = output.images[0]
image.save("joyai_image_edit_output.png")
print("image saved.")
JoyAI-Image supports three spatial editing prompt patterns: Object Move, Object Rotation, and Camera Control. For the most stable behavior, we recommend following the prompt templates below as closely as possible.
Use this pattern when you want to move a target object into a specified region.
Prompt template:
Move the <object> into the red box and finally remove the red box.
Rules:
<object> with a clear description of the target object to be moved.Example:
Move the board into the red box and finally remove the red box.
Use this pattern when you want to rotate an object to a specific canonical view.
Prompt template:
Rotate the <object> to show the <view> side view.
Supported <view> values:
frontrightleftrearfront rightfront leftrear rightrear leftRules:
<object> with a clear description of the object to rotate.<view> with one of the supported directions above.Examples:
Rotate the dog to show the left side view.
Use this pattern when you want to change only the camera viewpoint while keeping the 3D scene itself unchanged.
Prompt template:
Move the camera.
- Camera rotation: Yaw {y_rotation}°, Pitch {p_rotation}°.
- Camera zoom: in/out/unchanged.
- Keep the 3D scene static; only change the viewpoint.
Rules:
{y_rotation} specifies the yaw rotation angle in degrees.
{p_rotation} specifies the pitch rotation angle in degrees.
Camera zoom must be one of:
inoutunchangedThe last line is important: it explicitly tells the model to preserve the 3D scene content and geometry, and only adjust the camera viewpoint.
Examples:
Move the camera.
- Camera rotation: Yaw 0.0°, Pitch -15.0°.
- Camera zoom: unchanged.
- Keep the 3D scene static; only change the viewpoint.
JoyAI-Image is licensed under Apache 2.0.
We are actively hiring Research Scientists, AI Infra Engineers, and Interns to join us in building next-generation generative foundation models and bringing them into real-world applications. If you’re interested, please send your resume to: huanghaoyang.ocean@jd.com
15 commits
JoyAI-Image-Edit is a multimodal foundation model specialized in instruction-guided image editing. It enables precise and controllable edits by leveraging strong spatial understanding, including scene parsing, relational grounding, and instruction decomposition, allowing complex modifications to be applied accurately to specified regions.
Requirements: Python >= 3.10, CUDA-capable GPU
Note: JoyImageEditPipeline will be included in the next official diffusers release (>0.38.0). Until then, install from source as shown above.
pip install torch transformers torchvision
pip install git+https://github.com/huggingface/diffusers.git
import torch
from PIL import Image
from diffusers import JoyImageEditPipeline
pipeline = JoyImageEditPipeline.from_pretrained("jdopensource/JoyAI-Image-Edit-Diffusers")
pipeline.to(torch.bfloat16)
pipeline.to("cuda")
pipeline.set_progress_bar_config(disable=None)
print("pipeline loaded")
img_path = "./test_images/input.png"
prompt = "Remove the construction structure from the top of the crane."
image = Image.open(img_path).convert("RGB")
inputs = {
"image": image,
"prompt": prompt,
"generator": torch.manual_seed(0),
"num_inference_steps": 40,
"guidance_scale": 4.0,
}
print("run pipeline...")
with torch.inference_mode():
output = pipeline(**inputs)
image = output.images[0]
image.save("joyai_image_edit_output.png")
print("image saved.")
JoyAI-Image supports three spatial editing prompt patterns: Object Move, Object Rotation, and Camera Control. For the most stable behavior, we recommend following the prompt templates below as closely as possible.
Use this pattern when you want to move a target object into a specified region.
Prompt template:
Move the <object> into the red box and finally remove the red box.
Rules:
<object> with a clear description of the target object to be moved.Example:
Move the board into the red box and finally remove the red box.
Use this pattern when you want to rotate an object to a specific canonical view.
Prompt template:
Rotate the <object> to show the <view> side view.
Supported <view> values:
frontrightleftrearfront rightfront leftrear rightrear leftRules:
<object> with a clear description of the object to rotate.<view> with one of the supported directions above.Examples:
Rotate the dog to show the left side view.
Use this pattern when you want to change only the camera viewpoint while keeping the 3D scene itself unchanged.
Prompt template:
Move the camera.
- Camera rotation: Yaw {y_rotation}°, Pitch {p_rotation}°.
- Camera zoom: in/out/unchanged.
- Keep the 3D scene static; only change the viewpoint.
Rules:
{y_rotation} specifies the yaw rotation angle in degrees.
{p_rotation} specifies the pitch rotation angle in degrees.
Camera zoom must be one of:
inoutunchangedThe last line is important: it explicitly tells the model to preserve the 3D scene content and geometry, and only adjust the camera viewpoint.
Examples:
Move the camera.
- Camera rotation: Yaw 0.0°, Pitch -15.0°.
- Camera zoom: unchanged.
- Keep the 3D scene static; only change the viewpoint.
JoyAI-Image is licensed under Apache 2.0.
We are actively hiring Research Scientists, AI Infra Engineers, and Interns to join us in building next-generation generative foundation models and bringing them into real-world applications. If you’re interested, please send your resume to: huanghaoyang.ocean@jd.com
15 commits