This algorithm is described in Deep Semantic Ranking Based Hashing for Multi-Label Image Retrieval. See https://github.com/zhaofang0627/cuda-convnet-for-hashing