Skip to content

Repository files navigation

Zero shot Depth aware editing using Diffusion models

[ICCV 2025]

Rishubh Parihar · Sachidanand VS · Venkatesh Babu R

Paper PDF Project Page
Indian Institute of Science

Image

News

  • [2025.07.15] Release inference & Gradio demo code for depth aware object placement and scene composition tasks.
  • [Soon] Release the benchmarking dataset for both tasks.

Installation

Install with conda:

conda env create -f environment.yml

Download Checkpoints

For object placement we use AnyDoor for inpainting, download the weights from:

Note: They include all the optimizer params for Adam, so the checkpoint is big. You could only keep the "state_dict" to make it much smaller.

Download DINOv2 checkpoint and revise /configs/anydoor.yaml for the path (line 83)

Or to simply download all the weights, run the download_weights.sh script:

mkdir weights
bash download_weights.sh

Inference

We provide inference code for both depth aware object placement and scene composition. You should place the images in respective folder under examples/gradio and modify the image path and run the following code, some sample input images are given in examples folder. The generated results are provided in results/object_placement for object placement image, and results/scene_comp for scene composition.

# for Depth aware object placement
python run_inference_object_placement.py

# for Depth aware Scene composition
python inference_scene_composition.py

Gradio demo

Currently, we suport local gradio demo for both object placement and scene composition inference. To launch it run the correspondint scripts:

1. Object Placement Demo (gradio_demo_op.py)

This demo allows you to place objects into scenes with depth-aware positioning.

Running the Demo:

python gradio_demo_op.py

Usage Instructions:

  1. Upload a background image and draw a mask where you want to place the object preferably a bounding box.
  2. Upload a reference object image (RGBA with transparency)
  3. The system will plot a coloured point cloud of the scene in front view and top view.
  4. Adjust the depth value as per where you want to place an object in the scene based on the top view plot.
  5. The generated image will show the object placed at the specified depth

2. Scene Composition Demo (gradio_demo_sc.py)

This demo enables depth-aware scene composition by combining multiple elements.

Running the Demo:

python gradio_demo_sc.py

Usage Instructions:

  1. Upload a background image
  2. Upload a foreground object image
  3. Upload a mask image (white for foreground, black for background)
  4. Provide text prompts describing:
    • Background scene
    • Foreground object
    • Desired final composition
  5. Generate the composed scene

The gradio demo would look like the UI shown below:

Image

Acknowledgements

This project is developed on the codebase of Anydoor and DiffusionHandles. We appreciate these great work!

Citation

If you find this codebase useful for your research, please use the following entry.

@inproceedings{rishubh2025zeroshot,
      title = {Zero-Shot Depth-Aware Image Editing with Diffusion Models},
      author = {Rishubh Parihar, Sachidanand VS, R. Venkatesh Babu},
      booktitle = {International Conference on Computer Vision (ICCV)},      
      year = {2025},
}

About

This project contains the source code for the depth aware editing project. [ICCV'25]

Resources

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages