A zero-shot hash retrieval method based on ensemble learning

By using the integrated learning method in the image retrieval system, combined with the strategy of dividing data sets and combining models, the zero-sample problem is solved, the retrieval effect of new categories of images is improved, more accurate and efficient image retrieval is achieved, and storage space is reduced. .

CN112364192BInactive Publication Date: 2024-10-01SUN YAT SEN UNIV
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202011092264.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-13
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing image retrieval systems have poor retrieval results when faced with new categories of images and cannot effectively solve the zero-sample problem, making it difficult to quickly find target information in a huge database.

Method used

A zero-shot hash retrieval method based on ensemble learning is adopted. By dividing the training set into two non-overlapping parts according to category labels, the VGG-16 model and fully connected layer are used to extract the hash code, and the triplet loss and SWA method are used. Train and update the network, combined with partitioning data sets and combining model strategies, to improve the generalization ability of the model.

Benefits of technology

It improves the retrieval effect of the model on new category images, ensures the accuracy and efficiency of retrieval on new category images, reduces storage space, and integrates the characteristics and advantages of different hash algorithms to achieve more accurate and efficient images. Retrieve.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112364192B_ABST
    Figure CN112364192B_ABST
Patent Text Reader

Abstract

The present invention provides a zero-sample hash retrieval method based on ensemble learning. The method applies the ensemble learning method to the zero-sample image retrieval problem, uses VGG‑16 to extract the high-dimensional real number features of the image, and then uses a fully connected layer and an activation function to convert the high-dimensional real number features into a low-dimensional binary hash code, thereby reducing the storage space while ensuring the retrieval effect. Afterwards, the hash model is updated using the ensemble learning training method, so that the model has a stronger generalization ability, and the retrieval effect of the model on new categories of images is also greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision, and more specifically, to a zero-sample hash retrieval method based on ensemble learning. Background Art

[0002] With the rapid development of the Internet, various types of data have exploded, including pictures, text, videos and other information. This has led to people spending a lot of time looking for content they are interested in. When people browse the web or use mobile software with a goal, facing such a huge database with thousands of pieces of information displayed on the interface, it is often difficult to quickly find all the target information with the naked eye, so the retrieval system came into being.

[0003] Image retrieval is an important part of the retrieval system. Hash technology has been used in the field of fast image retrieval. Using image labels as supervisory information to train deep neural networks can make the effect of hash technology better. However, new concepts and new images are generated on the Internet every day, which brings new challenges to the retrieval system: the zero-sample problem, that is, when the trained model encounters a new category of images that have never been seen before, the retrieval effect will become very poor. In order to solve this problem, a zero-sample hash retrieval method is proposed in the present invention, which uses the idea of ​​ensemble learning to improve the generalization ability of the model, so that the model can also have a good retrieval effect when encountering new categories of images.

[0004] Ensemble learning mainly combines multiple weakly supervised models to obtain a better and more comprehensive strongly supervised model. It is a meta-algorithm that combines several machine learning techniques into a prediction model to reduce variance, bias or improve prediction. Ensemble learning methods are mainly divided into two categories: integration of data sets and integration of model fusion. Among them, the integration of data sets refers to sampling multiple data sets using the Bootstrap method, or changing the data distribution by updating the weights of each sample, and training multiple models separately for combination, such as Bagging and Boosting methods; the integration of model fusion refers to combining multiple learners in different ways to obtain better results. For regression problems, the average method can be used; for classification problems, the majority voting method can be used.

[0005] The patent specification with application number 201510200864.2 discloses a fast image retrieval method based on integrated hash coding. The application first extracts SIFT features of training images and query images, and uses M hash algorithms to perform initial hash coding on the training images; then uses the consistency constraint criterion in integrated learning to re-learn the initial hash coding results to obtain an integrated hash mapping matrix; finally, the training images and query images are re-encoded with integrated hash coding, and based on the integrated hash coding, the Hamming distance between the query image and the training image is calculated for fast retrieval. The integrated hash coding in the present invention can simultaneously integrate the characteristics and advantages of different hash algorithms, solve the problems of insufficient discrimination and limited scope of application of a single hash algorithm, thereby making the fast retrieval of images more accurate and efficient. However, the patent cannot realize the combination of the two strategies of dividing the data set and combining the model to improve the generalization ability of the model, and the retrieval effect is also greatly improved. Summary of the invention

[0006] The present invention provides a zero-sample hash retrieval method based on ensemble learning. The method combines two strategies, namely, dividing the data set and combining models, to improve the generalization ability of the model, and the retrieval effect is also greatly improved.

[0007] In order to achieve the above technical effects, the technical solution of the present invention is as follows:

[0008] A zero-shot hash retrieval method based on ensemble learning includes the following steps:

[0009] S1: Divide the training set into two parts A and B with non-overlapping categories according to the category labels;

[0010] S2: Use A, B and A+B as training data respectively, and get the hash code of the training samples through the VGG-16 model and a fully connected layer;

[0011] S3: Use triplet loss to get the loss during training;

[0012] S4: Use the SWA method to train and update the network to obtain a converged model;

[0013] S5: The three data sets in step S2 can be trained to obtain three different models, and their average is calculated to obtain the final integrated model;

[0014] S6: Calculate the retrieval results of the integrated model on the test set.

[0015] Furthermore, the specific process of step S1 is:

[0016] The training set is divided into two parts A and B according to the category labels. For the cifar10 dataset, categories 1 to 9 are divided into the training set, and category 10 is divided into the test set. During the training process, the training set needs to be divided into two parts A (category 1 to 5) and B (category 6 to 9) according to the category.

[0017] Furthermore, the design of the hash model in step S2 is:

[0018] S21: First, the data sets A, B and A+B are used as training sets to train three different models. The specific training steps are as follows;

[0019] S22: Use the VGG-16 model to extract high-dimensional real number features (4096 dimensions) of image samples in the training set;

[0020] S23: After the high-dimensional real number features obtained in step S22 are input into the fully connected layer and the tanh activation function, a real number vector v is obtained, and then v is binarized (elements greater than 0 are set to 1, and elements less than 0 are set to 0) to obtain a binary code b, i.e., a hash code. The quantization formula is as follows:

[0021]

[0022] Furthermore, the specific steps of triple loss in step S3 are:

[0023] S31: In each batch of training samples, construct a triplet <I, I pos , I neg > (where the origin I is a sample randomly selected from the training samples, and the same sample point I pos is a sample of the same category as I, while the heterogeneous sample point I neg is a sample of a different category from I);

[0024] S32: The triplet loss calculation formula is as follows:

[0025]

[0026] The hyperparameter margin represents the difference between I and negative sample I neg The distance between I and positive sample I pos The minimum difference of the distance; the Euclidean distance is used to represent the distance between the real features of two samples.

[0027] Furthermore, the training process of SWA in step S4 is:

[0028] S41: First, use the pre-trained model parameters of VGG-16 to initialize the feature extraction model, and then randomly initialize the last fully connected layer (the fully connected layer used to obtain the hash code) to obtain the initialized weights and w swa ;

[0029] S42: Iterate n rounds to train the model;

[0030] S43: For the i-th iteration, the learning rate and model weight are updated in sequence. The update formula is as follows:

[0031] Cyclic learning rate:

[0032] Update network weights:

[0033] S44: For the i-th iteration, if mod(i, c) = 0, where c is a preset hyperparameter representing the cycle length, the final network weight w is updated using a sliding average method. swa , the formula is as follows:

[0034] n models =i / c

[0035]

[0036] Furthermore, the process of obtaining the integrated model in step S5 is:

[0037] S51: Use training sets A, B and A+B to train the model respectively, and obtain three different model weights w 1 、w 2 and w 3 , and use the average method to get the final integrated model weight:

[0038]

[0039] Furthermore, in step S6, the process of calculating the retrieval accuracy (mAP) of the integrated model on the test set is as follows:

[0040] S61: Calculate the Hamming distance between the query image hash code and the hash codes of all images in the database (Hamming distance = XOR operation of the hash code words on the corresponding bits and sum, i.e. the number of code elements with different values);

[0041] S62: Sort the hash codes in the database from small to large according to the Hamming distance with the query image, and determine whether the image and the text belong to the same category according to the labels. If they are the same, the retrieval is correct, and the AP value is calculated accordingly.

[0042] Overall search index:

[0043] Average accuracy:

[0044] Where i represents the i-th test set image; I is the number of test set images. k represents the ranking position in the retrieval list obtained when the i-th image is used as the query image; P k is the accuracy of the first k results, that is (Note: If image a and image b have the same label, then image a is considered to be related to image b); rel k Indicates whether the image at position k is related to the search image. If so, it is 1; otherwise, it is 0. m represents the number of images with the same label as the search image in the entire sorted list.

[0045] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:

[0046] The present invention applies the method of ensemble learning to the problem of zero-shot image retrieval. VGG-16 is used to extract the high-dimensional real number features of the image, and then the high-dimensional real number features are converted into low-dimensional binary hash codes using a fully connected layer and an activation function, which reduces the storage space while ensuring the retrieval effect. Afterwards, the hash model is updated using the training method of ensemble learning, so that the model has stronger generalization ability, and the retrieval effect of the model on new categories of images is also greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is the algorithm flow chart of the present invention;

[0048] Figure 2 Schematic diagram of the SWA method of the present invention. DETAILED DESCRIPTION

[0049] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;

[0050] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;

[0051] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0052] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0053] like Figure 1 As shown, a zero-shot hash retrieval method based on ensemble learning includes the following steps:

[0054] S1: Divide the training set into two parts A and B with non-overlapping categories according to the category labels;

[0055] S2: Use A, B and A+B as training data respectively, and get the hash code of the training samples through the VGG-16 model and a fully connected layer;

[0056] S3: Use triplet loss to get the loss during training;

[0057] S4: Use the SWA method to train and update the network to obtain a converged model;

[0058] S5: The three data sets in step S2 can be trained to obtain three different models, and their average is calculated to obtain the final integrated model;

[0059] S6: Calculate the retrieval results of the integrated model on the test set.

[0060] The specific process of step S1 is:

[0061] The training set is divided into two parts A and B according to the category labels. For the cifar10 dataset, categories 1 to 9 are divided into the training set, and category 10 is divided into the test set. During the training process, the training set needs to be divided into two parts A (category 1 to 5) and B (category 6 to 9) according to the category.

[0062] The design of the hash model in step S2 is:

[0063] S21: First, the data sets A, B and A+B are used as training sets to train three different models. The specific training steps are as follows;

[0064] S22: Use the VGG-16 model to extract high-dimensional real number features (4096 dimensions) of image samples in the training set;

[0065] S23: After the high-dimensional real number features obtained in step S22 are input into the fully connected layer and the tanh activation function, a real number vector v is obtained, and then v is binarized (elements greater than 0 are set to 1, and elements less than 0 are set to 0) to obtain a binary code b, i.e., a hash code. The quantization formula is as follows:

[0066]

[0067] The specific steps of triple loss in step S3 are:

[0068] s31: In each batch of training samples, construct a triplet <I, I pos , I neg > (where the origin I is a sample randomly selected from the training samples, and the same sample point I pos is a sample of the same category as I, while the heterogeneous sample point I negis a sample of a different category from I);

[0069] S32: The triplet loss calculation formula is as follows:

[0070]

[0071] The hyperparameter margin represents the difference between I and negative sample I neg The distance between I and positive sample I pos The minimum difference of the distance; the Euclidean distance is used to represent the distance between the real features of two samples.

[0072] like Figure 2 As shown, the training process of SWA in step S4 is:

[0073] S41: First, use the pre-trained model parameters of VGG-16 to initialize the feature extraction model, and then randomly initialize the last fully connected layer (the fully connected layer used to obtain the hash code) to obtain the initialized weights and w swa ;

[0074] S42: Iterate n rounds to train the model;

[0075] S43: For the i-th iteration, the learning rate and model weight are updated in sequence. The update formula is as follows:

[0076] Cyclic learning rate:

[0077] Update network weights:

[0078] S44: For the i-th iteration, if mod(i, c) = 0, where c is a preset hyperparameter representing the cycle length, the final network weight w is updated using a sliding average method. swa , the formula is as follows:

[0079] n models =i / c

[0080]

[0081] The process of obtaining the integrated model in step S5 is:

[0082] S51: Use training sets A, B and A+B to train the model respectively, and obtain three different model weights w 1 、w 2 and w 3 , and use the average method to get the final integrated model weight:

[0083]

[0084] Furthermore, in step S6, the process of calculating the retrieval accuracy (mAP) of the integrated model on the test set is as follows:

[0085] S61: Calculate the Hamming distance between the query image hash code and the hash codes of all images in the database (Hamming distance = XOR operation of the hash code words on the corresponding bits and sum, i.e. the number of code elements with different values);

[0086] S62: Sort the hash codes in the database from small to large according to the Hamming distance with the query image, and determine whether the image and the text belong to the same category according to the labels. If they are the same, the retrieval is correct, and the AP value is calculated accordingly.

[0087] Overall search index:

[0088] Average accuracy:

[0089] Where i represents the i-th test set image; I is the number of test set images. k represents the ranking position in the retrieval list obtained when the i-th image is used as the query image; P k is the accuracy of the first k results, that is (Note: If image a and image b have the same label, then image a is considered to be related to image b); rel k Indicates whether the image at position k is related to the search image. If so, it is 1; otherwise, it is 0. m represents the number of images with the same label as the search image in the entire sorted list.

[0090] The same or similar reference numerals correspond to the same or similar components;

[0091] The positional relationships described in the drawings are only for illustrative purposes and should not be construed as limiting the present patent;

[0092] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.

Claims

1. A zero-shot hash retrieval method based on ensemble learning, characterized in that: The following steps are involved: S1: Divide the training set into two parts A and B with non-overlapping categories according to the category labels; S2: Use A, B and A+B as training data respectively, and get the hash code of the training samples through the VGG-16 model and a fully connected layer; S3: Use triplet loss to get the loss during training; S4: Use the SWA method to train and update the network to obtain a converged model; the SWA training process in step S4 is: S41: First, use the pre-trained model parameters of VGG-16 to initialize the feature extraction model, and then randomly initialize the last fully connected layer. The last fully connected layer is the fully connected layer used to obtain the hash code, and the initialized weights are obtained. and w swa ; S42: Iterate n rounds to train the model; S43: For the i-th iteration, the learning rate and model weight are updated in sequence. The update formula is as follows: Cyclic learning rate: Update network weights: S44: For the i-th iteration, if mod(i,c) = 0, where c is a preset hyperparameter representing the cycle length, the final network weight w is updated using a sliding average method. swa , the formula is as follows: n models =i / c S5: A, B and A+B in step S2 are used as training data to train three different models, and the average value of the three different models is calculated to obtain the final integrated model; S6: Calculate the retrieval results of the integrated model on the test set.

2. The zero-sample hash retrieval method based on ensemble learning according to claim 1, characterized in that: The specific process of step S1 is: The training set is divided into two parts A and B according to the category labels. For the data set cifar10, categories 1 to 9 are divided into the training set, and category 10 is divided into the test set. During the training process, the training set is divided into two parts A and B according to the category. Part A includes categories 1 to 5, and part B includes categories 6 to 9.

3. The zero-sample hash retrieval method based on ensemble learning according to claim 2, characterized in that: The design of the hash model in step S2 is: S21: First, the datasets A, B, and A+B are used as training sets to train three different models; S22: Use the VGG-16 model to extract high-dimensional real number features of image samples in the training set; S23: After the high-dimensional real number features obtained in step S22 are input into the fully connected layer and the tanh activation function, a real number vector v is obtained, and then v is binarized. If the elements greater than 0 are set to 1, and the elements less than 0 are set to 0, a binary code b is obtained, that is, a hash code. The quantization formula is as follows:

4. The zero-sample hash retrieval method based on ensemble learning according to claim 3 is characterized in that: The specific steps of triple loss in step S3 are: S31: Construct triples in each batch of training samples <I,I pos ,I neg >, where the origin I is a sample randomly selected from the training samples, and the same sample point I pos is a sample of the same category as I, while the heterogeneous sample point I neg is a sample of a different category from I; S32: The triplet loss calculation formula is as follows: The hyperparameter margin represents the difference between I and negative sample I neg The distance between I and positive sample I pos The minimum difference of the distance; the Euclidean distance is used to represent the distance between the real features of two samples.

5. The zero-sample hash retrieval method based on ensemble learning according to claim 4, characterized in that: In step S5, the process of obtaining the integrated model is: Use training sets A, B and A+B to train the model respectively, and get three different model weights w1, w2 and w3. Use the average method to get the final integrated model weight:

6. The zero-sample hash retrieval method based on ensemble learning according to claim 5, characterized in that: In step S6, the process of calculating the retrieval accuracy of the integrated model on the test set is as follows: S61: Calculate the Hamming distance between the query image hash code and the hash codes of all images in the database; S62: Sort the hash codes in the database in ascending order according to the Hamming distance to the query image, and determine whether the image and the text belong to the same category according to the labels. If they are of the same category, the search is correct, and the AP value is calculated accordingly: Overall search index: Average accuracy: Where i represents the i-th test set image; I is the number of test set images, and k represents the ranking position in the retrieval list obtained when the i-th image is used as the query image; P k is the accuracy of the first k results, that is rel k Indicates whether the image at position k is related to the search image. If so, it is 1; otherwise, it is 0. m represents the number of images with the same label as the search image in the entire sorted list.

7. The zero-sample hash retrieval method based on ensemble learning according to claim 6, characterized in that: In step S61, the Hamming distance = performing an XOR operation on the hash code words at the corresponding positions and summing them, that is, the number of code elements with different values.

8. The zero-sample hash retrieval method based on ensemble learning according to claim 7, characterized in that: In step S62, if picture a and picture b have the same label, then picture a is related to picture b.

9. The zero-sample hash retrieval method based on ensemble learning according to any one of claims 1 to 8, characterized in that: The dimension of the high-dimensional real numbers extracted from the image samples in the training set using the VGG-16 model is 4096 dimensions.

Citation Information

Patent Citations

  • Fast image retrieval method based on integrated hash encoding

    CN104765872A

  • Image retrieval method based on variable-length depth hash learning

    CN105512273A

  • An image retrieval method based on high-order depth hash learning

    CN109241313A

  • A cross-modal retrieval method based on cyclic generation antagonistic network

    CN109299342A

  • Image retrieval method of single-model multi-branch structure

    CN111125396A