A collaborative learning semi-supervised hashing method based on multi-granularity relations

By introducing an instance comparison module and a class-level comparison module, combined with a neighborhood consistency module, and utilizing the multi-granularity semantic relationships of unlabeled data, the problem of low retrieval accuracy caused by noise in existing semi-supervised hashing methods is solved, achieving higher image retrieval accuracy.

CN118445443BActive Publication Date: 2026-11-20INSTITUTE OF INFORMATION ENGINEERING CHINESE ACADEMY OF SCIENCES
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410434613.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-11
Publication Date
2026-11-20
Estimated Expiration
2044-04-11

AI Technical Summary

Technical Problem

Existing semi-supervised hashing methods suffer from low retrieval accuracy due to noise when using feature similarity between unlabeled and labeled data to supervise model training.

Method used

An instance comparison module and a class-level comparison module are introduced. By utilizing the instance-level and class-level relationships of unlabeled data, the discriminative power of hash codes is improved through a multi-granularity collaborative learning framework. A neighborhood consistency module is also designed to capture neighborhood similarity information.

Benefits of technology

Through collaborative learning of multi-granularity relationships, the retrieval accuracy of the semi-supervised image retrieval system was significantly improved, achieving better image retrieval results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118445443B_ABST
    Figure CN118445443B_ABST
Patent Text Reader

Abstract

The application discloses a kind of collaborative learning semi-supervised hash methods based on multi-granularity relation, its steps include:1) construct a backbone network, including two branches: student network and teacher network;2) training sample is input to student network, the feature representation and hash code of each training sample are obtained and it is stored to dynamic memory bank;3) calculate classification loss function, pairwise hash loss function, instance comparison loss, class-level comparison loss and neighborhood consistency loss function, for optimizing student network;4) according to the parameter of optimized student network parameter update teacher network;Then training sample is input to updated teacher network, the feature representation and hash code of each training sample are obtained and the dynamic memory bank is updated;5) repeat step 3) ~ 4) until student model converges or reaches set condition;6) input a to-be-encoded data to the final optimized student network, obtain its hash coding.The application improves the discrimination of hash code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer software technology and relates to a semi-supervised hashing method based on multi-granularity relationships and collaborative learning. Background Technology

[0002] With the rapid development of internet technology, the scale of image data has exploded. The massive amount of image data and high-dimensional image features make image retrieval tasks extremely time-consuming and require significant storage space. In recent years, deep hashing methods have attracted considerable attention due to their high computational efficiency and low storage cost.

[0003] Deep hashing is essentially a binary representation technique for images. Its main principle is to project high-dimensional data into a low-dimensional binary Hamming space while preserving the similarity between the original data. Then, it effectively measures the visual similarity between images through simple yet efficient bitwise operations, thus supporting fast and accurate image retrieval. Currently, supervised hashing methods demonstrate superior performance in large-scale image retrieval tasks, mainly due to their efficient use of large amounts of labeled image data. However, manually labeling large amounts of data is time-consuming and expensive, making supervised hashing impractical in many real-world scenarios. Therefore, deep semi-supervised hashing methods have been proposed, which can simultaneously learn more discriminative hash functions using both large amounts of unlabeled data and limited labeled data.

[0004] Existing semi-supervised hashing methods mainly utilize the deep feature similarity between unlabeled and labeled data to guide the learning of semantically relevant hash codes for unlabeled data. These studies typically first fine-tune the model using a small amount of labeled data, then extract deep features from the unlabeled data using the fine-tuned model to calculate the feature similarity between samples, and finally use the feature similarity to construct pairwise or triple relationships to train a semi-supervised retrieval model.

[0005] Currently, the semi-supervised hashing methods mentioned above only use the feature similarity relationship between unlabeled and labeled data to supervise the training of the model. However, since the features extracted from the unlabeled data by the fine-tuned model are noisy, the calculated feature similarity is not accurate. Using this inaccurate similarity relationship to supervise the training of the model makes it difficult to achieve satisfactory retrieval accuracy. Summary of the Invention

[0006] To address the problems existing in the prior art, the present invention aims to provide a semi-supervised hashing method based on multi-granularity relationships through collaborative learning. This method further improves the retrieval accuracy of semi-supervised image retrieval systems by utilizing the complex multi-granularity semantic relationships of unlabeled data. The invention introduces an instance comparison module and a class-level comparison module, obtaining inter-class separable hash codes by utilizing the hierarchical semantic relationships of unlabeled data. Furthermore, a neighborhood consistency module is proposed, capturing neighborhood semantic similarity information by aggregating neighborhood representations.

[0007] This invention proposes a multi-granularity-based collaborative learning hashing (MGCLH) framework, which embeds complementary multi-granularity similarity information of unlabeled data into the hash code to improve its discriminative power.

[0008] This invention proposes an instance comparison module and a class-level comparison module, which utilize the instance-level and class-level relationships of unlabeled data to obtain separable hash codes between classes.

[0009] This invention designs a novel neighborhood consistency module that captures neighborhood similarity information of unlabeled data to generate intra-class compact hash codes.

[0010] The technical solution of this invention is as follows:

[0011] A semi-supervised hashing method based on multi-granularity relationships through collaborative learning, comprising the following steps:

[0012] 1) Construct a backbone network, which includes two branch networks with the same structure, one branch network being a student network and the other branch network being a teacher network. The branch networks include a feature extractor, a classification layer, and a hash layer that process the input data in sequence.

[0013] 2) Input the training samples into the student network to obtain the feature representation and hash code of each training sample and store them in the dynamic memory M; wherein, the training samples include labeled samples and unlabeled samples; f i m Let be the feature representation of the i-th training sample. Let be the hash code of the i-th training sample;

[0014] 3) Calculate the classification loss function L ce =∑ l∈L -y l log(f l ), where L represents the labeled sample set, y l Labeled sample x l The real label, f l Labeled sample xl The classification layer predicts the probability distribution; the pairwise hash loss function is calculated.

[0015] in h g Labeled sample x g The hash code output by the student network, h l Labeled sample x l The hash code output by the student network; calculate the comparison loss of the examples. Where U is the unlabeled sample set, τ is the temperature parameter, and sim(·) is the cosine similarity. It is an unlabeled sample x k The hash code output by the student network, For unlabeled sample x k The augmented view hash code corresponding to the dynamic memory M. For unlabeled sample x p The corresponding augmented view hash code in the dynamic memory M It is an indicator function; it calculates the class-level contrastive loss. in

[0016] Labeled sample x j Feature representation in dynamic memory M It is an unlabeled sample x k The feature representation output by the student network, where T represents matrix transpose and ||| represents the L2 norm. For unlabeled sample x k pseudo-tags;

[0017] Calculate the neighborhood consistency loss function Where h avg For unlabeled sample x k Local neighborhood information; then based on L ce L h L icm L ccm L ncm Optimize student network; j Labeled sample x j The tag, Represents unlabeled sample x k and labeled sample x j Belonging to the same category, x represents k and x j They belong to different categories;

[0018] 4) Update the parameters of the teacher network according to the optimized student network parameters; then input the training samples into the updated teacher network to obtain the feature representation and hash code of each training sample and update the dynamic memory M;

[0019] 5) Repeat steps 3) to 4) until the student model converges or meets the set conditions;

[0020] 6) Input the data to be encoded into the final optimized student network to obtain the hash code of the data to be encoded.

[0021] Furthermore, the unlabeled sample x is calculated using the K-nearest neighbor algorithm. k The unlabeled sample x is obtained by calculating the Euclidean distance between the features of all labeled samples in the dynamic memory M and the features of all labeled samples. k Find the nearest neighbor sample and use the label of that nearest neighbor sample as the unlabeled sample x. k pseudo-tags

[0022] Furthermore, Where β is the equilibrium hyperparameter, N k For unlabeled sample x k The set of neighbor sample hash codes, For N k The hash code of the q-th sample in the dataset; calculated by the unlabeled sample x. k The hash codes of the n samples with the smallest Euclidean distances to the features of all samples in the dynamic memory M are selected as unlabeled samples x. k Neighbor N k .

[0023] Furthermore, the parameters of the teacher network are updated based on the optimized student network parameters using an exponential moving average strategy.

[0024] Furthermore, the training samples are image data, and the data to be encoded is image x.

[0025] A server is characterized by comprising a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the steps of the methods described above.

[0026] A computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the steps of the above-described method.

[0027] The advantages of this invention are as follows:

[0028] Compared with existing semi-supervised deep hashing methods, this invention proposes a collaborative learning semi-supervised hashing method based on multi-granularity relationships for semi-supervised image retrieval tasks. This method further improves the discriminative power of hash codes by mining and utilizing the complex multi-granularity semantic relationships in unlabeled data. The method obtains inter-class separable hash codes through instance-level and class-level comparison modules, while simultaneously utilizing a neighborhood consistency module to obtain compact intra-class hash codes. Experiments show that this invention achieves better retrieval results on commonly used image datasets. Attached Figure Description

[0029] Figure 1 This is the network structure diagram of the present invention. Detailed Implementation

[0030] The present invention will now be described in further detail with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.

[0031] This invention improves the discriminative power of hash codes by mining and utilizing the complex multi-granularity semantic relationships in unlabeled data, and designs a collaborative learning semi-supervised hashing framework based on multi-granularity relationships, such as... Figure 1 As shown, the framework mainly consists of four parts: (1) a teacher-student network as the backbone network, which includes a student network and a teacher network. The teacher network and the student network are branch networks of the backbone network, and they have the same structure. Each branch network includes a feature extractor, a classification layer and a hash layer. (2) an instance comparison module, which is used to construct instance-level relationships of unlabeled data to achieve coarse clustering of hash codes in a self-supervised manner. (3) a class-level comparison module, which is used to learn separable hash codes between classes by utilizing the constructed class-level relationships of unlabeled data. (4) a neighborhood consistency module, which is used to learn compact hash codes within classes by utilizing the neighborhood relationships of unlabeled data.

[0032] The specific approach involves first inputting labeled and unlabeled image data under different data augmentation conditions into the teacher network and student network, respectively.

[0033] For labeled image data, this invention performs classification in the classification layer of the student network, and the classification loss function is as follows:

[0034] L ce =∑ l∈L -y l log(f l (1)

[0035] Where y l and f l There is labeled data x l The true labels and classification layer prediction probability distributions are given, where L represents the index of the labeled dataset.

[0036] Simultaneously, hash code learning is performed at the hash layer of the student network, with the pairwise hash loss function as follows:

[0037]

[0038] in h l There is labeled data x l The hash code output by the student network hash layer, where L represents the labeled dataset index.

[0039] Then, the present invention establishes a dynamic memory library. The feature representation f used to store the training samples i m and hash code The training samples include labeled and unlabeled data, f i m Let be the feature representation of the i-th training sample. Let be the hash code of the i-th training sample. Specifically, after each update of the teacher network parameters, unlabeled and labeled data are input into the teacher network, and feature representations and hash codes are obtained from the classification layer and hash layer, respectively, to update the dynamic memory M.

[0040] For each unlabeled sample x k hash code The instance comparison module retrieves the corresponding augmented view hash code from the dynamic memory M. As positive samples, the hash codes of other samples in the dynamic memory are used as negative samples. Subsequently, this invention introduces instance-contrast loss L. icm .

[0041]

[0042] Where τ is the temperature parameter, and sim(·) is the cosine similarity. It is the unlabeled sample x output by the student network hash layer. k hash code, It is an indicator function, which is 1 if p ≠ k, and 0 otherwise. U is the index of the unlabeled dataset.

[0043] Meanwhile, the class-level comparison module calculates x using the K-nearest neighbor algorithm. k x is obtained by calculating the Euclidean distance between the features and all labeled data in the dynamic memory. k Find the nearest neighbor sample and let the label of that nearest neighbor sample be x. k pseudo-tags

[0044] Then, semantic similarity relationships are constructed using the pseudo-labels of unlabeled data and the labels of labeled data, as defined below:

[0045]

[0046] Among them, y j Labeled sample x j The tag, Represents unlabeled sample x k and labeled sample x j Belonging to the same category, x represents k and x j They belong to different categories.

[0047] Furthermore, unlabeled samples x were further utilized k and labeled sample x j The cosine similarity is used as a weight for the relationship to weaken the potential bias caused by noise. The cosine similarity is defined as follows:

[0048]

[0049] in, Labeled sample x j Feature representation in dynamic memory It is an unlabeled sample x k In the feature representation of the student network output, T represents the matrix transpose, and ||| represents the L2 norm.

[0050] Next, using the cosine similarity between samples as the weight of the category-level similarity relationship, the unlabeled sample x is recalculated. k and labeled sample x j Similarities between them:

[0051]

[0052] Based on the constructed similarity relationship between unlabeled and labeled data, this invention proposes a class-level contrastive loss Li. ccm Unlabeled sample x k Close the corresponding positive example, and at the same time make x k Stay away from negative examples.

[0053]

[0054] Furthermore, to obtain compact hash codes within a class, this invention proposes a neighborhood consistency module. Specifically, this invention first calculates the Euclidean distances to the features of all samples in the dynamic memory M. Then, these distances are sorted in ascending order, and the hash codes of the n samples with the smallest distances are selected as the unlabeled sample x. k Neighbors

[0055] Subsequently, the unlabeled sample x is obtained by aggregating the hash codes of neighboring samples. k The local neighborhood information can be defined as follows:

[0056]

[0057] Where β is the equilibrium hyperparameter.

[0058] Subsequently, a neighborhood consistency loss function L was designed. ncm Neighborhood structure information is embedded into the hash code.

[0059]

[0060] Next, formula L ce L h L icm L ccm L ncm By combining the results, we obtain the overall objective function L. all .

[0061] L all =L ce +L h +L icm +L ccm +L ncm (10)

[0062] Then, the hash retrieval model is trained using the loss function described above. Specifically: First, labeled and unlabeled data are input into the student network, and the student network is optimized using Equation 10; second, the teacher network parameters are updated using the optimized student network parameters with an exponential moving average (EMA) strategy; then, labeled and unlabeled data are input into the updated teacher network, and the contents of the dynamic memory M are updated using the outputs of the teacher network's classification layer and hash layer.

[0063] Once the hash model has been trained, it can be used to generate hash codes for images. Specifically: First, an image x is input into the student network; then, the hash code is obtained by binarizing the real-valued output of the student network's hash layer.

[0064] This invention conducted extensive experiments to evaluate the retrieval performance of MGCLH. The model of this invention was trained and tested on the image datasets CIFAR-10 and NUS-WIDE. CIFAR-10 is a single-label color image dataset consisting of 60,000 images across 10 categories, with 6,000 images per category. 100 images are randomly selected from each category to form the query set, and the remaining images are used as the retrieval set. Furthermore, this invention randomly samples 500 images from each category in the retrieval set to form a labeled training sample set, with the remaining images forming an unlabeled training sample set. NUS-WIDE is a multi-label image dataset containing nearly 270,000 images, each with one or more labels from 81 categories. This invention selects the 21 most frequent classes for training, with each class containing at least 5,000 images. 100 images are randomly selected from each category to form the query set, and the remaining images form the retrieval set. This invention randomly samples 500 images from each category in the retrieval set as labeled training samples, using the remaining images as an unlabeled training sample set. The base network of this invention uses a pre-trained AlexNet.

[0065] The experiments used the mean average precision (mAP) for different bit lengths to evaluate the retrieval performance of this invention. This invention used all returned samples for evaluation on CIFAR1-10, while for NUS-WIDE, it used the first 5000 retrieved samples.

[0066] Table 1 shows the mAP results of MGCLH and other image retrieval methods on CIFAR-10 and NUS-WIDE. Experimental results demonstrate that the present invention outperforms other comparative methods.

[0067] Table 2 presents the results of the ablation experiments for MGCLH. The experimental results show that the three modules proposed in this invention can significantly improve the semi-supervised retrieval performance.

[0068] Table 1 shows the mAP results of different methods on two datasets with different bit lengths.

[0069]

[0070]

[0071] Table 2 Ablation Experiment Results

[0072]

[0073] Although specific embodiments of the invention have been disclosed for illustrative purposes to aid in understanding and implementing the invention, those skilled in the art will understand that various substitutions, variations, and modifications are possible without departing from the spirit and scope of the invention and the appended claims. Therefore, the invention should not be limited to the content disclosed in the preferred embodiments, and the scope of protection claimed by the invention is defined by the claims.

Claims

1. A semi-supervised hashing method based on multi-granularity relationships through collaborative learning, comprising the following steps: 1) Construct a backbone network, which includes two branch networks with the same structure, one branch network being a student network and the other branch network being a teacher network. The branch network includes a feature extractor, a classification layer, and a hash layer that process the input data in sequence. 2) Input the training samples into the student network to obtain the feature representation and hash code of each training sample and store them in the dynamic memory. The training samples include labeled samples and unlabeled samples. Let be the feature representation of the i-th training sample. Let be the hash code of the i-th training sample; 3) Calculate the classification loss function ,in This indicates a labeled sample set. Labeled samples The true label, Labeled samples The classification layer predicts the probability distribution; the pairwise hash loss function is calculated. ,in , Labeled samples The hash code output by the student network, Labeled samples The hash code output by the student network; calculate the comparison loss of the examples. Where U is the unlabeled sample set, The temperature parameter is sim(·), and sim(·) represents the cosine similarity. It is an unlabeled sample The hash code output by the student network, Unlabeled samples The augmented view hash code corresponding to the dynamic memory M. Unlabeled samples The corresponding augmented view hash code in the dynamic memory M It is an indicator function; it calculates the class-level contrastive loss. ,in , , , Labeled samples Feature representation in dynamic memory M It is an unlabeled sample The feature representation output by the student network, where T represents the matrix transpose, Describing the L2 norm, Unlabeled samples Pseudo-labels; Calculate the neighborhood consistency loss function =- ,in Unlabeled samples Local neighborhood information; then based on , , , , Optimize student networks; Labeled samples The tag, =1 indicates no label and with tags Belonging to the same category, =0 means and They belong to different categories; 4) Update the parameters of the teacher network based on the optimized student network parameters; then input the training samples into the updated teacher network to obtain the feature representation and hash code of each training sample and update the dynamic memory. ; 5) Repeat steps 3) to 4) until the student network converges or meets the set conditions; 6) Input a data to be encoded into the final optimized student network to obtain the hash code of the data to be encoded; the training sample is image data and the data to be encoded is image x.

2. The method according to claim 1, characterized in that, Calculate unlabeled values ​​using the K-nearest neighbor algorithm. The Euclidean distance between the features of all labeled samples in the dynamic memory M is used to obtain unlabeled samples. The nearest neighbor sample is used as the unlabeled sample. pseudo-tags .

3. The method according to claim 1, characterized in that, = ;in, It is a balancing hyperparameter. Unlabeled The set of neighbor sample hash codes, for The hash code of the q-th sample in the dataset; calculated by unlabeled... The hash codes of the n samples with the smallest Euclidean distances to the features of all samples in the dynamic memory M are selected as unlabeled samples. Neighbors .

4. The method according to claim 1, 2, or 3, characterized in that, The parameters of the teacher network are updated based on the optimized student network parameters using an exponential moving average strategy.

5. A server, characterized in that, It includes a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing each step of the method of any one of claims 1 to 4.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Image classification method based on neighbor supervision discrete discriminant hash

    CN114022701A

  • Image hash coding method based on direct push type semi-supervised deep learning

    CN114170333A