{'fraction_non_alphanumeric': 0.027972027972027972, 'fraction_numerical': 0.006993006993006993, 'mean_word_length': 4.869090909090909, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Research on Discrete Hash Algorithm Based on Deep Semantics

With the rapid growth of image and video data on the network, hash technology has been widely studied in the field of image and video search in recent years. Benefiting from the latest progress in deep learning, deep hash method has achieved good results in image retrieval. However, the previous deep hash method has the limitation that the semantic information is not fully utilized. In this paper, we develop a discrete hash algorithm based on deep supervision, assuming that learning binary code should be an ideal choice of classification. The pair tag information and classified information are used to learn hash codes within a framework. The output of the last layer is restricted to binary code directly, which is rarely studied in deep hash algorithm. Due to the discrete properties of hash codes, the alternate minimization method is used to optimize the target function. The proposed algorithm is proved to be better than the other supervised hash methods in two public image retrieval databases CIFAR-10 and NUS-WIDE.


Introduction
Because of the rapid growth of image and video data on the Internet, hash technology has attracted a lot of attention in recent years [1]. Because of its low computational cost and storage efficiency, it is one of the most popular technologies for image or video search. Generally speaking, hashing is used to code high dimensional data into binary codes, while preserving the similarity of images or videos. The existing hash methods can be roughly divided into two categories, data independent methods and data dependent methods.
Data independent methods use random projections to construct hash functions. Locally sensitive hash (LSH) [2] is one of the representative methods. It uses random linear projection to map nearby data to similar binary code. Data dependency method refers to using training data to learn hash functions, which can be further divided into supervised and unsupervised methods. The unsupervised method retrieves the neighborhood under some distance measurements, and iterative quantization (ITQ) [3] is one of the representative unsupervised hash methods, in which the projection matrix is projected through iterative projection and threshold optimization based on a given training sample. In order to make use of the semantic labels of data samples, a supervised hash method named [4,5,6] is proposed. The core supervised hashing (KSH) [7] is a well-known method of this type, which learns the hash code by minimizing the Hamming distance between the similar pairs and maximizing the Hamming distance between the dissimilar pairs at the same time.
Recently, a hash method based on deep learning has been proposed to simultaneously learn image representation and hash coding, which has shown superior performance superior to the traditional hash method. The convolution neural network hash (CNNH) [8] is one of the early work of integrating the deep neural network into hash coding. The hash code is composed of two stages, which is used to learn image representation and hash code. One drawback of CNNH is that learning image representation cannot provide feedback for learning a better hash code. In order to overcome the shortcomings of CNNH, [9] proposed a three rankings loss to capture the relative similarity of the image. Image representation learning and hash coding can benefit from each other within a stage framework.
Although the method based on deep learning has made great progress in image retrieval, the previous deep hash method has the limitation that semantic information is not fully utilized. The recent work attempts to divide the whole learning process into two stream [6] under the framework of multitask learning, which is used to learn hash functions, and the classification flow is used for mining semantic information. Although two stream frameworks can improve retrieval performance [10], classification flow is only used to learn image representation without affecting hash function directly. In this paper, we use CNN to simultaneously learn image representation and hash functions, and the last layer of CNN outputs binary codes directly according to pair tag information and classification information.
The contribution of this work is summarized as follows. (1) The last layer of our method is limited by direct output binary code, learning binary code to maintain a similar relationship and keeping the label consistent, as we know, this is the first deep hash method using pair tag information and classification information to learn a hash code under a stream frame. (2) In order to reduce the quantization error, we maintain the discrete property of hash code in the optimization process, and propose an alternate minimization method, and use the discrete cyclic coordinate descent method to optimize the target function. (3) A large number of experiments show that our method is better than the most advanced method in the reference data set of the image retrieval, which proves the effectiveness of the proposed method.

Network Structure
This paper utilizes the Convolutional Neural Network (CNN) in [11], namely CNN-F as a deep feature learning part, and replaces the last layer of CNN-F with a fully connected layer to project the output of the second layer into space. The feature learning section contains five convolutional layers ("conv1-conv5") and three fully connected layers ("full6-full8"). The detailed settings of the five convolutional layers are shown in Table 1. In Table 1, "filter size" denotes the number of convolution filters and their reception area size, "stride" denotes the convolution step, "pad" denotes the number of pixels to add to each input size, "LRN" denotes whether to apply Local Response Normalization (LRN), and "pool" denotes the down-sampling factor. Table 2 shows the detailed settings of the three fully connected layers, where the "Settings" show the number of nodes in each layer. This paper uses the Rectified Linear Unit (ReLU) as the activation function for all the first seven layers. For the last layer, identity function is used as activation function. Figure 1 shows the flowchart of this paper.
By observing the negative log-likelihood of the paired labels in S, we can get the following optimization problems: It is easy to find that the above optimization problem can make the Hamming distance between two similar points as small as possible while making the Hamming distance between two dissimilar points as large as possible. This exactly matches the goal of a supervised hashing algorithm with paired labels.
The problem in formula (1) is a discrete optimization problem, which is difficult to solve. LFH solves this problem by relaxing { } i b directly from discrete to continuous pairs, which may not achieve satisfactory performance.
In this paper, we design a new strategy that can solve this problem in a discrete manner in formula (1). First, we reformulate the problem in formula (1) as the following equivalent problem: , To optimize the problem in formula (2), we can optimize the following regularization problem by moving the equality constraint in formula (2) to the regularization term: where η is the regularization term (hyper-parameter).

Model solving section
In order to integrate the above feature learning part and objective function part into the end-to-end framework, we set as followings: denotes the bias vector. This means that we integrate the feature learning part and the objective function part into the same frame through a fully connected layer, with the weight matrix W and the bias vector v. After integrating these two parts, the learning problem becomes: As a result, we obtain an end-to-end deep hash model, which we call DPSH. The model can simultaneously perform feature learning and hash code learning in the same framework.

Parameter learning
In the convolutional neural network, learning parameters include W, v, θ and b . We use a minibatch-based strategy for learning. More specifically, in each iteration, we sample small batches of points from the entire training set and then learn from these sampling points. We designed an alternate learning method. That is to say, we optimize one parameter with other parameters fixed. .
The above formula briefly summarizes the entire learning algorithm

Experimental data and analysis
This paper uses two widely used image datasets to evaluate the proposed method. They are CIFAR-10 [4] and NUS-WIDE [5]. The CIFAR-10 dataset contains 60,000 images and is manually sorted to 10 categories, including "aircraft", "car", "bird", "cat", "deer", "dog", "frog", "horse" and " truck". This is a single-label dataset. The size of each image is 32 x 32 pixels. If two images share the same label, they are considered similar, that is to say, they belong to the same category. Otherwise, they are considered dissimilar. First, we adjust the size of all images in the two datasets to 224 x 224 pixels, and then use the original image pixels directly as the input to the deep hash method. The deep hash method uses the same pre-trained CNN-F model on ImageNet for feature learning. We implement this model on MatConvNet and modify the small batch size to 128 using the cross-validation strategy, meanwhile, adjust the learning rate from 10-6 to 10-2. In addition, we set the weights decay as 5×10-4 so as to avoid overfitting.
In the experiments, the supervisory information is defined based on whether two data points share at least one category label. We evaluate our method and other comparison methods by performing hamming ranking tasks and hash lookup tasks. We show the average accuracy (mAP) of the hamming sorting task. Specifically, given a query xq, its average accuracy (AP) can be calculated by the following formula:   Table 3 and Table 4 respectively list the MAP results of all the methods of CIFAR-10 and NUS-WIDE under the experimental setup. As you can see from Table 1, the proposed method is obviously superior to the traditional hash method on the CIFAR-10 dataset, and our method's MAP results are more than two times more than LFH, FastH, and ITQ. In addition, most deep hashing methods perform better than traditional hashing methods. Compared with DSH, our method further improves the performance of 3 to 7%. These results prove that learning hash functions and classifiers in a streaming framework can improve retrieval performance. In the NUS-WIDE dataset, the difference between the deep hashing method and the traditional hash method is also very large, which is the same as the CIFAR-10 dataset. It further illustrates that the performance of a new deep semantic discrete hash algorithm is better than that of other comparison methods.

Conclusions
In this paper, we propose a new depth semantic discrete hash algorithm, which directly restricts the output of the last layer to binary code, and the pair tag information and classification information are used to learn hash codes in a stream framework. Due to the discrete properties of hash codes, we derive an alternate minimization method to optimize the loss function. A large number of experiments show that our method performs better than the most advanced method in the datum image retrieval data set.