Learning Deep Models With Primitive-Based Representations