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.
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
-
Set up a virtual environment:
python3 -m venv product_env source product_env/bin/activate
-
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
-
Install the remaining dependencies:
pip install packaging==24.1 wheel==0.41.2 pip install -r requirements.txt
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
Input Image | Output Image |
---|---|