a simple method to encode label to 0~label_count -1

Map labels to [0, label_count - 1].