RGB to Hue and Saturation

5.3. RGB to Hue and Saturation#

To walk you through how neural networks work, we’ll build a neural network to solve the following problem:

Given the RGB values for a colour, calculate the corresponding hue and saturation.

This means we want to build a neural network model that takes in 3 numbers (a red, green and blue value) and then returns 2 numbers, a hue and saturation value. Here is an example of a simple network we can build.

../../_images/problem.png

For example, consider the colour represented by the RGB value (150, 25, 150). This corresponds to a dark purple value as shown below. The corresponding hue value is 300 and the saturation is 71.

That means that when we run our neural network and we give it the inputs 150, 25 and 150 our goal is to get the values 300 and 71 back.

../../_images/problem_values.png

Try playing around with the widget below to see what the hue and saturation values should be for the inputs 240, 180 and 100.

../../_images/problem_blank.png
Question 1

What is the corresponding hue for the inputs 240, 180 and 100?

Solution

Solution is locked

Question 2

What is the corresponding saturation for the inputs 240, 180 and 100?

Solution

Solution is locked