Image classification via intermediate discriminative representation