Add new methods to add training data from labeled images.

The labeled images are expected to have values that correspond to the indexes of the different classes. Other values will be ignored.