How AI Models Create and Modify Images for Bias Testing | HackerNoon

Authors:

(1) Wenxuan Wang, The Chinese University of Hong Kong, Hong Kong, China;

(2) Haonan Bai, The Chinese University of Hong Kong, Hong Kong, China

(3) Jen-tse Huang, The Chinese University of Hong Kong, Hong Kong, China;

(4) Yuxuan Wan, The Chinese University of Hong Kong, Hong Kong, China;

(5) Youliang Yuan, The Chinese University of Hong Kong, Shenzhen Shenzhen, China

(6) Haoyi Qiu University of California, Los Angeles, Los Angeles, USA;

(7) Nanyun Peng, University of California, Los Angeles, Los Angeles, USA

(8) Michael Lyu, The Chinese University of Hong Kong, Hong Kong, China.

Abstract

1 Introduction

2 Background

3 Approach and Implementation

3.1 Seed Image Collection and 3.2 Neutral Prompt List Collection

3.3 Image Generation and 3.4 Properties Assessment

3.5 Bias Evaluation

4 Evaluation

4.1 Experimental Setup

4.2 RQ1: Effectiveness of BiasPainter

4.3 RQ2 – Validity of Identified Biases

4.4 RQ3 – Bias Mitigation

5 Threats to Validity

6 Related Work

7 Conclusion, Data Availability, and References

3.3 Image Generation

In this section, we introduce how BiasPainter inputs the seed image and text prompt to image generation models to generate images.

As introduced in Section 3.1 and 3.2, the seed image set consists of 54 photos of people, from different combinations of race, age and gender, while the neutral prompt list consists of 228 sentences generated by different prompt words across the 4 topics. Meanwhile, image generation models enable users to provide additional descriptive prompts that can help control the generated style.

For each seed image, BiasPainter inputs each prompt from the neutral prompt list every time to generate images. Finally, BiasPainter generates 54 * 228 = 12312 images, which are used to identify the social bias.

3.4 Properties Assessment

BiasPainter adopts the (seed image, generated image) pairs to evaluate the social bias. For each seed image and the generated image, BiasPainter first adopts AI techniques to evaluate their properties according to race, gender, and age.

Race Assessment. We follow [12] to analyse the race according to the skin color. Researchers presented a division into six groups based on color adjectives: White (Caucasian), Dusky (South Asian), Orange (Austronesian), Yellow (East Asian), Red (Indigenous American), and Black (African) [41]. It is challenging to distinguish the race of a human accurately, considering the number of the race and their mix. To make it simple, BiasPainter uses the significant change of skin tone to identify the changing of the race. For each image, BiasPainter adopts an image processing pipeline to access the skin tone, as illustrated in Figure 4. First, BiasPainter calls Dlib [8] to get a 68-point face landmark and find the area of the face in the picture. The landmark provides the position and the shape of the face in

Table 1: Prompts Adopted in BiasPainter

Figure 4: Image Processing Pipeline to Access the Skin Tone Information

the picture, and also marks the eyes and mouth of the face. Then, BiasPainter adopts a rule-based method to remove the background, eyes and mouth from the face. Finally, BiasPainter calculates the average pixel value of the remaining face. The darker the digital image is, the higher the average pixel value is. The more difference between the average pixel value of the seed image and the generated image, the more possibility that the race is changed by the image generation model.

Gender Assessment. While there is a broad spectrum of genders [23], it’s difficult to accurately identify someone’s gender across this broad spectrum based solely on visual cues. Consequently, following previous works [2, 12, 61], we restrict our bias measurement to a binary gender framework and only consider male and female. BiasPainter adopts a commercial face analyses API, named Face++ Cognitive Service [9], to identify the gender information of the human’s picture. Specifically, Face++ Cognitive Service returns a predicted gender to indicate the gender of the people in the picture, which will be adopted by BiasPainter to access the gender. If there is a difference between the gender attribute of the seed image and the generated image, then the image generation model changed the gender in the generated image.

Age Assessment. BiasPainter adopts a commercial face analyses API, named Face++ Cognitive Service, to identify the age information of the human’s picture. Specifically, Face++ Cognitive Service returns a predicted age to indicate the ages of the people in the picture, which will be adopted by BiasPainter to access the age. The more differences between the predicted ages of the seed image and the generated image, the more possibility that the age is changed by the image generation model.


[8] http://dlib.net/

[9] https://www.faceplusplus.com/