Skip to content

Huzaib/Product-Consistent-Image-Generation

Repository files navigation

Product Consistent Image Generation

Hardware Requirements: NVIDIA L4 GPU with CUDA 12.1 installed

This project is my attempt at placing real product images in AI generated prompt-guided scenes without distorting the real product images. It takes a different approach compared to the conventional method.

This approach combines several techniques to maintain the consistency and quality of the generated images. Follow these steps to set up the project environment and install the required dependencies.

Architecture

Architecture Image

Download Model Weights

To begin, download, unzip and place the necessary model weights:

pip install gdown==5.2.0
gdown 'https://drive.google.com/uc?id=1TjkRSjDaAkixo0tWOFQEXrnau-xwDNeY'

unzip consistent_product_image_generation.zip
mv consistent_product_image_generation/model_weights ./
mv consistent_product_image_generation/checkpoints ./
mv consistent_product_image_generation/isnet-general-use.pth ./background_removal/bg_models/
rm -rf consistent_product_image_generation/ consistent_product_image_generation.zip

Installation Steps for Local Environment

  1. Set up a virtual environment:

    python3 -m venv product_env
    source product_env/bin/activate
  2. Install PyTorch and related packages:

    pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121
  3. Install the remaining dependencies:

    pip install packaging==24.1 wheel==0.41.2
    pip install -r requirements.txt

Or Run via Docker

If you prefer to run the project in a Docker container, you can do so with the following commands:

docker build -t test .
docker run --gpus all test

User Interface

  • Light Mode: Light Mode Image
  • Dark Mode: Dark Mode Image

Sample Results

Input Image Output Image
Input Image 1 Output Image 1
Input Image 2 Output Image 2
Input Image 3 Output Image 3
Input Image 4 Output Image 4
Input Image 5 Output Image 5

Feel free to contribute!

Don't forget to star the repo 😉

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published