Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Object Detection and Replacement Project

Overview

This project utilizes AI models to detect objects in images and replace them with new content. The system performs the following tasks:

  • Detects objects using a zero-shot detection model (Grounding DINO).
  • Generates segmentation masks using Segment Anything (SAM).
  • Replaces the detected objects with new content via Stable Diffusion XL inpainting, driven by text prompts.

Requirements

  • Python 3.x
  • Libraries: torch, transformers, diffusers, cv2, PIL, requests, numpy

Installation

  1. Clone the repository.
  2. Install the dependencies using:
    pip install diffusers transformers accelerate torch -U
  3. Login to HuggingFace Hub:
    from huggingface_hub import login
    login(token="your_huggingface_token")
  4. Use the script to process images.

Usage

Run the script and provide an image URL and desired labels. The system will detect objects, generate masks, and replace the objects in the image based on the prompt.

Result

ObjectReplacementResult

License

This project is licensed under the MIT License. See the LICENSE file for more details.


About

This project detects and replaces objects in images using AI. It first identifies objects with a zero-shot model, generates segmentation masks, and then replaces the detected object with new content through inpainting using Stable Diffusion XL. The system allows for automatic image editing driven by text prompts.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages