Detect Skin Tone

Let’s learn how to recognize skin tones in a digital face image.

Introduction

Human Skin Detection is a hotly-debated topic because of it’s potential for widespread misuse, particularly in security and medical industries. The ethical debate surrounding the misuse of skin-tone detecting technologies falls outside of the scope of this course, but it’s important to know these are important issues in the AI-world that are currently being discussed.

At its basis, the skin tone detection process revolves around detecting image pixels and regions that contain skin-tone, and then separating the skin and non-skin pixels. This remains challenging as skin appearance in digital images can be affected by multiple factors, such as lighting conditions, camera capabilites, and other variances.

Many off-the-shelf applications may use face analysis to help determine skin tone. These include cosmetic mobile applications likeMy Skin Tone Matrix or the Mary Kay® Skin Analyzer. We can also develop a lightweight utility tailored to user needs instead of relying on an off-the-shelf one. In this lesson, we’ll look at how skin tone can be detected from a digital image and used in custom applications, like those made by cosmetic industries.

Objective

This lesson aims to demonstrate the steps needed for developing a lightweight Python utility that is designed to segment skin regions in a face image and detect skin tone.

This process will consist of the following steps:

Dependencies

We’ll be using the following external Python libraries.

Library

Version

Dlib

19.17.0

opencv-python

4.4.0.46

scikit-learn

1.0.1

NumPy

1.19.4

webcolors

1.11.1

filetype

1.0.7

Let’s code the utility!

Before exploring the core functions of this utility, let’s define ...