Sparse and Deep Representations for Face Recognition and Object Detection