Follow-Your-Shape: Shape-Aware Image Editing via Trajectory-Guided Region Control

Zeqian Long, Mingzhe Zheng, Kunyu Feng, Xinhua Zhang, Hongyu Liu, Harry Yang, Linfeng Zhang, Qifeng Chen, Yue Ma

Follow-Your-Shape is a novel, training-free, and mask-free framework designed for "shape-aware" image editing. This specific type of editing involves massive structural transformations of an object—such as turning a parrot into a hat or a boy into a rabbit—without altering the surrounding background.

Examples of shape-aware editing using Follow-Your-Shape

The Challenge of Shape-Aware Editing

While generative models excel at creating images from scratch, editing existing images remains a complex challenge, particularly when altering an object's fundamental geometry. Existing methods typically fall into two traps:

  1. Rigidity: Relying on manual binary masks, which often produce "hard" edges, visible artifacts, or struggle with fine details.
  2. Collateral Damage: Mask-free methods frequently alter the background or non-target regions inadvertently while attempting to change the main subject.

The core difficulty lies in region control: instructing a model exactly which pixels to modify and which to preserve when the target shape differs drastically from the source.

Methodology: Trajectory-Guided Region Control

To overcome these limitations, the authors introduce a three-stage pipeline that requires no fine-tuning or manual masking.

The Follow-Your-Shape pipeline illustrating the Trajectory Divergence Map and Scheduled KV Injection

The framework relies on two primary mechanisms:

  • Trajectory Divergence Map (TDM): In flow-based models, the denoising process follows a specific "velocity field." By comparing the velocity of the original image's reconstruction path with the velocity of the new edited path, the system mathematically identifies the regions intended for modification. The areas where the two paths diverge the most naturally form a dynamic, high-fidelity mask. The authors utilize Otsu’s thresholding method to automatically find the optimal boundary between the background and the edit zone.
  • Scheduled KV Injection: To maintain background stability, the model reuses "Key" and "Value" (KV) features from the original image. Because doing this blindly would suppress the intended edit, Follow-Your-Shape employs a carefully timed schedule:
  • Stage 1 (Stabilization): Injects original features globally to anchor the overall layout.
  • Stage 2 (Aggregation): Allows the model to explore the new prompt while simultaneously calculating the TDM.
  • Stage 3 (Conformance): Uses the TDM to create a soft mask, injecting original features only into the background while allowing the new target features to fully materialize in the edited region.

Additionally, the framework can optionally integrate structural guidance (like ControlNet depth or Canny edges) during the middle steps to provide geometric scaffolding for the new shape.

Datasets and Evaluation

The researchers evaluated their method on the standard PIE-Bench for general image editing, and introduced a new benchmark, ReShapeBench. Specifically curated for large-scale shape transformations, ReShapeBench contains 120 new images and 290 editing cases (both single and multi-object) paired with high-quality, four-sentence prompts designed to stabilize the background while describing the foreground change.

Key Results

Follow-Your-Shape was rigorously tested against leading baselines like MasaCtrl, PnPInversion, and RF-Edit.

  • Quantitative Superiority: On ReShapeBench, it achieved the highest PSNR (35.79) and lowest LPIPS (8.23), demonstrating unmatched background preservation. It also secured the highest CLIP Similarity (33.71), indicating that the edits aligned more faithfully with the text prompts.
  • Qualitative Fidelity: Visual results confirm the model's ability to execute extreme transformations—such as turning "coffee with leaf art" into "lion-shaped latte art"—while keeping surrounding textures and lighting perfectly consistent.

Limitations and Future Directions

Despite its success, the framework has a few limitations:

  • Prompt Sensitivity: Because the model relies entirely on the prompt to guide the trajectory, vague or ambiguous prompts can cause the TDM to fail in localizing the correct region, leading to weak edits or "ghosting."
  • Video Consistency: Initial attempts to extend this method to video editing revealed that the TDM fluctuates significantly between frames, causing flickering. Developing a "temporally-aware TDM construction" is a critical next step.
  • Agent-Based Editing: The authors envision future iterations utilizing multi-agent systems to handle different aspects of the edit (e.g., one agent for consistency, another for semantic alignment) to tackle even more complex, long-horizon instructions.

Summary updated

BibTeX
@inproceedings{long2026follow,
  author = {Zeqian Long and Mingzhe Zheng and Kunyu Feng and Xinhua Zhang and Hongyu Liu and Harry Yang and Linfeng Zhang and Qifeng Chen and Yue Ma},
  title = {{Follow-Your-Shape: Shape-Aware Image Editing via Trajectory-Guided Region Control}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=uGaR7L3Z1E},
}
Figure