Skip to content
Back to Home

Exploring AI Bias by Turning Faces into Salads - An Experiment

We explore AI bias in image generation by building our own portrait generator in the style of famous Italian painter - Giuseppe Arcimboldo.

Maksim Gorkii

What is AI Bias in Image Generation?

Type in 'An engineer smiling at the camera' as the prompt into a few AI image generators. What do you see? A collection of men in most cases. In a recent experiment, 298 out of the 300 stable diffusion-generated images were of perceived men for the prompt 'Engineer.' A similar racial/gender bias exists across many AI image generators and models today.

AI bias is the phenomenon of artificial intelligence systems producing results that are skewed or unfair towards certain groups or individuals, based on factors such as race, gender, age, or religion. This can occur due to various reasons, such as data bias, algorithm bias or human bias.

As the use of AI grows, bias can have serious negative consequences for individuals and society, such as violating human rights, perpetuating social inequalities, and undermining trust in AI systems.

While the pervasive bias in AI systems has been spotlighted time and again, especially in the art world, its nuances remain elusive. To explore this, we built our own AI portrait generator from scratch, delving into the subtle ways bias sneaks in and strategizing on crafting prompts to counteract it.

Grid of 40 Stable Diffusion portraits for the prompt Engineer, nearly all showing men, many in hard hats and glasses

Stable Diffusion images generated for the prompt 'Engineer' - Bloomberg report

Our tool of choice is Dreamup.ai, a completely free AI image generator that shares 30% of its proceeds with artists. We'll harness the power of the renowned Dreamshaper model. But let's clear the air first: our pick is based on its stellar image quality and soaring popularity, not because it stands out as more or less biased than its counterparts—it doesn't. Let's get started!


Creating the AI Portrait Generator

For this experiment, we will create a Portrait Generator that transforms any given face into a salad, inspired by the 16th-century Italian painter Giuseppe Arcimboldo.

Giuseppe Arcimboldo's painting Vertumnus, a portrait whose face, hair and body are made of fruits, vegetables and flowers

For this project, we'll also use ControlNet and Depth Estimation. The process involves taking the 3D structure from an input image and using it, along with a prompt, to produce the final image. This method allows us to create a portrait generator without the need to train a LoRA model from scratch.

Step 1: Preparing the Reference Image - Turning a Face into a Salad


To start, we'll use the Dreamshaper model to generate our reference image.

Prompt: stunning photograph of a handsome man in a business suit, portrait, city sidewalk background, shallow depth of field

Right off the bat, we see a bias issue. The prompt didn't mention race, but all the generated images are of white men with brown hair, all striking a similar pose with a hand in the left pocket.

This lack of diversity stems from the fact that these models are primarily trained on images with English captions, reflecting the biases of English-speaking regions. As our aim is to highlight how biases manifest, let's adjust our prompt to get a more diverse result.

Four Dreamshaper images for the business suit prompt, all showing white men with brown hair and a hand in the pocket on a city sidewalk


Generated portrait of a Black man in glasses and a dark suit on a city sidewalk, still posed with hands in his pockets

Prompt: stunning photograph of a handsome black man in a business suit, portrait, city sidewalk background, shallow depth of field

By specifying race, we get a more diverse image, though the hand-in-pocket pose remains consistent. This suggests that our prompt might be triggering certain cultural or stylistic associations. However, we won't delve into that now.


To ensure authenticity, let's use a real stock photo as the reference image.

Fortune Vieyra in a black business suit, standing by a wall.

Source: https://unsplash.com/photos/aAN9ocBHbyo

Interestingly, even in this real photo, the hand-in-pocket pose persists.

Stock photo of Fortune Vieyra in a black suit leaning against a stone wall with one hand in his pocket, used as the reference image


Step 2: Extracting the Depth Map

Grayscale MiDaS depth map of the reference photo, showing the man and wall as a bright silhouette against a dark background

Next, we'll employ MiDaS Depth Estimation to derive a depth map from our reference image. This depth map will provide us with a 3D perspective of the reference, which is crucial for generating our final artwork. From the depth map, we can discern the structure and layout of the image. However, the color data is absent. This lack of color might pose challenges in the subsequent steps.

Depth map derived from our reference image


Step 3: Crafting the Perfect Prompt

Our first attempt will be a neutral prompt devoid of any racial or gender specifics.

Prompt: Detailed portrait of a person in the ((style of Giuseppe Arcimboldo)), face made of vegetables

As expected, the generated images predominantly feature white men, maintaining the composition of the reference. This could be due to the inherent model bias or the historical context of Arcimboldo, a European artist from the 16th century. To achieve our desired outcome, we'll need to refine our prompt.

Four Arcimboldo-style results for the neutral person prompt, all showing a bald white man in vegetable-covered clothing, with an ordinary face


Four results for the black man prompt: Black men in vegetable-decorated suits in noticeably darker, dimly lit rooms

Prompt: Detailed portrait of a black man in the ((style of Giuseppe Arcimboldo)), face made of vegetables

By specifying the race, we get closer to our reference image. However, the overall image is notably darker. This might be due to the encoding process of the text, which can lose intricate details.


Prompt: Detailed portrait of an African American man in the ((style of Giuseppe Arcimboldo)), face made of vegetables

Switching "black" for "African American" yields a lighter image, but the generated faces are of lighter-skinned individuals. This could reflect a broader spectrum of skin tones or a potential cultural bias.

Four results for the African American man prompt, brighter than before but showing lighter-skinned men in vegetable-covered vests


Four results for the African man prompt showing darker-skinned men in plainer, rougher rooms, with vegetables on clothing but not faces

Prompt: Detailed portrait of an african man in the ((style of Giuseppe Arcimboldo)), face made of vegetables

Requesting an "African" man gives us darker skin tones, but the backgrounds seem less opulent. This might inadvertently introduce cultural stereotypes. Also, the vegetable face aspect is still missing.


Prompt: Detailed portrait of an african aristocratic man in the ((style of Giuseppe Arcimboldo))

Incorporating "aristocratic" brings back the grandeur in the backgrounds. Yet, the vegetable face remains elusive.

Four results for the African aristocratic man prompt: ornate jackets and grand interiors, but faces still not made of vegetables


Four results for the vegetable painting prompt with a skin negative prompt; vegetables fill the clothing and walls, but faces remain human

Prompt: Detailed ((vegetable painting)) of an african aristocratic man in the ((style of Vertumnus by Giuseppe Arcimboldo))

Negative Prompt: (((skin)))

Despite multiple attempts, achieving a vegetable-composed face proves challenging. It might be beneficial to use a closer reference image focusing solely on the face for better results.


New Reference Image, Depth Map, and Prompt

Reference image (Photo by Prince Akachi on Unsplash) and New Depth Map

New reference photo of a smiling young Black woman in a patterned head wrap, beside its grayscale depth map


Four results for the African aristocratic woman prompt, each portraying a noticeably older woman than the reference, with vegetable necklaces

With a fresh reference image of a young black woman and an updated depth map, our goal remains: a vegetable-composed face.

Prompt: Detailed ((vegetable painting)) of an african aristocratic woman in the ((style of Vertumnus by Giuseppe Arcimboldo))

Negative Prompt: (((skin)))

Interestingly, the generated images appear older than our reference. This unintended age bias surfaces despite the absence of age-related cues in our prompt.


Prompt: Detailed ((vegetable painting)) of a young african aristocratic woman in the ((style of Vertumnus by Giuseppe Arcimboldo))

Negative Prompt: (((skin)))

While the age factor improves, the resemblance to the reference remains elusive. Knowing our subject's Nigerian origin, let's incorporate that detail, along with "attractive," for a more flattering portrayal.

Four results after adding young to the prompt: younger women with vegetable cheeks and necklaces who still do not resemble the reference


Four results after adding attractive and Nigerian to the prompt; some images now show low necklines and emphasize the bust

Prompt: Detailed ((vegetable painting)) of an attractive young Nigerian aristocratic woman in the ((style of Vertumnus by Giuseppe Arcimboldo))

Negative Prompt: (((skin)))

However, the addition of "attractive" seems to have introduced an unintended sexualized portrayal, emphasizing the bust area. To counteract this, we'll employ negative prompts.


Prompt: Detailed ((vegetable painting)) of an attractive young Nigerian aristocratic woman in the ((style of Vertumnus by Giuseppe Arcimboldo))

Negative Prompt: (((skin))) (((cleavage)))

We're definitely getting closer to what we want, though there's still not as many face vegetables as I want. At this point I'm suspecting that the MiDaS depth map is essentially forcing a smooth face, thus preventing the portrayal of the face as vegetables. Let's try a different approach.

Four results with cleavage added to the negative prompt: modest green garments and vegetable necklaces, with only a few vegetables on the faces


Step 4: Re-think Our ControlNet Selection

Comparison of nine ControlNet annotators, including LeRes Depth, Openpose Face, Canny, Lineart, Scribble HED and Softedge HED, each with its control image and resulting portrait

Annotator model, control image, and final portrait

Of these, I would say the Lineart - Anime annotator and controlnet are producing the vegetable-iest results, despite the addition of a beard-like structure, which we also see in the Scribble version. This can probably be attributed to the artist, as most of Giuseppe Arcimboldo's portraits feature beards. Let's try adding a beard to the negative prompt with the Lineart - Anime controlnet.


Four Lineart Anime results with beard in the negative prompt: smiling green-skinned women with no beard, but fewer vegetables

Prompt: Detailed ((vegetable painting)) of a young african aristocratic woman in the ((style of Vertumnus by Giuseppe Arcimboldo))

Negative Prompt: (((skin))) (((cleavage))) (beard)

We successfully dropped the beard, but the overall vegetable-ness has decreased. Let's try adding some specific vegetables to the prompt.


Prompt: Detailed ((vegetable painting)) of attractive young nigerian aristocratic woman in the ((style of Vertumnus by Giuseppe Arcimboldo)), carrot, tomato, beet, celery

Negative Prompt: (((skin))) (((cleavage))) (((beard)))

Finally, we're inching closer to our envisioned output. Yet, the journey underscores the complexities of crafting a universally applicable workflow. The need to specify age, race, and gender and employ negative prompts to counteract biases makes the process intricate. This highlights the challenges in creating a one-size-fits-all solution, especially when aiming for personalized and unbiased results.

Four final results after naming carrot, tomato, beet and celery: vegetable leaves, beets and tomatoes frame smiling faces with vegetable features


Mitigating Bias in AI Image Generation

Our journey into the realm of AI image generation has shed light on the multifaceted nature of bias within these systems. While prompts offer a powerful tool to guide and refine AI outputs, crafting the perfect prompt is no simple task. It's a delicate balance of specificity and generalization, often requiring multiple iterations to achieve the desired result.

The challenges we faced underscore the importance of diversity—in both the teams developing AI systems and the datasets they're trained on. A broader spectrum of perspectives can help identify and rectify biases that might otherwise go unnoticed.

Furthermore, our exploration revealed the intricacies of text encoding in AI systems. The loss of nuanced information during this process can lead to outputs that deviate from our expectations. As users and developers, a deep understanding of the underlying mechanisms of our chosen AI tools is crucial. It empowers us to anticipate potential pitfalls and adapt our approach accordingly.

In essence, while AI offers immense potential, it's imperative to approach it with a discerning eye, a willingness to iterate, and a commitment to inclusivity and fairness.