Google Imagen (through GCP Vertex AI Studio) as fashion design assistant

Olejniczak Lukasz
Google Cloud - Community
7 min readDec 11, 2023

The world of fashion is constantly evolving, and with it, the tools and techniques used by designers to create innovative and trendsetting pieces. In recent years, generative AI has emerged as a powerful tool with the potential to revolutionize the fashion industry. In this article, we will explore how generative AI can assist fashion designers in generating new ideas and designs using Google’s suite of generative models for text and image generation.

Source: Generated by Vertex AI Imagen

In the realm of image generation, Google’s contributions are quite impressive and focused on creating realistic and creative imagery. One of Google’s most notable achievements in image generation is the development of Imagen (https://imagen.research.google/), a text-to-image diffusion model with an unprecedented degree of photorealism and a deep level of language understanding. Imagen builds on the power of large language models in understanding text and hinges on the strength of diffusion models in high-fidelity image generation.

Source: https://imagen.research.google/

By capitalizing on the strengths of Google Imagen and Google PaLM2 models accessible through Google Cloud’s Vertex Generative AI Studio, I will start by building a fashion design assistant.

First thing we need to do is to craft a prompt that will instruct Google’s LLM on how it should generate ideas for new products. For example, we may want our assistant to be inspired by nature and animals . Also, we need to instruct the model to describe product ideas by providing its materials, color, hue, saturation and color value, fabric texture, line of germent, Silhouette, balance, patterns and prints:


Role: You are a world class fashion designer.
You are inspired by nature and animals.

Task: generate 10 detailed prompts, each with at least 10 details to by used to generate images of designed clothing by Google Imagen model.
You design cloths for both woman and man.
You can design dresses, t-shirts, shirts, shoes, pants, suits or women's tops
Prompt should include specifics on materials, color, hue, saturation and color value, fabric texture, line of germent, Silhouette, balance, patterns and prints
Think step by step about the product you would design and describe it. Every prompt should start with a type of cloth (e.g. Wome's Dress, Man Trousers) and include very detailed description of unique characteristics
Format the output as JSON string with a list of { 'prompt': prompt, 'type': type}. Make sure output is a well-formatted JSON. Use double quote for attributes and values

I used Vertex Generative AI Studio to prototype my prompt:

and then script it with Vertex AI SDK which enables us to call text-bison@latest from python:

from vertexai.language_models import TextGenerationModel

text_model = TextGenerationModel.from_pretrained("text-bison@latest")

creative_parameters = {
"temperature": 0.7, # Temperature controls the degree of randomness in token selection.
"max_output_tokens": 2024, # Token limit determines the maximum amount of text output.
"top_p": 0.4,
# Tokens are selected from most probable to least until the sum of their probabilities equals the top_p value.
"top_k": 40, # A top_k of 1 means the selected token is the most probable among all tokens.
}

response = text_model.predict(
prompt, **creative_parameters
)

cls_response = response.text.replace("```","")
.replace("json", "").replace("JSON","")

Sample response:

[
{
"prompt": "Women's Dress: A flowy, A-line dress made of a lightweight, airy fabric such as silk or chiffon. The dress should have a high neckline and a fitted bodice, with a full skirt that falls just below the knee. The dress should be printed with a colorful, abstract pattern inspired by nature, such as a floral or botanical print. The dress should be paired with simple sandals and a wide-brimmed hat.",
"type": "Women's Dress"
},
{
"prompt": "Women's Top: A fitted, cropped top made of a stretchy, comfortable fabric such as cotton or jersey. The top should have a high neckline and a wide, boat-neck collar. The top should be printed with a bold, graphic pattern inspired by nature, such as a geometric or animal print. The top should be paired with high-waisted jeans and chunky sneakers.",
"type": "Women's Top"
},
{
"prompt": "Women's Pants: A pair of wide-legged, flowy pants made of a lightweight, breathable fabric such as linen or cotton. The pants should have a high waist and a relaxed fit, with a wide, flared leg. The pants should be printed with a colorful, tropical pattern inspired by nature, such as a palm leaf or hibiscus print. The pants should be paired with a simple tank top and sandals.",
"type": "Women's Pants"
},
{
"prompt": "Women's Shoes: A pair of strappy, high-heeled sandals made of a soft, supple leather. The sandals should have a thin, stiletto heel and a delicate, strappy upper. The sandals should be embellished with a colorful, floral print inspired by nature, such as a rose or orchid print. The sandals should be paired with a flowy, summer dress.",
"type": "Women's Shoes"
},
{
"prompt": "Men's Suit: A tailored, three-piece suit made of a fine, wool fabric. The suit should have a classic, single-breasted jacket with a notch lapel and a pair of matching trousers. The suit should be printed with a subtle, geometric pattern inspired by nature, such as a houndstooth or plaid print. The suit should be paired with a crisp, white shirt and a colorful tie.",
"type": "Men's Suit"
},
{
"prompt": "Men's Shirt: A button-down shirt made of a soft, cotton fabric. The shirt should have a classic, collared neckline and a button-front closure. The shirt should be printed with a bold, graphic pattern inspired by nature, such as a camouflage or animal print. The shirt should be paired with a pair of dark jeans and boots.",
"type": "Men's Shirt"
},
{
"prompt": "Men's Pants: A pair of relaxed-fit, cargo pants made of a durable, cotton fabric. The pants should have a drawstring waist and a wide, relaxed leg. The pants should be printed with a colorful, abstract pattern inspired by nature, such as a graffiti or潑墨 print. The pants should be paired with a simple t-shirt and sneakers.",
"type": "Men's Pants"
},
{
"prompt": "Men's Shoes: A pair of chunky, lace-up boots made of a sturdy, leather material. The boots should have a thick, lug sole and a high, ankle-length shaft. The boots should be printed with a bold, geometric pattern inspired by nature, such as a camouflage or animal print. The boots should be paired with a pair of dark jeans and a leather jacket.",
"type": "Men's Shoes"
},
{
"prompt": "Women's Dress: A long, flowing evening gown made of a luxurious, silk fabric. The dress should have a strapless neckline and a fitted bodice, with a full skirt that falls to the floor. The dress should be embellished with intricate embroidery or beading inspired by nature, such as a floral or botanical motif. The dress should be paired with delicate jewelry and high heels.",
"type": "Women's Dress"
},
{
"prompt": "Men's Tuxedo: A classic, black tuxedo made of a fine, wool fabric. The tuxedo should have a shawl collar and a single-breasted jacket with a satin lapel. The tuxedo should be paired with a crisp, white shirt, a black bow tie, and a pair of black dress shoes.",
"type": "Men's Tuxedo"
}
]

To further explore these ideas, we can utilize Google Imagen to produce their visual representations.

Let’s go with the first proposition:

A flowy, A-line dress made of a lightweight, airy fabric such as silk or chiffon. The dress should have a high neckline and a fitted bodice, with a full skirt that falls just below the knee. The dress should be printed with a colorful, abstract pattern inspired by nature, such as a floral or botanical print. The dress should be paired with simple sandals and a wide-brimmed hat.

Again, we can script this using Vertex AI SDK:

...
from vertexai.preview.vision_models import Image, ImageGenerationModel

img_generation_model = ImageGenerationModel.from_pretrained("imagegeneration@003")

prompts = json.loads(cls_response)
print(prompts)

for prompt in prompts:
print(prompt['prompt'])

images = img_generation_model.generate_images(
prompt="High resolution image of " + prompt['prompt'],
# Optional:
number_of_images=4,
seed=1
)

When we repeat this sequence X times, we can quickly generate quite impressive collection of visual inspirations!

This concept can be taken even further. We can use generated prompts not just as inputs to Google Imagen but also as inputs to Google PaLM2 (text-bison) which in turn will expend them to generate:

  • product title
  • product description
  • hash tags for marketing campaigns

In my next article I will show how we can use this approach to generate synthetic product catalog for e-commerce! Stay tuned!

This article is authored by Lukasz Olejniczak — Customer Engineer at Google Cloud. The views expressed are those of the authors and don’t necessarily reflect those of Google.

Please clap for this article if you enjoyed reading it. For more about google cloud, data science, data engineering, and AI/ML follow me on LinkedIn.

You may want to check my previous articles on applied Generative AI on Google Cloud:

  • Build Flutter application in python to chat in ANY language with Google Cloud LLMs available on Vertex AI
  • Flutter for data engineering and data science! Flet.dev — running Flutter apps built in Python on Google Cloud with Cloud Run

--

--