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.
- Python 3.x
- Libraries:
torch,transformers,diffusers,cv2,PIL,requests,numpy
- Clone the repository.
- Install the dependencies using:
pip install diffusers transformers accelerate torch -U
- Login to HuggingFace Hub:
from huggingface_hub import login login(token="your_huggingface_token") - Use the script to process images.
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.
This project is licensed under the MIT License. See the LICENSE file for more details.
