Due to its storage and search efficiency, hashing has attracted great attentions in large-scale vision problems such as image retrieval and recognition. This paper presents a novel Deep Learning based Supervised Hashing (DLSH) method by using a deep neural network to better capture the semantic structure of nonlinear and complex data. We consider learning a nonlinear embedding that simultaneously preserves semantic information and produces nearby binary codes for semantically similar data. Specifically, our hashing model is trained to maximize the similarity measure of neighbor pairs while preserving the relative similarity of non-neighbor pairs with a relaxed empirical penalty in the binary space. An effective regularizer for minimizing the quantization loss between the learned embedding and the binary codes is also considered in the optimization to generate better hash code quality. Experimental results have demonstrated the proposed method outperforms the state-of-the-art methods.