Skip to content

Decentralised-AI/ObjectClear

 
 

Repository files navigation

ObjectClear Logo

Complete Object Removal via Object-Effect Attention

S-Lab, Nanyang Technological University

Corresponding author

ObjectClear is an object removal model that can jointly eliminate the target object and its associated effects leveraging Object-Effect Attention, while preserving background consistency.

For more visual results, go checkout our project page


🔔 Dataset Release Plan

Thank you all for your interest in our dataset! As the work is currently under review, we will not be releasing the datasets at this stage. We plan to make it publicly available once the paper is accepted. Please stay tuned for further updates! 🙂

⭐ Update

  • [2025.07] Release the inference code and Gradio demo.
  • [2025.05] This repo is created.

✅ TODO

  • Release our datasets
  • Adapt to ComfyUI
  • Release the inference code and Gradio demo

🎃 Overview

overall_structure

📷 OBER Dataset

OBER_dataset_pipeline

OBER (OBject-Effect Removal) is a hybrid dataset designed to support research in object removal with effects, combining both camera-captured and simulated data.

OBER_dataset_samples

⚙️ Installation

  1. Clone Repo

    git clone https://github.com/zjx0101/ObjectClear.git
    cd ObjectClear
  2. Create Conda Environment and Install Dependencies

    # create new conda env
    conda create -n objectclear python=3.10 -y
    conda activate objectclear
    
    # install python dependencies
    pip3 install -r requirements.txt
    # [optional] install python dependencies for gradio demo
    pip3 install -r hugging_face/requirements.txt

⚡ Inference

Quick Test

We provide some examples in the inputs folder. For each run, we take an image and its segmenatation mask as input. The segmentation mask can be obtained from interactive segmentation models such as SAM2 demo. For example, the directory structure can be arranged as follows:

inputs
   ├─ imgs
   │   ├─ test-sample1.jpg      # .jpg, .png, .jpeg supported
   │   ├─ test-sample2.jpg
   └─ masks
       ├─ test-sample1.png
       ├─ test-sample2.png

Run the following command to try it out:

## Single image inference
python inference_objectclear.py -i inputs/imgs/test-sample1.jpg -m inputs/masks/test-sample1.png --use_fp16

## Batch inference on image folder
python inference_objectclear.py -i inputs/imgs -m inputs/masks --use_fp16

🪄 Interactive Demo

To get rid of the preparation for segmentation mask, we prepare a gradio demo on hugging face and could also launch locally. Just drop your image, assign the target masks with a few clicks, and get the object removal results!

cd hugging_face

# install python dependencies
pip3 install -r requirements.txt

# launch the demo
python app.py

📑 Citation

If you find our repo useful for your research, please consider citing our paper:

@InProceedings{zhao2025ObjectClear,
    title     = {{ObjectClear}: Complete Object Removal via Object-Effect Attention},
    author    = {Zhao, Jixin and Zhou, Shangchen and Wang, Zhouxia and Yang, Peiqing and Loy, Chen Change},
    booktitle = {arXiv preprint arXiv:2505.22636},
    year      = {2025}
    }

📝 License

The ObjectClear is made available for use, reproduction, and distribution strictly for non-commercial purposes. The code, models, and datasets are licensed under NTU S-Lab License 1.0. Redistribution and use should follow this license.

📧 Contact

If you have any questions, please feel free to reach us at [email protected].

About

ObjectClear: Complete Object Removal via Object-Effect Attention

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%