Skip to content

πŸš€ Generate AI-powered images using Google Vertex AI Imagen 3 directly in Google Colab. Easily create high-quality product photos with simple text prompts. πŸŽ¨πŸ–ΌοΈ

License

Notifications You must be signed in to change notification settings

RobinaMirbahar/vertex-ai-imagen3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 AI-Powered Studio-Quality Product Photos with Vertex AI Imagen 3

πŸ”— Try it in Colab: Google Colab Notebook
πŸ“‚ GitHub File: image_generation.py

Vertex AI Imagen 3 - Image Generation

πŸš€ Overview

Generate professional product images using Google Vertex AI Imagen 3 to create studio-quality visuals from text prompts. πŸ–ΌοΈβœ¨

You can generate high-resolution AI-powered photos of [specify product, e.g., sneakers, jewelry, clothing], showcasing them from multiple angles while highlighting key details like [materials, textures, branding, lighting, etc.]. πŸŽ¨πŸ”

βš™οΈ Clone the repository and install dependencies:

git clone https://github.com/RobinaMirbahar/vertex-ai-imagen3-colab.git
cd vertex-ai-imagen3-colab
python -m venv venv
source venv/bin/activate  # For Linux/Mac
venv\Scripts\activate  # For Windows
pip install -r requirements.txt

🎯 Key Features

βœ… 1024x1024 Resolution - Studio-quality output
βœ… Multi-angle Generation - Show products from different views
βœ… Colab Integration - Cloud-based execution
βœ… Commercial Ready - Watermark-free options

πŸ”— Quick Start

πŸš€ Run the notebook instantly in Google Colab:

Open in Colab

πŸ“‚ View the source code on GitHub:
image_generation.py

πŸ”§ Installation & Setup

πŸ“‹ Prerequisites

πŸ” Authentication

from google.colab import auth
auth.authenticate_user()

import vertexai
vertexai.init(project="YOUR-PROJECT-ID", location="us-central1")

πŸ“Έ Image Generation

from vertexai.preview import vision_models
from IPython.display import display

# Initialize model
generator = vision_models.ImageGenerationModel.from_pretrained("imagegeneration-002")

# Create product images
response = generator.generate_images(
    prompt="Professional studio photo of luxury sneakers, 360 view, 4K resolution",
    number_of_images=4,
    aspect_ratio="1:1",
    guidance_scale=15,
    seed=1234
)

# Display results
for idx, image in enumerate(response.images):
    print(f"Image {idx+1}")
    display(image._pil_image)

πŸ“Š Example Outputs

Category Prompt Preview
General Product Photography πŸ“· "Create a high-resolution, professional studio photo of a pair of sneakers, placed on a clean, minimalistic background. The lighting should be soft and diffused, highlighting textures and materials. Capture multiple angles for a complete product showcase." Sneakers
E-Commerce Product Listing πŸ›’ "Generate a set of product images for an e-commerce listing of a smartwatch. Include front, back, and side views with a plain white background, even lighting, and realistic shadows." Smartwatch
Luxury & Premium Product Shots πŸ’Ž "Studio-quality image of a luxury wristwatch on a black satin background with dramatic lighting. Highlight fine details such as textures, engravings, or embellishments to create a high-end look." Luxury Watch
Lifestyle Product Photography 🏑 "Generate an aesthetic lifestyle shot of a designer handbag being used in a modern home setting. Ensure natural lighting, warm tones, and a cozy, inviting atmosphere." Handbag
360-Degree View for Interactive Display πŸ”„ "Generate a seamless 360-degree product photography series for a high-end DSLR camera. Capture multiple angles with consistent lighting and high clarity for an interactive shopping experience." DSLR Camera
Minimalist Product Showcase βšͺ "Create a clean, high-quality product image of a wireless earbud case placed on a neutral, gradient background. Emphasize simplicity and elegance, with soft shadows and studio lighting." Earbuds
Outdoor & Adventure Products 🌿 "Capture a rugged outdoor product shot of a hiking backpack in a natural setting. Highlight durability and real-world use with earthy tones, dynamic lighting, and a scenic backdrop." Backpack

🎚️ Advanced Configuration

# Customized generation with negative prompts
response = generator.generate_images(
    prompt="Modern office chair with leather upholstery",
    number_of_images=3,
    negative_prompt="low quality, blurry, distorted, watermark",
    aspect_ratio="16:9",
    guidance_scale=20,
    temperature=0.7,
    person_generation="avoid"
)

🚨 Troubleshooting Guide

Common Errors & Solutions

Error Solution
PermissionDenied: 403 Verify IAM roles & enable Vertex AI API
InvalidModelName: 404 Check model name spelling & regional availability
InvalidAspectRatio Use supported ratios: 1:1, 4:3, or 16:9

Maintenance Commands

Update SDK components

pip install --upgrade google-cloud-aiplatform

Enable required services

gcloud services enable aiplatform.googleapis.com

πŸ“š Documentation Resources

🀝 Contributing

We welcome contributions! Follow these steps to contribute:

  1. Fork the repository πŸ”„
  2. Clone your fork
    git clone https://github.com/your-username/vertex-ai-imagen3-colab.git
    cd vertex-ai-imagen3-colab
    
    

πŸ™Œ Thank You!

If you find this project helpful, feel free to ⭐ star the repository and πŸ”„ fork it to explore more!

Happy coding! πŸš€

⚠️ Disclaimer

Generated images must comply with Google's Generative AI Prohibited Use Policy. Ensure responsible and ethical use of AI-generated content. πŸš€

About

πŸš€ Generate AI-powered images using Google Vertex AI Imagen 3 directly in Google Colab. Easily create high-quality product photos with simple text prompts. πŸŽ¨πŸ–ΌοΈ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages