Create A single channel Target from RGB mask

You could create a color mapping as described here to transform the color values to the class indices.