A retrieval method, device, and storage medium

By pre-storing hash codes in the image library and text library, and using preset text-image association relationship and Hamming distance sorting, the problem of search speed and inefficiency in existing cross-media search technologies is solved, and fast and efficient cross-media search is achieved.

CN114020952BActive Publication Date: 2025-06-13ZALL INTELLIGENCE (WUHAN) RES INST CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111220757.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-20
Publication Date
2025-06-13
Estimated Expiration
2041-10-20

AI Technical Summary

Technical Problem

Existing cross-media retrieval technology requires the extraction of text and image features, resulting in slower retrieval speed and efficiency.

Method used

By storing the hash codes corresponding to images and text in the preset image library and text library, using the preset text-related relationship and Hamming distance sorting, the target image is directly filtered out from the preset library.

Benefits of technology

It improves the search speed and efficiency, can quickly locate target images, and meet the needs of cross-media retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114020952B_ABST
    Figure CN114020952B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a retrieval method, apparatus, and storage medium. The method includes: when retrieving a target image corresponding to a target text from a preset image library, determining a first image associated with the target text based on a preset text-image association relationship; and finding a first image hash code corresponding to the first image from the preset image library; the preset image library stores images and image hash codes corresponding to the images; finding a target text hash code corresponding to the target text from the preset text library, and determining the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and text hash codes corresponding to the texts; sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer applications, and in particular, to a retrieval method, an apparatus, and a storage medium. Background Art

[0002] In the era of cross-media big data, the ever-growing massive multi-modal information brings huge cross-media retrieval requirements, such as using text to search for images or videos, and vice versa. For example, an entry on Wikipedia usually contains a text description and example images, and the retrieval of such information requires the construction of cross-media indexing and learning methods. Compared with traditional single-media retrieval, the core problem of cross-media retrieval is how to mine the associations between the same or related semantic objects represented by different media.

[0003] Usually during retrieval, text features and image features are first extracted, and then the text features and image features are used for retrieval. However, this method results in slower retrieval speed and efficiency because feature extraction is required first. Summary of the Invention

[0004] Embodiments of the present application provide a retrieval method, an apparatus, and a storage medium, which can improve the retrieval speed and thus achieve the purpose of improving the retrieval efficiency.

[0005] The technical solution of the present application is implemented as follows:

[0006] In a first aspect, embodiments of the present application provide a retrieval method, and the method includes:

[0007] When retrieving a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, determining a first image associated with the target text; and searching for a first image hash code corresponding to the first image in the preset image library; the preset image library stores images and the image hash codes corresponding to the images;

[0008] Searching for a target text hash code corresponding to the target text in a preset text library, and determining the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts;

[0009] Sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result.

[0010] In the above retrieval method, before determining the first image associated with the target text based on the preset text-image association relationship when retrieving the target image corresponding to the target text from the preset image library, the method further includes:

[0011] Use a first preset neural network to perform image feature extraction and hash code conversion on at least one image in the preset image library, and obtain at least one image hash code corresponding to the at least one image;

[0012] Store the at least one image hash code and the at least one image in correspondence in the preset image library.

[0013] In the above retrieval method, before determining a first image associated with the target text based on a preset text-image association relationship when retrieving a target image corresponding to the target text from a preset image library, the method further includes:

[0014] Use a second preset neural network to perform text feature extraction and hash code conversion on at least one text in the preset text library, and obtain at least one text hash code corresponding to the at least one text;

[0015] Store the at least one text hash code and the at least one text in correspondence in the preset text library.

[0016] In the above retrieval method, before determining a first image associated with the target text based on a preset text-image association relationship when retrieving a target image corresponding to the target text from a preset image library, the method further includes:

[0017] Establish a preset text-image association relationship based on the preset image library and the preset text library, where the preset text-image association relationship is used to represent the semantic correlation between the images in the preset image library and the texts in the preset text library.

[0018] In the above retrieval method, the step of sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result includes:

[0019] Sort the first images in ascending order of Hamming distance to obtain a sorting result, and determine the first preset number of images in the sorting result as the target images.

[0020] In a second aspect, an embodiment of the present application provides a retrieval device, where the device includes:

[0021] A determination module, configured to, when retrieving a target image corresponding to a target text from a preset image library, determine a first image associated with the target text based on a preset text-image association relationship; and find a first image hash code corresponding to the first image from the preset image library; the preset image library stores images and image hash codes corresponding to the images;

[0022] A search module, configured to search for a target text hash code corresponding to the target text from a preset text library, and determine a Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and text hash codes corresponding to the texts.

[0023] A data processing module, configured to sort the first images according to the Hamming distance to obtain a sorting result, and determine the target image from the first images based on the sorting result.

[0024] In the above-mentioned retrieval device, the data processing module is further configured to use a first preset neural network to perform image feature extraction and hash code conversion on at least one image in the preset image library, to obtain at least one image hash code corresponding to the at least one image; and store the at least one image hash code and the at least one image in correspondence in the preset image library.

[0025] In the above-mentioned retrieval device, the data processing module is further configured to use a second preset neural network to perform text feature extraction and hash code conversion on at least one text in the preset text library, to obtain at least one text hash code corresponding to the at least one text; and store the at least one text hash code and the at least one text in correspondence in the preset text library.

[0026] In a third aspect, an embodiment of the present application provides a retrieval device, characterized in that the device includes: a processor, a memory, and a communication bus; when the processor executes a running program stored in the memory, the retrieval method as described in any one of the above is implemented.

[0027] In a fourth aspect, an embodiment of the present application provides a storage medium, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the retrieval method as described in any one of the above is implemented.

[0028] The embodiments of the present application provide a retrieval method, a device, and a storage medium. The method includes: when retrieving a target image corresponding to a target text from a preset image library, determining a first image associated with the target text based on a preset text-image association relationship; and searching for a first image hash code corresponding to the first image in the preset image library; the preset image library stores images and their corresponding image hash codes; searching for a target text hash code corresponding to the target text in the preset text library, and determining the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and their corresponding text hash codes; sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result; adopting the above implementation solution, by pre-storing the hash codes corresponding to images and texts in the preset image library and the preset text library, when receiving a requirement to retrieve a target image according to a target text, the text hash code corresponding to the target text can be directly searched in the preset text library, and then the first images related to the target text can be screened out from the preset image library according to the preset text-image association relationship, the image hash code of the first image is taken out from the preset image library, and the Hamming distance between the first image and the target text is determined together with the text hash code, and the first images are sorted based on the Hamming distance, and the target image is returned. Since the present application pre-converts texts and images into hash codes for storage, the purpose of improving the retrieval efficiency can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 FIG. is a flowchart of a retrieval method provided by an embodiment of the present application;

[0030] Figure 2 FIG. is a flowchart of an exemplary method for determining an image hash code provided by an embodiment of the present application;

[0031] Figure 3 FIG. is a flowchart of an exemplary method for determining a text hash code provided by an embodiment of the present application;

[0032] Figure 4 FIG. is a schematic structural diagram of a retrieval device 1 provided by an embodiment of the present application;

[0033] Figure 5 FIG. is a schematic structural diagram of a retrieval device 1 provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0034] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0035] The embodiments of the present application provide a retrieval method, which is applied to a retrieval device. Figure 1A flowchart of a retrieval method provided by an embodiment of the present application is as follows Figure 1 As shown, the retrieval method may include:

[0036] S101. When retrieving a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, determine a first image associated with the target text; and find a first image hash code corresponding to the first image from the preset image library; the preset image library stores images and corresponding image hash codes.

[0037] In an embodiment of the present application, when the retrieval device retrieves a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, determine a first image associated with the target text; and find a first image hash code corresponding to the first image from the preset image library; the preset image library stores images and corresponding image hash codes.

[0038] A retrieval method provided by the present application can be applied when retrieving a target image corresponding to a target text.

[0039] In an embodiment of the present application, the preset text-image association relationship is established in advance before retrieval. Specifically: establish a preset text-image association relationship based on a preset image library and a preset text library, and the preset text-image association relationship is used to represent the semantic correlation between the images in the preset image library and the texts in the preset text library.

[0040] It should be noted that the preset text-image association relationship can be a similarity matrix. After establishing the similarity matrix using the preset image library and the preset text library, this similarity matrix can be denoted as S, where the elements in S can only be 0 or 1. When the element in the i-th row and j-th column of S is 0, it means that image i and text j are not semantically related. On the contrary, when the element in the i-th row and j-th column of S is 1, it means that image i and text j are semantically related; the specific form of establishing the preset text-image association relationship can be determined according to the actual situation, and the embodiments of the present application do not limit this here.

[0041] In an embodiment of the present application, before the retrieval operation, not only the preset text-image association relationship needs to be established in advance, but also the image hash code of each image in the preset image library needs to be obtained in advance; Figure 2 A flowchart of an exemplary method for determining an image hash code given by an embodiment of the present application is as follows Figure 2 As shown, the method is as follows:

[0042] S201. Use a first preset neural network to perform image feature extraction and hash code conversion on at least one image in the preset image library to obtain at least one image hash code corresponding to the at least one image.

[0043] It should be noted that the first preset neural network can be set with different parameters according to the actual situation. Table 1 shows an exemplary setting of the parameters of the first preset neural network in the embodiments of the present application, as shown in Table 1:

[0044] Table 1 Parameter Setting of the First Preset Neural Network

[0045] layer layer setting Convolutional Layer 1 Convolution Kernel: 64×11×11; Stride: 4×4; Padding: 0; Pooling: 2 Convolutional Layer 2 Convolution Kernel: 265×5×5; Stride: 1×1; Padding: 2; Pooling: 2 Convolutional Layer 3 Convolution Kernel: 265×3×3; Stride: 1×1; Padding: 1; Pooling: 0 Convolutional Layer 4 Convolution Kernel: 265×3×3; Stride: 1×1; Padding: 1; Pooling: 0 Convolutional Layer 5 Convolution Kernel: 265×3×3; Stride: 1×1; Padding: 0; Pooling: 2 Fully Connected Layer 6 4096 Fully Connected Layer 7 4096 Fully Connected Layer 8 Hash Code Conversion

[0046] As shown in Table 1 above, in the embodiments of the present application, 5 convolutional layers and 3 fully connected layers are set in the first preset neural network. After inputting the images in the preset image library into the first preset neural network, an image feature vector can be obtained after the fully connected layer 7, and then after inputting the image feature vector into the fully connected layer 8, an image feature vector represented by a hash code can be output, and the hash code conversion ability of the fully connected layer 8 also needs to be trained.

[0047] S202. Store at least one image hash code and at least one corresponding image in a preset image library.

[0048] It should be noted that by storing the image hash code and the image correspondingly in the preset image library, when determining the hash code corresponding to the image, it can be directly obtained from the preset image library.

[0049] In the embodiments of the present application, not only the image hash code of each image in the preset image library needs to be obtained in advance, but also the text hash code of each text in the preset text library needs to be obtained in advance; Figure 3 For an exemplary flowchart of a method for determining a text hash code in the embodiments of the present application, as Figure 3 shown, the method is as follows:

[0050] S301. Use a second preset neural network to perform text feature extraction and hash code conversion on at least one text in the preset text library to obtain at least one text hash code corresponding to at least one text.

[0051] It should be noted that the preset text library can be generated according to the keywords in the document. The keywords are extracted from the target document by using the term frequency-inverse document frequency (TF-IDF). Then, the preset text library is generated according to the extracted keywords.

[0052] It should be noted that TF-IDF is a combination of TF (term frequency) and IDF (inverse document frequency index), indicating that the more times a word appears in a document and the fewer times it appears in all documents, the more representative the document is and the more distinguishable it is from other documents.

[0053] In an embodiment of the present application, after obtaining the preset text library, each text in the preset text library is input into the second preset neural network. After passing through the first fully connected layer, a text feature vector is obtained. Then, after inputting the text feature vector into the second fully connected layer, a text feature vector represented by a hash code can be output, and the hash code conversion ability of the second fully connected layer also needs to be trained.

[0054] It should be noted that in an embodiment of the present application, the hash code obtained through the first preset neural network and the second preset neural network is a binary hash code. The specific base can be set according to the actual situation, and the embodiments of the present application do not make limitations here.

[0055] S302. Store at least one text hash code and at least one text in a corresponding manner in the preset text library.

[0056] It should be noted that by storing the text hash code and the text in a corresponding manner in the preset text library, when determining the hash code corresponding to the text, it can be directly obtained from the preset text library.

[0057] In an embodiment of the present application, when training the fully connected layer 8 of the first preset neural network and the second fully connected layer of the second preset neural network, the training is performed through the objective function as shown in Equation (1):

[0058]

[0059] In the above Equation (1), f(x i ,θ x ) represents the image feature vector obtained after inputting the image x i into the first preset neural network and passing through the fully connected layer 7. θ x is the parameter of the first preset neural network; g(y j ,θ y ) represents the text feature vector obtained after inputting the text y j into the second preset neural network and passing through the first fully connected layer. θ y is the parameter of the second preset neural network; B∈{-1, +1} c×n , is the image hash code of x i , is the text hash code of y i , and γ and η are hyperparameters.

[0060] In the above Equation (1), the first term is the negative log-likelihood function of the similarity of two modalities, and its definition is as shown in Equation (2):

[0061]

[0062] In the above formula (2), by minimizing this negative log-likelihood, the inner product between and G *j is large when S ij = 1 and small when S ij = 0. Therefore, optimizing the first term can combine the cross-modal similarity in S with the image feature vector F and the text feature vector G.

[0063] In the above formula (1), the meaning of the second term is the distance between the hash code B and the image feature vector F and the text feature vector G, and the meaning of the third term is the regularization term. The smaller the values of the second and third terms are, the better.

[0064] It should be noted that in this application, the first preset neural network and the second preset neural network are combined into a model. Since there are three parameters, θ x , θ y and B, in the formula (1) that needs to be trained in the model, and since the three parameters cannot be learned simultaneously, a strategy of fixing 2 of them each time and learning 1 is adopted. That is, when θ x and θ y are fixed, the hash code B is learned using backpropagation; when θ x and B are fixed, the text modality parameter θ y is learned; when θ y and B are fixed, the image modality parameter θ x is learned.

[0065] S102. Search for the target text hash code corresponding to the target text from the preset text library, and determine the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts.

[0066] In the embodiment of this application, after the retrieval device finds the first image and the first image hash code corresponding to the first image, it searches for the target text hash code corresponding to the target text from the preset text library, and determines the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts.

[0067] It should be noted that the Hamming distance can represent the difference between an image and a text. The smaller the Hamming distance is, the smaller the difference is, and the higher the similarity between the image and the text is.

[0068] S103. Sort the first images according to the Hamming distance to obtain a sorting result, and determine the target image from the first images based on the sorting result.

[0069] In an embodiment of the present application, after the retrieval device determines the Hamming distance between the first image and the target text, it sorts the first images according to the Hamming distance to obtain a sorting result, and determines the target image from the first images based on the sorting result.

[0070] Specifically, the first images are sorted in ascending order of the Hamming distance to obtain a sorting result, and the first preset number of images in the sorting result are determined as the target images.

[0071] It should be noted that the first images may include at least one image. After calculating the Hamming distance between each image and the text, they are sorted in ascending order of the Hamming distance, that is, in descending order of the relevance between at least one image and the text. Then, according to the actual situation, the first preset number of images are set as the target images to be returned, or all the sorted images can be returned. The specific quantity is set according to the actual situation, and the embodiments of the present application do not limit this here.

[0072] The embodiment of the present application provides a retrieval method, which includes: when retrieving the target image corresponding to the target text from the preset image library, determining the first image associated with the target text based on the preset text-image association relationship; and searching for the first image hash code corresponding to the first image from the preset image library; the preset image library stores images and the corresponding image hash codes; searching for the target text hash code corresponding to the target text from the preset text library, and determining the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the corresponding text hash codes; sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result; adopting the above implementation solution, by pre-storing the hash codes corresponding to the images and texts in the preset image library and the preset text library, it is possible to directly search for the text hash code corresponding to the target text from the preset text library when receiving the requirement to retrieve the target image according to the target text, and then screen out the first images related to the target text from the preset image library according to the preset text-image association relationship, take out the image hash code of the first image from the preset image library, determine the Hamming distance between the first image and the target text together with the text hash code, sort the first images based on the Hamming distance, and return the target image. Since the present application pre-converts the texts and images into hash codes for storage, the purpose of improving the retrieval efficiency can be achieved.

[0073] Based on the above embodiments, in another embodiment of the present application, a retrieval device 1 is provided. Figure 4 It is a schematic structural diagram of a retrieval device 1 provided by the present application, as Figure 4 shown. The retrieval device 1 includes:

[0074] A determination module 10, configured to, when retrieving a target image corresponding to a target text from a preset image library, determine a first image associated with the target text based on a preset text-image association relationship; and find a first image hash code corresponding to the first image from the preset image library; the preset image library stores images and the image hash codes corresponding to the images.

[0075] A search module 11, configured to find a target text hash code corresponding to the target text from a preset text library, and determine a Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts.

[0076] A data processing module 12, configured to sort the first images according to the Hamming distance to obtain a sorting result, and determine the target image from the first images based on the sorting result.

[0077] Optionally, the data processing module 12 is further configured to extract image features and perform hash code conversion on at least one image in the preset image library by using a first preset neural network to obtain at least one image hash code corresponding to the at least one image; and store the at least one image hash code and the at least one image in correspondence with each other in the preset image library.

[0078] Optionally, the data processing module 12 is further configured to extract text features and perform hash code conversion on at least one text in the preset text library by using a second preset neural network to obtain at least one text hash code corresponding to the at least one text; and store the at least one text hash code and the at least one text in correspondence with each other in the preset text library.

[0079] Optionally, the data processing module 12 is further configured to establish a preset text-image association relationship based on the preset image library and the preset text library, and the preset text-image association relationship is used to represent the semantic correlation between the images in the preset image library and the texts in the preset text library.

[0080] Optionally, the data processing module 12 is further configured to sort the first images in ascending order of Hamming distance to obtain a sorting result, and determine the first preset number of images in the sorting result as the target images.

[0081] An embodiment of the present application provides a retrieval device, which includes: when retrieving a target image corresponding to a target text from a preset image library, determining a first image associated with the target text based on a preset text-image association relationship; and searching for a first image hash code corresponding to the first image from the preset image library; the preset image library stores images and the image hash codes corresponding to the images; searching for a target text hash code corresponding to the target text from the preset text library, and determining the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts; sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result; adopting the above implementation solution, by pre-storing the hash codes corresponding to images and texts in the preset image library and the preset text library, it is then possible to directly search for the text hash code corresponding to the target text from the preset text library when receiving the requirement to retrieve the target image according to the target text, and then screen out the first images related to the target text from the preset image library according to the preset text-image association relationship, take out the image hash code of the first image from the preset image library, and determine the Hamming distance between the first image and the target text together with the text hash code, sort the first images based on the Hamming distance, and return the target image. Since the present application pre-converts texts and images into hash codes for storage, the purpose of improving the retrieval efficiency can be achieved.

[0082] Figure 5 FIG. 4 is a schematic structural diagram of a retrieval device 1 provided by an embodiment of the present application. In practical applications, based on the same inventive concept of the above embodiment, as Figure 5 shown, the retrieval device 1 of this embodiment includes: a processor 13, a memory 14, and a communication bus 15.

[0083] In the process of a specific embodiment, the above-mentioned determination module 10, search module 11, and data processing module 12 can be implemented by a processor 13 located on the retrieval device 1. The above-mentioned processor 13 can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing image processing device (DSPD), a programmable logic image processing device (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor. It can be understood that for different retrieval devices, the electronic devices for implementing the functions of the above-mentioned processor can also be others, and this embodiment does not make specific limitations.

[0084] In the embodiment of the present application, the above-mentioned communication bus 15 is used to implement the connection communication between the processor 13 and the memory 14; when the processor 13 executes the running program stored in the memory 14, the following retrieval method is implemented:

[0085] In the case of retrieving a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, a first image associated with the target text is determined; and a first image hash code corresponding to the first image is searched from the preset image library; the preset image library stores images and the image hash codes corresponding to the images;

[0086] A target text hash code corresponding to the target text is searched from a preset text library, and the Hamming distance between the first image and the target text is determined according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts;

[0087] The first images are sorted according to the Hamming distance to obtain a sorting result, and the target image is determined from the first images based on the sorting result.

[0088] Optionally, the processor 13 is further configured to use a first preset neural network to perform image feature extraction and hash code conversion on at least one image in the preset image library to obtain at least one image hash code corresponding to the at least one image; and store the at least one image hash code and the at least one image in correspondence with each other in the preset image library.

[0089] Optionally, the processor 13 is further configured to perform text feature extraction and hash code conversion on at least one text in the preset text library by using a second preset neural network, so as to obtain at least one text hash code corresponding to the at least one text; and store the at least one text hash code and the at least one text in a corresponding manner in the preset text library.

[0090] Optionally, the processor 13 is further configured to establish a preset text and image association relationship based on the preset image library and the preset text library, where the preset text and image association relationship is used to represent the semantic correlation between the images in the preset image library and the texts in the preset text library.

[0091] Optionally, the processor 13 is further configured to sort the first images in ascending order of Hamming distance to obtain a sorting result, and determine the first preset number of images in the sorting result as the target images.

[0092] An embodiment of the present application provides a storage medium, on which a computer program is stored. The above computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors and are applied to a retrieval device. The computer program implements the retrieval method as described above.

[0093] It should be noted that in this document, the terms "include", "comprise" or any other variation thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or device including the element.

[0094] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the related art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), and includes several instructions for causing an image display device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the retrieval methods described in the various embodiments of the present disclosure.

[0095] The above is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A retrieval method, characterized in that, the method includes: When retrieving a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, determining a first image associated with the target text; and searching for a first image hash code corresponding to the first image in the preset image library; the preset image library stores images and the image hash codes corresponding to the images; the preset text-image association relationship is established based on the preset image library and a preset text library, and the preset text-image association relationship is used to represent the semantic correlation between the images in the preset image library and the texts in the preset text library; searching for a target text hash code corresponding to the target text in the preset text library, and determining the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts; sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result.

2. The method according to claim 1, characterized in that, before the step of, when retrieving a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, determining a first image associated with the target text, the method further includes: using a first preset neural network to perform image feature extraction and hash code conversion on at least one image in the preset image library to obtain at least one image hash code corresponding to the at least one image; storing the at least one image hash code and the at least one image in a corresponding manner in the preset image library.

3. The method according to claim 1, characterized in that, before the step of, when retrieving a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, determining a first image associated with the target text, the method further includes: using a second preset neural network to perform text feature extraction and hash code conversion on at least one text in the preset text library to obtain at least one text hash code corresponding to the at least one text; storing the at least one text hash code and the at least one text in a corresponding manner in the preset text library.

4. The method according to claim 1, characterized in that, before the step of, when retrieving a target image corresponding to a target text from a preset image library, based on a preset text-image association relationship, determining a first image associated with the target text, the method further includes: establishing a preset text-image association relationship based on the preset image library and the preset text library, and the preset text-image association relationship is used to represent the semantic correlation between the images in the preset image library and the texts in the preset text library.

5. The method according to claim 1, characterized in that, the step of sorting the first images according to the Hamming distance to obtain a sorting result, and determining the target image from the first images based on the sorting result includes: Sort the first images in ascending order of Hamming distance to obtain a sorting result, and determine the images with the top preset number in the sorting result as the target images.

6. A retrieval device, characterized in that the device includes: a determination module, configured to, when retrieving a target image corresponding to a target text from a preset image library, determine a first image associated with the target text based on a preset text-image association relationship; and find a first image hash code corresponding to the first image from the preset image library; the preset image library stores images and the image hash codes corresponding to the images; the preset text-image association relationship is established based on the preset image library and a preset text library, and the preset text-image association relationship is used to represent the semantic correlation between the images in the preset image library and the texts in the preset text library; a search module, configured to find a target text hash code corresponding to the target text from the preset text library, and determine the Hamming distance between the first image and the target text according to the first image hash code and the target text hash code; the preset text library stores texts and the text hash codes corresponding to the texts; a data processing module, configured to sort the first images according to the Hamming distance to obtain a sorting result, and determine the target images from the first images based on the sorting result.

7. The device according to claim 6, characterized in that the data processing module is further configured to use a first preset neural network to perform image feature extraction and hash code conversion on at least one image in the preset image library to obtain at least one image hash code corresponding to the at least one image; and store the at least one image hash code and the at least one image in a corresponding manner in the preset image library.

8. The device according to claim 6, characterized in that the data processing module is further configured to use a second preset neural network to perform text feature extraction and hash code conversion on at least one text in the preset text library to obtain at least one text hash code corresponding to the at least one text; and store the at least one text hash code and the at least one text in a corresponding manner in the preset text library.

9. A retrieval device, characterized in that the device includes: a processor, a memory, and a communication bus; when the processor executes the running program stored in the memory, the method according to any one of claims 1-5 is implemented.

10. A storage medium, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the method according to any one of claims 1-5 is implemented.

Citation Information

Patent Citations

  • Deep cross-modal hash retrieval method and device

    CN111125457A