Imported from https://github.com/neuropoly/multiclass-segmentation
