WO2022155994A1 - 基于注意力的深度跨模态哈希检索方法、装置及相关设备 - Google Patents

基于注意力的深度跨模态哈希检索方法、装置及相关设备 Download PDF

Info

Publication number
WO2022155994A1
WO2022155994A1 PCT/CN2021/074660 CN2021074660W WO2022155994A1 WO 2022155994 A1 WO2022155994 A1 WO 2022155994A1 CN 2021074660 W CN2021074660 W CN 2021074660W WO 2022155994 A1 WO2022155994 A1 WO 2022155994A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash
retrieval
text
image
hash code
Prior art date
Application number
PCT/CN2021/074660
Other languages
English (en)
French (fr)
Inventor
曹文明
柳兴华
曹桂涛
Original Assignee
深圳大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳大学 filed Critical 深圳大学
Publication of WO2022155994A1 publication Critical patent/WO2022155994A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • G06F16/137Hash-based
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/53Querying
    • G06F16/532Query formulation, e.g. graphical querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • G06F16/5846Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content using extracted text

Definitions

  • the embodiments of the present application relate to the technical field of retrieval, and in particular, to a deep cross-modal hash retrieval method, device, and related equipment.
  • Cross-modal retrieval technology aims at retrieving data of different modalities that match the existing data, for example, searching for picture information that matches the text description in a database through text information. Because hash codes have many advantages such as low storage cost and fast retrieval speed, hash methods are also widely used in cross-modal retrieval tasks.
  • the embodiments of the present application provide an attention-based deep cross-modal hash retrieval method, device, and related equipment, aiming to solve the problem that the feature extraction of retrieval data in the prior art is not rich enough, and the quality of the generated hash code is low The problem.
  • an embodiment of the present application provides an attention-based deep cross-modal hash retrieval method, which includes:
  • the hash codes corresponding to the image feature matrix and the text feature matrix are respectively calculated and stored through the hash layer of the hash retrieval model to obtain the image hash code and the text hash code;
  • a retrieval result is determined from stored data in which a modality different from the retrieval data is stored.
  • an attention-based deep cross-modal hash retrieval device which includes:
  • the acquisition module is used to acquire image modal samples, text modal samples and a hash retrieval model with a preset attention mechanism
  • an image feature extraction module configured to perform image feature extraction on the image modality sample through the residual network module and the first attention module of the hash retrieval model to obtain an image feature matrix
  • a text feature extraction module for extracting the features of the text modal samples through the word bag module and the second attention module of the hash retrieval model to obtain a text feature matrix
  • the first hash module is used to calculate and store the corresponding hash codes of the image feature matrix and the text feature matrix respectively through the hash layer of the hash retrieval model, so as to obtain the image hash code and the text hash code;
  • the optimization module is used to calculate the image hash code loss and the text hash code loss respectively based on all image hash codes and all text hash codes according to the preset hash code loss function, and calculate the image hash code loss and text hash code loss according to the image hash code loss and The text hash code loss optimizes the model parameters of the hash retrieval model to obtain the optimal hash retrieval model;
  • the second hash module is used to obtain the retrieval data, and output the retrieval hash code of the retrieval data through the optimal hash retrieval model, and the mode of the retrieval data is an image mode or a text mode;
  • a retrieval module configured to determine a retrieval result from stored data stored in a different modality from the retrieval data according to the retrieval hash code.
  • an embodiment of the present application further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer
  • the program implements the attention-based deep cross-modal hash retrieval method described in the first aspect above.
  • an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when executed by a processor, the computer program causes the processor to execute the above-mentioned first step.
  • the attention-based deep cross-modal hash retrieval method is described.
  • Embodiments of the present application provide an attention-based deep cross-modal hash retrieval method, apparatus, and related equipment.
  • the method includes acquiring image modality samples, text modality samples and a hash retrieval model with an attention mechanism preset; The sample is subjected to image feature extraction to obtain an image feature matrix; the features of the text modal samples are extracted through the word bag module and the second attention module of the hash retrieval model to obtain a text feature matrix; through the hash retrieval model
  • the hash layer calculates and stores the corresponding hash codes of the image feature matrix and the text feature matrix respectively, and obtains the image hash code and the text hash code; respectively based on all image hash codes and all text hash codes, according to the prediction
  • the set hash code loss function calculates the image hash code loss and the text hash code loss respectively, and optimizes the model parameters of the hash retrieval model according to the image hash code loss and text hash code loss, and obtains the optimal hash code loss.
  • the method extracts the features of different modalities through the attention module, improves the model's extraction of important information from the data, better bridges the distance between semantically related heterogeneous data in cross-modal retrieval tasks, and improves retrieval speed.
  • FIG. 1 is a schematic flowchart of an attention-based deep cross-modal hash retrieval method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of a sub-flow of an attention-based deep cross-modal hash retrieval method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of another sub-flow of an attention-based deep cross-modal hash retrieval method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of another sub-flow of an attention-based deep cross-modal hash retrieval method provided by an embodiment of the present application.
  • FIG. 5 is a schematic block diagram of an attention-based deep cross-modal hash retrieval apparatus provided by an embodiment of the present application.
  • FIG. 1 a schematic flowchart of an attention-based deep cross-modal hash retrieval method provided by an embodiment of the present application, and the method includes steps S110-S170.
  • training samples of multiple modalities are obtained first, including image modal samples and text modal samples.
  • image modal samples include static images (ie, static pictures) and dynamic images (ie, dynamic pictures).
  • dynamic pictures When the pictures are dynamic pictures, they can be regarded as a collection of multiple frames of static pictures.
  • the hash retrieval model also has an attention module.
  • the attention module is used to improve the details of extracting image modal samples and text modal samples.
  • each image modality sample and text modality sample has its own label, and the number of labels can be one or more.
  • the included tags can include tags corresponding to the content contained in the image, or tags of attributes corresponding to the image; and for text modal samples, the included tags can only include the text information
  • the meaning of itself may also include the superordinate concept, subordinate concept or some corresponding attributes of the text.
  • the tags can be “green mountains”, “green water”; it can also be “landscape”; it can also be the size, color and clarity of the image.
  • the text modal sample “Coke” it can include the label “Coke” representing its own meaning, or the label “beverage” of the superordinate concept; it can also be the label “liquid” with attributes at room temperature; it can also be the label representing the part of speech "noun”.
  • the sample features need to be extracted in different ways.
  • the image modality samples are first converted into RGB images of a unified dimension, and then the image feature matrix is obtained by extracting image features from the image modality samples through the residual network module and the first attention module in the hash retrieval model.
  • the residual network module uses the ResNet-50 pretrained model.
  • step S120 includes:
  • Step S121 performing feature extraction on the image modal sample through the residual network module to obtain a first image feature
  • Step S122 using the first attention module to perform feature extraction on the first image feature to obtain attention feature images in a preset number of attention channels, and use the attention features in each of the attention channels.
  • the force feature images are spliced to obtain the image feature matrix.
  • feature extraction is performed on the preprocessed image modality samples by using the ResNet-50 pre-training model to obtain the first image feature.
  • a first attention module and a second attention module are added to the hash retrieval model.
  • the first attention module is used to extract the features of the first image to obtain attention feature images in a preset number of attention channels, and splicing the attention feature images in each attention channel to obtain an image feature matrix .
  • L2 regularization processing is performed on the first image features to maintain the consistency between the table vector and the mapping.
  • the multi-channel attention mask features are obtained by the weighted average of the maps.
  • the L2 regularization process has the following formula:
  • F * is the image feature matrix input to the first attention module
  • c is the feature category
  • M c is the feature map embedding of class c
  • N is the total number of masks
  • T is the matrix transpose
  • mask is the image modal sample. mask.
  • the output of the image feature matrix after passing through the attention module is:
  • is a trade-off factor, which is used to control the effect of attention features.
  • the features of the text modality samples are extracted through the word bag module and the second attention module in the hash retrieval model to obtain a text feature matrix.
  • the bag-of-words module there is a bag of words model in the bag-of-words module.
  • the bag-of-words model is for a text, ignoring its word order, grammar, and syntax, and only regards it as a collection of multiple words. The occurrence of each word in the text is independent and does not depend on the occurrence of other words.
  • step S130 includes:
  • Step S131 performing bag-of-words processing on the text modal sample by the bag-of-words module to obtain a bag-of-words vector
  • Step S132 input the bag of words vector into a second attention module configured with multiple channels to perform feature extraction to obtain an attention feature matrix, and splicing the attention feature matrices of each channel to obtain a text feature matrix.
  • the bag-of-words module is used to perform bag-of-words processing on the text modal samples to obtain the bag-of-words vector of the text.
  • the attention feature matrix of multiple channels is obtained, and finally the attention feature matrix of each channel is spliced to obtain the text feature matrix.
  • the word bag vector of the text is input into the second attention module with three different channels for text feature extraction, and finally the features extracted from the three channels are superimposed together to obtain the text feature matrix.
  • the image feature matrix and the text feature matrix of the image modality sample and the text modality sample are respectively input into the hash layer of the hash retrieval model, and the image feature matrix and the text feature matrix are hashed by the hash layer. , get the image hash code and text hash code.
  • the length of the hash code can be customized by the user according to actual needs, which can be 16bit, 32bit or 64bit.
  • the initial hash layer model parameters of the hash retrieval model are not optimal, there is a loss in the image hash code or text hash code obtained by hashing.
  • the image hash code of the modal sample and the text hash code of the text modal sample are calculated according to the preset loss function to calculate the hash code loss of the image modal sample and the hash code loss of the text modal sample respectively.
  • the model parameters of the hash retrieval model are optimized according to the hash code loss, so as to obtain the optimal hash retrieval model.
  • each instance pair includes an image and a text
  • each instance pair corresponds to an image and a text.
  • the image modality sample is denoted as Where d x is the dimension of each image, then the i-th image is represented as X i* .
  • dy is the dimension of each text instance
  • i-th text is represented as Y i* .
  • f (x) (X i* ; ⁇ x , ⁇ x_hash ) represent the image hash code of the image Xi * , where ⁇ x represents the parameters of the last layer in the residual network, ⁇ x_has represents the parameters of the image hash layer .
  • f (y) (Y j* ; ⁇ y , ⁇ y_hash ) represents the text hash code of the text Y j* , where ⁇ y represents the model parameters of the bag-of-words model, and ⁇ y_hash represents the model parameters of the text hash layer .
  • the objective function of the image hashing module is as follows:
  • n the number of samples
  • l the length of the hash code
  • U i* f (x) (X i* ; ⁇ x , ⁇ x_hash ), representing the image hash code of the image
  • Jacd is the Jaccard similarity coefficient
  • Jaccard similarity coefficient is used to compare the difference between the limited sample sets. Similarity and difference, the similarity between image hash codes and text hash codes is quantified between 0 and 1 by the Jaccard similarity coefficient.
  • the Jaccard similarity coefficient is introduced into the cross-entropy loss function, and an excitation cross-entropy loss function is reconstructed to strengthen its effect, and we get It is the quantization loss of image hash code binarization, its range is -1 to +1, to ensure the balance of hash code.
  • S ij represents the cross-modal similarity matrix
  • n represents the number of samples
  • l represents the length of the hash code
  • an alternating learning strategy is used for optimization.
  • the network of the image part if the network of the image part is optimized, the network of the text part will remain unchanged; if the network of the text part is optimized, the network of the image part will remain unchanged.
  • U i* represents the image hash code of image i
  • S ij represents the cross-modal similarity matrix
  • H i* represents the hash code matrix of the ith image.
  • V i* represents the text hash code of text i
  • S ij represents the cross-modal similarity matrix
  • H i* represents the hash code matrix of the ith text.
  • the retrieval hash code determine the retrieval result from the stored data in which the modalities different from the retrieval data are stored.
  • the retrieval data is acquired, the retrieval hash code corresponding to the retrieval data is output through an optimal hash retrieval model, and then according to the retrieval hash code, the corresponding retrieval data is determined from the stored data in different modes from the retrieval data. search results.
  • the retrieval data can be an image modality or a text modality.
  • step S170 includes:
  • Step S171 calculating the target hash code of the stored data
  • Step S172 calculating the Hamming distance between the retrieval hash code and the target hash code
  • Step S173 Arrange the stored data according to the Hamming distance from low to high, and determine a preset number of stored data that is ranked first as a retrieval result.
  • the target hash code of each stored data in a different mode from the retrieval data is calculated; the Hamming difference between the retrieval hash code and the target hash code is calculated.
  • Distance Arrange the stored data according to the Hamming distance from low to high, and determine the stored data of the top preset number as the retrieval result. What needs to be known is that the number can be customized by the user according to their needs. The lower the Hamming distance, the higher the similarity between the retrieved data and the stored data.
  • each instance pair includes an image and a text
  • each instance pair corresponds to an image and a text.
  • the image modality sample is denoted as Where d x is the dimension of each image, then the i-th image is represented as X i* .
  • dy is the dimension of each text instance
  • Y i* is the label corresponding to the image X i*
  • the label matrix is denoted as where k represents the number of labels.
  • H x ⁇ ⁇ -1, +1 ⁇ l represent the image hash code
  • Hy ⁇ ⁇ -1, +1 ⁇ l represent the text hash code
  • u represents the image hash code
  • v represents the text hash code
  • k represents the length of the hash code
  • ⁇ u, v> represents the inner product of the image hash code and the text hash code.
  • measuring the similarity between two hash codes can be transformed into calculating the inner product of the Hamming distance of the two hash codes.
  • the hash code of the retrieved data is 3106
  • the hash codes corresponding to the existence of stored data in different modes of the retrieved data are calculated according to the above formula as 3104, 3011, 3001 and 3206, then the Hamming distances are 1, 3, 3 and 2, if it is defined to output the top two stored data, the stored data corresponding to the hash codes 3104 and 3206 will be used as the retrieval result.
  • the method extracts the features of different modalities through the attention module, improves the model's extraction of important information from the data, better bridges the distance between semantically related heterogeneous data in cross-modal retrieval tasks, and improves retrieval speed.
  • the embodiment of the present application further provides an attention-based deep cross-modal hash retrieval apparatus, which is used for executing any of the foregoing deep cross-modal hash retrieval methods.
  • FIG. 5 is a schematic block diagram of an attention-based deep cross-modal hash retrieval apparatus provided by an embodiment of the present application.
  • the attention-based deep cross-modal hash retrieval apparatus 100 may be configured in a server.
  • the attention-based deep cross-modal hash retrieval apparatus 100 includes an acquisition module 110, an image feature extraction module 120, a text feature extraction module 130, a first hash module 140, an optimization module 150, and a second hash module 150.
  • the search module 160 and the retrieval module 170 are shown in FIG. 5 .
  • an acquisition module 110 configured to acquire image modality samples, text modality samples, and a hash retrieval model with a preset attention mechanism
  • the image feature extraction module 120 is configured to perform image feature extraction on the image modality samples through the residual network module and the first attention module of the hash retrieval model to obtain an image feature matrix;
  • a text feature extraction module 130 configured to extract the features of the text modal samples through the word bag module and the second attention module of the hash retrieval model to obtain a text feature matrix
  • the first hash module 140 is configured to calculate and store the corresponding hash codes of the image feature matrix and the text feature matrix respectively through the hash layer of the hash retrieval model, to obtain the image hash code and the text hash code;
  • the optimization module 150 is configured to calculate the image hash code loss and the text hash code loss respectively based on all the image hash codes and all the text hash codes according to the preset hash code loss function, and calculate the loss of the image hash code according to the image hash code loss and the text hash code loss to optimize the model parameters of the hash retrieval model to obtain the optimal hash retrieval model;
  • the second hash module 160 is configured to obtain retrieval data, and output a retrieval hash code of the retrieval data through an optimal hash retrieval model, where the retrieval data is in an image mode or a text mode;
  • the retrieval module 170 is configured to determine a retrieval result from stored data stored in a different modality from the retrieval data according to the retrieval hash code.
  • the retrieval module includes:
  • a hash unit used to calculate the target hash code of the stored data
  • a computing unit for calculating the similarity between the retrieval hash code and the target hash code according to the Hamming distance
  • the determining unit is used for arranging all the stored data according to the similarity from high to low, and determining the stored data of the top preset number as the retrieval result.
  • Embodiments of the present application further provide a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the above when executing the computer program
  • a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the above when executing the computer program
  • a computer-readable storage medium may be a non-volatile computer-readable storage medium.
  • the computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the deep cross-modal hash retrieval method as described above.
  • the disclosed apparatus, apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the units is only logical function division.
  • there may be other division methods, or units with the same function may be grouped into one Units, such as multiple units or components, may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solutions of the embodiments of the present application.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a storage medium.
  • the technical solutions of the present application are essentially or part of contributions to the prior art, or all or part of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Medical Treatment And Welfare Office Work (AREA)

Abstract

一种基于注意力的深度跨模态哈希检索方法、装置及相关设备。该方法包括:获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;通过所述哈希检索模型分别进行图像特征提取和文本特征提取,得到图像特征矩阵以及文本特征矩阵;根据图像特征矩阵以及文本特征矩阵计算图像哈希码和文本哈希码;基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;通过最优的哈希检索模型进行哈希检索。该方法提高了检索速度及准确度。

Description

基于注意力的深度跨模态哈希检索方法、装置及相关设备
本申请是以申请号为202110080906.9、申请日为2021年1月21日的中国专利申请为基础,并主张其优先权,该申请的全部内容在此作为整体引入本申请中。
技术领域
本申请实施例涉及检索技术领域,尤其涉及一种深度跨模态哈希检索方法、装置及相关设备。
背景技术
跨模态检索技术旨在根据已有的数据检索与之相匹配的不同模态的数据,例如通过文本信息在数据库中查找符合文字描述的图片信息。由于哈希码具有存储代价小,检索速度快等诸多优势,所以哈希方法也被广泛应用在跨模态检索任务中。
目前跨模态检索方法主要是使用深度神经网络来将特征学习和哈希学习结合起来。虽然加深网络的深度能有效的提高检索性能,但网络深度达到一定的深度之后就会出现网络退化、难以收敛等问题;另外由于不能分辨出网络中所提取特征的重要程度,这对检索模型的稳定性与性能提升造成了很大的障碍;同时现有技术方法中虽然包含各式对于跨模态哈希检索的损失优化方法,但并未能实现特征学习过程和哈希学习过程的有机衔接与高效复用。
申请内容
本申请实施例提供了一种基于注意力的深度跨模态哈希检索方法、装置及相关设备,旨在解决现有技术中对于检索数据的特征提取不够丰富,生成的哈希码质量较低的问题。
第一方面,本申请实施例提供了一种基于注意力的深度跨模态哈希检索方法,其包括:
获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;
通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵;
通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵;
通过所述哈希检索模型的哈希层分别计算并存储所述图像特征矩阵及文本特征矩阵对应的哈希码,得到图像哈希码和文本哈希码;
分别基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,并根据图像哈希码损失和文本哈希码损失优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;
获取检索数据,并通过最优的哈希检索模型输出所述检索数据的检索哈希码,所述检索数据的模态为图像模态或文本模态;
根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果。
第二方面,本申请实施例提供了一种基于注意力的深度跨模态哈希检索装置,其包括:
获取模块,用于获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;
图像特征提取模块,用于通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵;
文本特征提取模块,用于通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵;
第一哈希模块,用于通过所述哈希检索模型的哈希层分别计算并存储所述图像特征矩阵及文本特征矩阵对应的哈希码,得到图像哈希码和文本哈希码;
优化模块,用于分别基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,并根据图像哈希码损失和文本哈希码损失优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;
第二哈希模块,用于获取检索数据,并通过最优的哈希检索模型输出所述检索数据的检索哈希码,所述检索数据的模态为图像模态或文本模态;
检索模块,用于根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果。
第三方面,本申请实施例又提供了一种计算机设备,其包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述的基于注意力的深度跨模态哈希检索方法。
第四方面,本申请实施例还提供了一种计算机可读存储介质,其中所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行上述第一方面所述的基于注意力的深度跨模态哈希检索方法。
本申请实施例提供了一种基于注意力的深度跨模态哈希检索方法、装置及相关设备。该方法包括获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵;通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵;通过所述哈希检索模型的哈希层分别计算并存储所述图像特征矩阵及文本特征矩阵对应的哈希码,得到图像哈希码和文本哈希码;分别基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,并根据图像哈希码损失和文本哈希码损失优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;获取检索数据,并通过最优的哈希检索模型输出所述检索数据的检索哈希码,所述检索数据的模态为图像模态或文本模态;根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果。该方法通过注意力模块提取不同模态的特征,提高模型对于数据的重要信息提取,更好地弥合跨模态检索任务中语义相关的异构数据之间的距离,提高检索速度。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的基于注意力的深度跨模态哈希检索方法的流程示意图;
图2为本申请实施例提供的基于注意力的深度跨模态哈希检索方法的子流程示意图;
图3为本申请实施例提供的基于注意力的深度跨模态哈希检索方法的另一子流程示意图;
图4为本申请实施例提供的基于注意力的深度跨模态哈希检索方法的另一子流程示意图;
图5为本申请实施例提供的基于注意力的深度跨模态哈希检索装置的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
请参阅图1为本申请实施例提供的基于注意力的深度跨模态哈希检索方法的流程示意图,该方法包括步骤S110~S170。
S110、获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;
本实施例中,首先获取多个模态的训练样本,包括图像模态样本和文本模态样本。通常情况下,用户使用检索工具进行检索时,最多使用的功能为通过文本来检索相应的图片,或者对图片进行识别以获取相应的文本信息。因此,本申请以图像模态样本和文本模态样本为训练样本。其中,此处的图像模态样本包括静态图像(即静态图片)和动态图像(即动态图片),当图片为动态图片时,可以将其当做多帧静态图片的合集。
此外,获取预置有注意力机制的哈希检索模型。哈希检索模型中除了必备的特征提取模块、哈希层之外,还设有注意力模块,注意力模块用于提升提取图像模态样本和文本模态样本的细节特征。具体的,每个图像模态样本和文本模态样本都拥有自己的标签,标签的数量可以是一个或多个。对于图像模态样本,其所包含的标签可以包含该图像所包含的内容对应的标签,或该图像所对应的属性的标签;而对于文本模态样本,所包含的标签可以只包括该文本信息本身的含义,也可以包括该文本的上位概念、下位概念或其对应的一些属性。例如,一张包含青山绿水的图像,标签可以是“青山”、“绿水”;还可以是“风景”;也可以是这张图像的尺寸、颜色和清晰度等标签。对于文本模态样本“可乐”,可以包括代表自身含义的标签“可乐”,也可以是上位概念的标签“饮料”;还可以是常温时属性的标签“液体”;还可以是代表词性的标签“名词”。
S120、通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵;
本实施例中,在训练哈希检索模型时,对于不同模态的样本,需要用不同的方式提取样本特征。对于图像,首先将图像模态样本转换为统一维度的RGB图像,然后通过哈希检索模型中残差网络模块及第一注意力模块,对图像模态样本进行图像特征提取,得到图像特征矩阵。例如,将图像模态样本转换为维度是224×224×3的RGB图像。此外,残差网络模块使用ResNet-50预训练模型。
在一实施例中,如图2所示,步骤S120包括:
步骤S121、通过所述残差网络模块对所述图像模态样本进行特征提取,得到第一图像特征;
步骤S122、利用所述第一注意力模块对所述第一图像特征进行特征提取,得到在预置个数的注意力通道中的注意力特征图像,并将各所述注意力通道中 的注意力特征图像进行拼接,得到所述图像特征矩阵。
本实施例中,通过ResNet-50预训练模型对预处理后的图像模态样本进行特征提取,得到第一图像特征。为保证每个特征与其标签之间的语义相关性,在哈希检索模型中加入第一注意力模块和第二注意力模块。利用第一注意力模块对第一图像特征进行特征提取,得到预置个数的注意力通道中的注意力特征图像,并将各注意力通道中的注意力特征图像进行拼接,得到图像特征矩阵。此外,在将第一图像特征输入第一注意力模块进行多通道的注意力特征提取前,对第一图像特征进行L2正则化处理,保持表向量和映射之间的一致性。在第一注意力模块中,通过映射的加权平均得到多通道的注意力掩模特征。其中,L2正则化处理有公式如下所示:
Figure PCTCN2021074660-appb-000001
式中,F *为输入第一注意力模块的图像特征矩阵,c为特征类别,M c表示c类特征映射嵌入,N表示mask的总数,T为矩阵转置,mask表示图像模态样本的掩模。
图像特征矩阵经过注意力模块后输出为:
Figure PCTCN2021074660-appb-000002
其中,λ为权衡因子,用于控制注意力特征的效果。
S130、通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵;
本实施例中,对于文本模态样本,通过哈希检索模型中的词袋模块及第二注意力模块提取文本模态样本的特征,得到文本特征矩阵。其中,词袋模块中设有词袋模型,词袋模型是对一个文本,忽略其词序和语法、句法,将其仅仅看做是多个词的集合。文本中每个词的出现都是独立的,不依赖于其他词是否出现。
在一实施例中,如图3所示,步骤S130包括:
步骤S131、通过所述词袋模块对所述文本模态样本进行词袋处理,得到词袋向量;
步骤S132、将词袋向量输入配置有多通道的第二注意力模块进行特征提取,得到注意力特征矩阵,并将各个通道的注意力特征矩阵进行拼接,得到文本特 征矩阵。
本实施例中,利用词袋模块对文本模态样本进行词袋处理,得到文本的词袋向量,再将词袋向量输入倒配置有预置个数的不同通道的第二注意力模块中进行特征提取,得到多个通道的注意力特征矩阵,最后将各个通道的注意特征矩阵进行拼接,得到文本特征矩阵。
例如,将文本的词袋向量输入倒配置有三个不同通道的第二注意力模块中进行文本特征提取,最后将三个通道中提取的特征叠加到一起得到文本特征矩阵。
S140、通过所述哈希检索模型的哈希层分别计算并存储所述图像特征矩阵及文本特征矩阵对应的哈希码,得到图像哈希码和文本哈希码;
本实施例中,分别将图像模态样本和文本模态样本的图像特征矩阵以及文本特征矩阵输入哈希检索模型的哈希层,通过哈希层对图像特征矩阵和文本特征矩阵进行哈希处理,得到图像哈希码和文本哈希码。其中,哈希码的长度可由用户根据实际需要自定义,可以是16bit,32bit或64bit。
S150、分别基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,并根据图像哈希码损失和文本哈希码损失优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;
本实施例中,由于哈希检索模型的初始哈希层模型参数不是最优,因此哈希得到的图像哈希码或文本哈希码存在损失,为了调整哈希检索模型的模型参数,获取图像模态样本的图像哈希码,以及文本模态样本的文本哈希码,根据预置的损失函数计算分别计算图像模态样本的哈希码损失,以及文本模态样本的哈希码损失,根据哈希码损失优化哈希检索模型的模型参数,从而得到最优的哈希检索模型。
具体的,若训练数据中有n个实例对,每个实例对包括一个图像和文本,假设在训练数据库中有n个训练实例对,每个实例对对应一个图像和文本。图像模态样本记为
Figure PCTCN2021074660-appb-000003
其中d x为每个图像的维度,则第i幅图像则表示为X i*。对于文本模态样本,表示为
Figure PCTCN2021074660-appb-000004
其中d y为每个文本实例的维数,则第i个文本则表示为Y i*。令f (x)(X i*;η x,η x_hash)表示图像X i*的图像哈希码,其中η x表示残差网络中最后一层的参数,η x_has表示图像哈希层的参数。同样的,f (y)(Y j*;η y,η y_hash)表示文本Y j*的文本哈希码,其中η y表示词袋模型的模型参数, η y_hash表示文本哈希层的模型参数。
其中,图像哈希模块的目标函数如下式所示:
Figure PCTCN2021074660-appb-000005
其中,n表示样本数量;l表示哈希码长度;
Figure PCTCN2021074660-appb-000006
U i*=f (x)(X i*;η x,η x_hash),表示图像的图像哈希码;Jacd为杰卡德相似系数,杰卡德相似系数用于比较有限样本集之间的相似性与差异性,通过杰卡德相似系数将图像哈希码和文本哈希码的相似度量化为0到1之间。将杰卡德相似系数引入到交叉熵损失函数中,重新构造一个激励交叉熵损失函数来强化其作用,得到
Figure PCTCN2021074660-appb-000007
Figure PCTCN2021074660-appb-000008
为图像哈希码二值化的量化损失,其范围为-1到+1,保证哈希码的均衡。
同样的,文本哈希模块的目标函数如下式所示:
Figure PCTCN2021074660-appb-000009
其中,S ij表示跨模态相似矩阵,n表示样本数量,l表示哈希码长度,
Figure PCTCN2021074660-appb-000010
综合上述两个目标函数,得到总体目标函数为:
Figure PCTCN2021074660-appb-000011
在优化过程中,使用交替进行的学习策略进行优化。其中,在优化模型参数时,若优化图像部分的网络,则文本部分的网络保持不变;若优化文本部分的网络,则图像部分的网络保持不变。已知图像模态样本X,文本模态样本Y,跨模态相似矩阵S,哈希码长度l。分别从图像模态样本X和文本模态样本Y随机选择n个实例作为样本,计算U i*=f (x)(X i*;η x,η x_hash)、V i*=f (y)(Y j*;η y,η y_hash),
当优化图像网络时,固定文本网络保持不变,则有:
Figure PCTCN2021074660-appb-000012
式中,U i*表示图像i的图像哈希码,
Figure PCTCN2021074660-appb-000013
S ij表示跨模态相似矩阵,H i*表示第i张图像的哈希码矩阵。
当优化文本网络时,固定图像网络保持不变,则有:
Figure PCTCN2021074660-appb-000014
式中,V i*表示文本i的文本哈希码,
Figure PCTCN2021074660-appb-000015
S ij表示跨模态相似矩阵,H i*表示第i个文本的哈希码矩阵。
S160、获取检索数据,并通过最优的哈希检索模型输出所述检索数据的检索哈希码,所述检索数据的模态为图像模态或文本模态;
S170、根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果。
本实施例中,获取检索数据,通过最优的哈希检索模型输出检索数据对应的检索哈希码,然后根据检索哈希码,从存储有与检索数据不同模态的存储数据中,确定相应的检索结果。其中,检索数据可以是图像模态,也可以是文本模态。
在一实施例中,如图4所示,步骤S170包括:
步骤S171、计算所述存储数据的目标哈希码;
步骤S172、计算所述检索哈希码与目标哈希码之间的汉明距离;
步骤S173、按照汉明距离从低到高排列所述存储数据,并确定排名靠前的预置个数的所述存储数据作为检索结果。
本实施例中,为了确定与检索数据相似的存储数据,计算每个与检索数据不同模态的存储数据的目标哈希码;计算所述检索哈希码与目标哈希码之间的汉明距离;按照汉明距离从低到高排列存储数据,并确定排名靠前的预置个数的存储数据作为检索结果。需要知道的是,个数可以由用户根据需要自定义设计。汉明距离越低,证明检索数据与存储数据之间的相似度越高。
具体的,若训练数据中有n个实例对,每个实例对包括一个图像和文本,假设在训练数据库中有n个训练实例对,每个实例对对应一个图像和文本。图像模态样本记为
Figure PCTCN2021074660-appb-000016
其中d x为每个图像的维度,则第i幅图像则表示为X i*。对于文本模态样本,表示为
Figure PCTCN2021074660-appb-000017
其中d y为每个文本实例的维数,则第i个文本则表示为Y i*。文本Y i*是与图像X i*对应的标签,则标签矩阵记为
Figure PCTCN2021074660-appb-000018
其 中k表示标签的数量。此外,S表示为图像模态样本和文本模态样本的相似矩阵,其中S ij=1表示图像X i*在语义上与文本Y i*相似,否则S ij=0。以H x∈{-1,+1} l表示图像哈希码,H y∈{-1,+1} l表示文本哈希码,令u=H x、v=H y,利用汉明距离计算两个哈希码的理论相似度,计算公式定义为:
Figure PCTCN2021074660-appb-000019
式中,u表示所述图像哈希码,v表示所述文本哈希码,k表示哈希码长度,<u,v>表示所述图像哈希码与文本哈希码的内积。
给定S ij在u、v条件下,S ij概率可以表示为:
Figure PCTCN2021074660-appb-000020
其中,
Figure PCTCN2021074660-appb-000021
概率越大,实例的相似度越高,内积<u,v>也越大。因此,衡量两个哈希码之间的相似度可以转化为计算两个哈希码的汉明距离的内积。
例如,检索数据的哈希码为3106,根据以上公式计算得到与检索数据不同模态的存储数据存在对应的哈希码为3104、3011、3001以及3206,则汉明距离分别为1、3、3以及2,若定义输出排名靠前的2个存储数据,则将哈希码为3104和3206对应的存储数据作为检索结果。
该方法通过注意力模块提取不同模态的特征,提高模型对于数据的重要信息提取,更好地弥合跨模态检索任务中语义相关的异构数据之间的距离,提高检索速度。
本申请实施例还提供一种基于注意力的深度跨模态哈希检索装置,该深度跨模态哈希检索装置用于执行前述深度跨模态哈希检索方法的任一实施例。具体地,请参阅图5,图5是本申请实施例提供的基于注意力的深度跨模态哈希检索装置的示意性框图。该基于注意力的深度跨模态哈希检索装置100可以配置于服务器中。
如图5所示,基于注意力的深度跨模态哈希检索装置100包括获取模块110、图像特征提取模块120、文本特征提取模块130、第一哈希模块140、优化模块150、第二哈希模块160以及检索模块170。
获取模块110,用于获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;
图像特征提取模块120,用于通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵;
文本特征提取模块130,用于通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵;
第一哈希模块140,用于通过所述哈希检索模型的哈希层分别计算并存储所述图像特征矩阵及文本特征矩阵对应的哈希码,得到图像哈希码和文本哈希码;
优化模块150,用于分别基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,并根据图像哈希码损失和文本哈希码损失优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;
第二哈希模块160,用于获取检索数据,并通过最优的哈希检索模型输出所述检索数据的检索哈希码,所述检索数据的模态为图像模态或文本模态;
检索模块170,用于根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果。
在一实施例中,所述检索模块包括:
哈希单元,用于计算所述存储数据的目标哈希码;
计算单元,用于根据汉明距离计算所述检索哈希码与目标哈希码之间的相似度;
确定单元,用于按照相似度从高到低排列所有存储数据,并确定排名靠前的预置个数存储数据作为检索结果。
本申请实施例还提供一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如上所述的深度跨模态哈希检索方法。
在本申请的另一实施例中提供计算机可读存储介质。该计算机可读存储介质可以为非易失性的计算机可读存储介质。该计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行如上所述的深度跨模态哈希检索方法。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的设备、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。本领域普通技术人员可以意识到,结合本文中所公开的实 施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为逻辑功能划分,实际实现时可以有另外的划分方式,也可以将具有相同功能的单元集合成一个单元,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (10)

  1. 一种基于注意力的深度跨模态哈希检索方法,其特征在于,包括:
    获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;
    通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵;
    通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵;
    通过所述哈希检索模型的哈希层分别计算并存储所述图像特征矩阵及文本特征矩阵对应的哈希码,得到图像哈希码和文本哈希码;
    分别基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,并根据图像哈希码损失和文本哈希码损失优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;
    获取检索数据,并通过最优的哈希检索模型输出所述检索数据的检索哈希码,所述检索数据的模态为图像模态或文本模态;
    根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果。
  2. 根据权利要求1所述的深度跨模态哈希检索方法,其特征在于,所述通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵包括:
    通过所述残差网络模块对所述图像模态样本进行特征提取,得到第一图像特征;
    利用所述第一注意力模块对所述第一图像特征进行特征提取,得到在预置个数的注意力通道中的注意力特征图像,并将各所述注意力通道中的注意力特征图像进行拼接,得到所述图像特征矩阵。
  3. 根据权利要求1所述的深度跨模态哈希检索方法,其特征在于,所述通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵包括:
    通过所述词袋模块对所述文本模态样本进行词袋处理,得到词袋向量;
    将词袋向量输入配置有多通道的第二注意力模块进行特征提取,得到注意 力特征矩阵,并将各个通道的注意力特征矩阵进行拼接,得到文本特征矩阵。
  4. 根据权利要求1所述的深度跨模态哈希检索方法,其特征在于,所述损失函数由交叉熵损失函数和量化损失函数组成,所述交叉熵损失函数引入杰卡德相似系数。
  5. 根据权利要求1所述的深度跨模态哈希检索方法,其特征在于,所述根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果包括:
    计算所述存储数据的目标哈希码;
    计算所述检索哈希码与目标哈希码之间的汉明距离;
    按照汉明距离从低到高排列所述存储数据,并确定排名靠前的预置个数的所述存储数据作为检索结果。
  6. 根据权利要求5所述的深度跨模态哈希检索方法,其特征在于,所述计算所述检索哈希码与目标哈希码之间的汉明距离如下:
    Figure PCTCN2021074660-appb-100001
    其中,u表示所述图像哈希码,v表示所述文本哈希码,k表示哈希码长度,<u,v>表示所述图像哈希码与文本哈希码的内积。
  7. 一种基于注意力的深度跨模态哈希检索装置,其特征在于,包括:
    获取模块,用于获取图像模态样本、文本模态样本以及预置有注意力机制的哈希检索模型;
    图像特征提取模块,用于通过所述哈希检索模型的残差网络模块及第一注意力模块对所述图像模态样本进行图像特征提取,得到图像特征矩阵;
    文本特征提取模块,用于通过所述哈希检索模型的词袋模块及第二注意力模块提取所述文本模态样本的特征,得到文本特征矩阵;
    第一哈希模块,用于通过所述哈希检索模型的哈希层分别计算并存储所述图像特征矩阵及文本特征矩阵对应的哈希码,得到图像哈希码和文本哈希码;
    优化模块,用于分别基于所有图像哈希码以及所有文本哈希码,根据预设的哈希码损失函数分别计算图像哈希码损失和文本哈希码损失,并根据图像哈希码损失和文本哈希码损失优化所述哈希检索模型的模型参数,得到最优的哈希检索模型;
    第二哈希模块,用于获取检索数据,并通过最优的哈希检索模型输出所述 检索数据的检索哈希码,所述检索数据的模态为图像模态或文本模态;
    检索模块,用于根据所述检索哈希码,从存储有与所述检索数据不同模态的存储数据中确定检索结果。
  8. 根据权利要求7所述的深度跨模态哈希检索装置,其特征在于,所述检索模块包括:
    哈希单元,用于计算所述存储数据的目标哈希码;
    计算单元,用于计算所述检索哈希码与目标哈希码之间的汉明距离;
    确定单元,用于按照汉明距离从低到高排列所述存储数据,并确定排名靠前的预置个数的所述存储数据作为检索结果。
  9. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至6中任一项所述的深度跨模态哈希检索方法。
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行如权利要求1至6任一项所述的深度跨模态哈希检索方法。
PCT/CN2021/074660 2021-01-21 2021-02-01 基于注意力的深度跨模态哈希检索方法、装置及相关设备 WO2022155994A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110080906.9 2021-01-21
CN202110080906.9A CN112817914A (zh) 2021-01-21 2021-01-21 基于注意力的深度跨模态哈希检索方法、装置及相关设备

Publications (1)

Publication Number Publication Date
WO2022155994A1 true WO2022155994A1 (zh) 2022-07-28

Family

ID=75859128

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/074660 WO2022155994A1 (zh) 2021-01-21 2021-02-01 基于注意力的深度跨模态哈希检索方法、装置及相关设备

Country Status (2)

Country Link
CN (1) CN112817914A (zh)
WO (1) WO2022155994A1 (zh)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115203442A (zh) * 2022-09-15 2022-10-18 中国海洋大学 基于联合注意力的跨模态深度哈希检索方法、系统及介质
CN115424278A (zh) * 2022-08-12 2022-12-02 中国电信股份有限公司 邮件检测方法及装置、电子设备
CN115599942A (zh) * 2022-11-08 2023-01-13 重庆师范大学(Cn) 一种基于gcn的深度无监督跨模态检索方法
CN115687571A (zh) * 2022-10-28 2023-02-03 重庆师范大学 一种基于模态融合重建哈希的深度无监督跨模态检索方法
CN115828176A (zh) * 2023-02-09 2023-03-21 山东建筑大学 一种面向智慧工地的跨模态检索方法及系统
CN116108219A (zh) * 2023-04-07 2023-05-12 天津汉云工业互联网有限公司 图像检索方法、装置、电子设备和存储介质
CN116244484A (zh) * 2023-05-11 2023-06-09 山东大学 一种面向不平衡数据的联邦跨模态检索方法及系统
CN116244483A (zh) * 2023-05-12 2023-06-09 山东建筑大学 一种基于数据合成的大规模零样本数据检索方法及系统
CN116363817A (zh) * 2023-02-02 2023-06-30 淮阴工学院 一种化工厂危险区域入侵预警方法及系统
CN116385946A (zh) * 2023-06-06 2023-07-04 山东大学 面向视频的目标片段定位方法、系统、存储介质及设备
CN116594994A (zh) * 2023-03-30 2023-08-15 重庆师范大学 视觉语言知识蒸馏在跨模态哈希检索的应用
CN117156138A (zh) * 2023-10-31 2023-12-01 季华实验室 图像的不定长深度哈希编码方法、装置、设备及存储介质
CN117194605A (zh) * 2023-11-08 2023-12-08 中南大学 用于多模态医学数据缺失的哈希编码方法、终端及介质
CN117573916A (zh) * 2024-01-17 2024-02-20 武汉理工大学三亚科教创新园 一种海洋无人机图像文本的检索方法、设备及存储介质
CN117993868A (zh) * 2024-04-02 2024-05-07 国网山东省电力公司济宁供电公司 基于双模态注意力的电网工程项目审计预警方法及系统

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113868366B (zh) * 2021-12-06 2022-04-01 山东大学 一种面向流数据的在线跨模态检索方法与系统
CN115410717B (zh) * 2022-09-15 2024-05-21 北京京东拓先科技有限公司 模型训练方法、数据检索方法、影像数据检索方法和装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150317323A1 (en) * 2014-04-30 2015-11-05 Lnternational Business Machines Corporation Indexing and searching heterogenous data entities
CN110222140A (zh) * 2019-04-22 2019-09-10 中国科学院信息工程研究所 一种基于对抗学习和非对称哈希的跨模态检索方法
CN111125457A (zh) * 2019-12-13 2020-05-08 山东浪潮人工智能研究院有限公司 一种深度跨模态哈希检索方法及装置
CN111353076A (zh) * 2020-02-21 2020-06-30 华为技术有限公司 训练跨模态检索模型的方法、跨模态检索的方法和相关装置
CN111639240A (zh) * 2020-05-14 2020-09-08 山东大学 一种基于注意力感知机制的跨模态哈希检索方法及系统
CN111737458A (zh) * 2020-05-21 2020-10-02 平安国际智慧城市科技股份有限公司 基于注意力机制的意图识别方法、装置、设备及存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10970768B2 (en) * 2016-11-11 2021-04-06 Ebay Inc. Method, medium, and system for image text localization and comparison
US20190332921A1 (en) * 2018-04-13 2019-10-31 Vosai, Inc. Decentralized storage structures and methods for artificial intelligence systems
US10248664B1 (en) * 2018-07-02 2019-04-02 Inception Institute Of Artificial Intelligence Zero-shot sketch-based image retrieval techniques using neural networks for sketch-image recognition and retrieval
CN111026887B (zh) * 2019-12-09 2023-05-23 武汉科技大学 一种跨媒体检索的方法及系统
CN111241310A (zh) * 2020-01-10 2020-06-05 济南浪潮高新科技投资发展有限公司 一种深度跨模态哈希检索方法、设备及介质
CN112100413A (zh) * 2020-09-07 2020-12-18 济南浪潮高新科技投资发展有限公司 一种跨模态的哈希检索方法
CN112199375B (zh) * 2020-09-30 2024-03-01 三维通信股份有限公司 跨模态的数据处理方法、装置、存储介质以及电子装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150317323A1 (en) * 2014-04-30 2015-11-05 Lnternational Business Machines Corporation Indexing and searching heterogenous data entities
CN110222140A (zh) * 2019-04-22 2019-09-10 中国科学院信息工程研究所 一种基于对抗学习和非对称哈希的跨模态检索方法
CN111125457A (zh) * 2019-12-13 2020-05-08 山东浪潮人工智能研究院有限公司 一种深度跨模态哈希检索方法及装置
CN111353076A (zh) * 2020-02-21 2020-06-30 华为技术有限公司 训练跨模态检索模型的方法、跨模态检索的方法和相关装置
CN111639240A (zh) * 2020-05-14 2020-09-08 山东大学 一种基于注意力感知机制的跨模态哈希检索方法及系统
CN111737458A (zh) * 2020-05-21 2020-10-02 平安国际智慧城市科技股份有限公司 基于注意力机制的意图识别方法、装置、设备及存储介质

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115424278A (zh) * 2022-08-12 2022-12-02 中国电信股份有限公司 邮件检测方法及装置、电子设备
CN115424278B (zh) * 2022-08-12 2024-05-03 中国电信股份有限公司 邮件检测方法及装置、电子设备
CN115203442A (zh) * 2022-09-15 2022-10-18 中国海洋大学 基于联合注意力的跨模态深度哈希检索方法、系统及介质
CN115203442B (zh) * 2022-09-15 2022-12-20 中国海洋大学 基于联合注意力的跨模态深度哈希检索方法、系统及介质
CN115687571B (zh) * 2022-10-28 2024-01-26 重庆师范大学 一种基于模态融合重建哈希的深度无监督跨模态检索方法
CN115687571A (zh) * 2022-10-28 2023-02-03 重庆师范大学 一种基于模态融合重建哈希的深度无监督跨模态检索方法
CN115599942A (zh) * 2022-11-08 2023-01-13 重庆师范大学(Cn) 一种基于gcn的深度无监督跨模态检索方法
CN115599942B (zh) * 2022-11-08 2023-12-12 重庆师范大学 一种基于gcn的深度无监督跨模态检索方法
CN116363817A (zh) * 2023-02-02 2023-06-30 淮阴工学院 一种化工厂危险区域入侵预警方法及系统
CN116363817B (zh) * 2023-02-02 2024-01-02 淮阴工学院 一种化工厂危险区域入侵预警方法及系统
CN115828176A (zh) * 2023-02-09 2023-03-21 山东建筑大学 一种面向智慧工地的跨模态检索方法及系统
CN116594994B (zh) * 2023-03-30 2024-02-23 重庆师范大学 视觉语言知识蒸馏在跨模态哈希检索的应用方法
CN116594994A (zh) * 2023-03-30 2023-08-15 重庆师范大学 视觉语言知识蒸馏在跨模态哈希检索的应用
CN116108219A (zh) * 2023-04-07 2023-05-12 天津汉云工业互联网有限公司 图像检索方法、装置、电子设备和存储介质
CN116108219B (zh) * 2023-04-07 2023-06-13 天津汉云工业互联网有限公司 图像检索方法、装置、电子设备和存储介质
CN116244484B (zh) * 2023-05-11 2023-08-08 山东大学 一种面向不平衡数据的联邦跨模态检索方法及系统
CN116244484A (zh) * 2023-05-11 2023-06-09 山东大学 一种面向不平衡数据的联邦跨模态检索方法及系统
CN116244483A (zh) * 2023-05-12 2023-06-09 山东建筑大学 一种基于数据合成的大规模零样本数据检索方法及系统
CN116385946B (zh) * 2023-06-06 2023-08-29 山东大学 面向视频的目标片段定位方法、系统、存储介质及设备
CN116385946A (zh) * 2023-06-06 2023-07-04 山东大学 面向视频的目标片段定位方法、系统、存储介质及设备
CN117156138A (zh) * 2023-10-31 2023-12-01 季华实验室 图像的不定长深度哈希编码方法、装置、设备及存储介质
CN117156138B (zh) * 2023-10-31 2024-02-09 季华实验室 图像的不定长深度哈希编码方法、装置、设备及存储介质
CN117194605A (zh) * 2023-11-08 2023-12-08 中南大学 用于多模态医学数据缺失的哈希编码方法、终端及介质
CN117194605B (zh) * 2023-11-08 2024-01-19 中南大学 用于多模态医学数据缺失的哈希编码方法、终端及介质
CN117573916A (zh) * 2024-01-17 2024-02-20 武汉理工大学三亚科教创新园 一种海洋无人机图像文本的检索方法、设备及存储介质
CN117573916B (zh) * 2024-01-17 2024-04-26 武汉理工大学三亚科教创新园 一种海洋无人机图像文本的检索方法、设备及存储介质
CN117993868A (zh) * 2024-04-02 2024-05-07 国网山东省电力公司济宁供电公司 基于双模态注意力的电网工程项目审计预警方法及系统

Also Published As

Publication number Publication date
CN112817914A (zh) 2021-05-18

Similar Documents

Publication Publication Date Title
WO2022155994A1 (zh) 基于注意力的深度跨模态哈希检索方法、装置及相关设备
US10599983B2 (en) Inferred facts discovered through knowledge graph derived contextual overlays
WO2019242297A1 (zh) 基于机器阅读理解的智能对话方法、装置、终端
US10437868B2 (en) Providing images for search queries
WO2021179570A1 (zh) 序列标注方法、装置、计算机设备和存储介质
WO2019052403A1 (zh) 图像文本匹配模型的训练方法、双向搜索方法及相关装置
WO2021073254A1 (zh) 基于知识图谱的实体链接方法、装置、设备和存储介质
KR20160149978A (ko) 검색 엔진 및 그의 구현 방법
WO2020159593A1 (en) Training image and text embedding models
US20110106805A1 (en) Method and system for searching multilingual documents
CN110347790B (zh) 基于注意力机制的文本查重方法、装置、设备及存储介质
JP2022046759A (ja) 検索方法、装置、電子機器及び記憶媒体
KR102279126B1 (ko) 이미지 기반의 데이터 처리 방법, 장치, 전자 기기 및 저장 매체
US11892998B2 (en) Efficient embedding table storage and lookup
CN113761220A (zh) 信息获取方法、装置、设备及存储介质
JP2023002690A (ja) セマンティックス認識方法、装置、電子機器及び記憶媒体
WO2021056750A1 (zh) 检索方法及装置、存储介质
WO2022206094A1 (zh) 用于生成字幕器以及输出字幕的方法和装置
CN115775349A (zh) 基于多模态融合的假新闻检测方法和装置
CN114022687B (zh) 一种基于增强学习的图像描述对抗生成方法
KR20210098820A (ko) 전자 장치, 전자 장치의 제어 방법 및 판독 가능한 기록 매체
CN116796038A (zh) 遥感数据检索方法、装置、边缘处理设备及存储介质
WO2024042348A1 (zh) 英文医疗文本结构化的方法、装置、介质及电子设备
CN113641790A (zh) 一种基于区分表示深度哈希的跨模态检索模型
CN112199531A (zh) 一种基于哈希算法和邻域图的跨模态检索方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21920385

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24.10.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21920385

Country of ref document: EP

Kind code of ref document: A1