Learning Shared, Discriminative, and Compact Representations for Visual Recognition