A model training and information retrieval method and device
Through feature fusion and mapping error adjustment, the problem of unstable parameter adjustment in network model training is solved, the stability and accuracy of the model are improved, and the detection ability of retrieval results is enhanced.
Patent Information
- Application Number
- CN202210744762.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-27
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2042-06-27
AI Technical Summary
During the training process of the network model, the adjustment of model parameters is unstable, which reduces the accuracy of the comparison results and affects the training effect.
By obtaining the characteristics of sample retrieval text and video data, the initial model and the model to be trained are used for feature fusion, the feature mapping error is calculated, and the model parameters are adjusted based on these errors to maintain the stability and accuracy of the model.
It effectively improves the stability and accuracy of the model, reduces performance fluctuations during model training, and enhances the ability to detect whether the object data is the result of a retrieval request.
Smart Images

Figure CN114969439B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a model training and information retrieval method and device. Background Art
[0002] When users search for video data on the information platform, they usually enter search text that describes the video content, such as the theme keywords of the video. The information platform will compare the search text with the video data and provide the video data with similar content to the search text as the search results to the user. In this process, a network model can be used to compare the search text with the video data. The network model used needs to be trained in advance to improve the accuracy of the comparison results.
[0003] During the training process of the above network model, the model parameters of the network model will be adjusted. When the model parameters are different during the adjustment, the network model comparison results are unstable. In some cases, the adjusted model parameters reduce the accuracy of the network model comparison results, affecting the training effect.
[0004] Therefore, a model training scheme is needed to improve the stability of the network model. Summary of the invention
[0005] The purpose of the embodiment of the present invention is to provide a model training, information retrieval method and device to retrieve video data with different modalities from retrieval text. The specific technical solution is as follows:
[0006] In a first aspect of the present invention, a model training method is first provided, the method comprising:
[0007] Obtaining sample text features of multiple units of information in a sample search text and sample visual features of multiple units of information in sample video data;
[0008] Input each sample text feature and each sample visual feature into the initial model to detect whether the sample video data is the search result of the sample search text, and obtain the initial text fusion feature after the initial model fuses each sample text feature and the initial visual fusion feature after the initial model fuses each sample visual feature in the detection process;
[0009] Input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the search result of the sample search text, and obtain the tuned text fusion feature after the model to be trained fuses each sample text feature and the tuned visual fusion feature after the model to be trained fuses each sample visual feature in the detection process, wherein the model to be trained is: a model obtained by pre-training the initial model;
[0010] Obtaining a text feature mapping error between the initial text fusion feature and the tuned text fusion feature, and a visual feature mapping error between the initial visual fusion feature and the tuned visual fusion feature;
[0011] Based on the text feature mapping error, the visual feature mapping error and the sample annotation, the model parameters of the model to be trained are adjusted, wherein the sample annotation represents the annotation information of whether the sample video data is the retrieval result of the sample retrieval text.
[0012] In a second aspect of the present invention, there is also provided an information retrieval method, the method comprising:
[0013] Obtaining text features of multiple units of information in the retrieved text and visual features of multiple units of information in the video data;
[0014] Input each text feature and each visual feature into a retrieval model to detect whether the video data is a retrieval result of the retrieval text; wherein the retrieval model is: a model trained according to the model training method described above.
[0015] In a third aspect of the present invention, a model training device is provided, the device comprising:
[0016] A sample feature acquisition module, used to obtain sample text features of multiple unit information in the sample search text, and sample visual features of multiple unit information in the sample video data;
[0017] An initial fusion feature acquisition module is used to input each sample text feature and each sample visual feature into an initial model to detect whether the sample video data is a retrieval result of the sample retrieval text, and obtain an initial text fusion feature after the initial model fuses each sample text feature and an initial visual fusion feature after the initial model fuses each sample visual feature during the detection process;
[0018] The module for obtaining optimized fusion features is used to input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the search result of the sample search text, and obtain the optimized text fusion feature after the model to be trained fuses each sample text feature and the optimized visual fusion feature after the model to be trained fuses each sample visual feature in the detection process, wherein the model to be trained is: a model obtained by pre-training the initial model;
[0019] A mapping error obtaining module, used to obtain a text feature mapping error between the initial text fusion feature and the tuned text fusion feature, and a visual feature mapping error between the initial visual fusion feature and the tuned visual fusion feature;
[0020] A model parameter adjustment module is used to adjust the model parameters of the model to be trained based on the text feature mapping error, the visual feature mapping error and the sample annotation, wherein the sample annotation represents the annotation information of whether the sample video data is the retrieval result of the sample retrieval text.
[0021] In a fourth aspect of the present invention, there is also provided an information retrieval device, the device comprising:
[0022] A feature acquisition module, used to acquire text features of multiple unit information in the retrieved text and visual features of multiple unit information in the video data;
[0023] The retrieval result detection module is used to input various text features and various visual features into the retrieval model to detect whether the video data is the retrieval result of the retrieval text; wherein the retrieval model is: a model trained according to the model training device described above.
[0024] In a fifth aspect of the present invention, there is also provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0025] Memory, used to store computer programs;
[0026] The processor is used to implement the above-mentioned model training or information retrieval method steps when executing the program stored in the memory.
[0027] In the sixth aspect of the implementation of the present invention, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the above-mentioned model training or information retrieval method is implemented.
[0028] In the seventh aspect of the implementation of the present invention, there is also provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the above-mentioned model training or information retrieval method.
[0029] It can be seen from the above that when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the sample annotation that characterizes whether the sample video data is the retrieval result of the sample retrieval text is taken into consideration. In this way, through training, the model to be trained can learn the characteristics of the sample video data that is the retrieval result of the sample retrieval text, thereby enabling the above-mentioned model to have the ability to detect whether the object data is the retrieval result of the retrieval request.
[0030] In addition, when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the situation that the model to be trained before starting the training, that is, the initial model, fuses features in the process of responding to the retrieval request is also considered. Specifically, the mapping error between the fused features obtained after the initial model and the model to be trained fuse the same features is used to constrain the training process of the model to be trained, so that after the parameters of the model to be trained are adjusted, the model still has a feature fusion capability similar to that of the initial model, which can effectively reduce the model performance fluctuation introduced by the model training process. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0032] Figure 1 A flowchart of the first model training method provided in an embodiment of the present invention.
[0033] Figure 2 A flowchart of a second model training method provided in an embodiment of the present invention.
[0034] Figure 3 A schematic flow chart of a third model training method provided in an embodiment of the present invention.
[0035] Figure 4 A schematic flowchart of the fourth model training method provided in an embodiment of the present invention.
[0036] Figure 5 A schematic diagram of a flow chart of an information retrieval method provided by an embodiment of the present invention.
[0037] Figure 6 A schematic diagram of the structure of a model training device provided in an embodiment of the present invention.
[0038] Figure 7 A schematic diagram of the structure of an information retrieval device provided by an embodiment of the present invention.
[0039] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0041] In the process of training a network model for information retrieval, the model parameters of the network model are adjusted, which will make the network model unstable. In order to improve the stability of the network model, an embodiment of the present invention provides a model training and information retrieval method and device, which are introduced below.
[0042] In one embodiment of the present invention, a model training method is provided, the method comprising:
[0043] Obtaining sample text features of multiple units of information in a sample search text and sample visual features of multiple units of information in sample video data;
[0044] Input each sample text feature and each sample visual feature into the initial model to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the initial text fusion feature after the initial model fuses each sample text feature and the initial visual fusion feature after the initial model fuses each sample visual feature during the detection process;
[0045] Input each sample text feature and each sample visual feature into the to-be-trained model to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the tuned text fusion feature after the to-be-trained model fuses each sample text feature and the tuned visual fusion feature after the to-be-trained model fuses each sample visual feature in the detection process, wherein the to-be-trained model is: a model obtained by pre-training the initial model;
[0046] Obtaining a text feature mapping error between an initial text fusion feature and an optimized text fusion feature, and a visual feature mapping error between an initial visual fusion feature and an optimized visual fusion feature;
[0047] Based on the text feature mapping error, the visual feature mapping error and the sample annotation, the model parameters of the model to be trained are adjusted, wherein the sample annotation represents the annotation information of whether the sample video data is the retrieval result of the sample retrieval text.
[0048] It can be seen from the above that when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the sample annotation that characterizes whether the sample video data is the retrieval result of the sample retrieval text is taken into consideration. In this way, through training, the model to be trained can learn the characteristics of the sample video data that is the retrieval result of the sample retrieval text, thereby enabling the above-mentioned model to have the ability to detect whether the object data is the retrieval result of the retrieval request.
[0049] In addition, when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the situation that the model to be trained before starting the training, that is, the initial model, fuses features in the process of responding to the retrieval request is also considered. Specifically, the mapping error between the fused features obtained after the initial model and the model to be trained fuse the same features is used to constrain the training process of the model to be trained, so that after the parameters of the model to be trained are adjusted, the model still has a feature fusion capability similar to that of the initial model, which can effectively reduce the model performance fluctuation introduced by the model training process.
[0050] The model training method provided by the embodiment of the present invention is described in detail below through specific examples.
[0051] See also Figure 1 In one embodiment of the present invention, a flow chart of a first model training method is provided, and the method includes the following steps S101-S105.
[0052] Step S101: obtaining sample text features of a plurality of unit information in a sample search text and sample visual features of a plurality of unit information in a sample video data.
[0053] The modality of the sample retrieval text is different from that of the sample video data. The modality indicates the form in which information exists. The form can be text, image, etc. For example, the modality of the sample retrieval text is text, and the modality of the sample video data is image. In this case, the trained model can retrieve video materials containing image information according to the retrieval request in the form of text input by the user.
[0054] The above-mentioned unit information can be all information of the sample search text or sample video data, or part of the information of the sample search text or sample video data. For example, if the sample search text is a sentence describing the content to be searched, the unit information can be the entire sentence, or keywords extracted from the sentence.
[0055] In the case where the unit information is part of the sample retrieval text or sample video data, the sample retrieval text or sample video data is sampled to obtain the unit information. The sampling method may be to randomly extract part of the information in the sample retrieval text or sample video data, or to extract part of the information in the sample retrieval text or sample video data according to a preset rule. For example, the sample retrieval text is a string of characters, and the preset rule may be to extract characters in the sample retrieval text at a fixed character interval in the string, such as extracting one character in the sample retrieval text every other character or every two characters, etc.; for another example, the sample video data is video data, and the preset rule may be to extract frame images from the video data at a fixed time domain interval, etc.
[0056] The above sample text features can be obtained by extracting the unit information contained in the sample search text. Specifically, the required network model can be determined according to the modality of the sample search text, and the unit information of the sample search text can be input into the determined network model to obtain the sample text features. For example, the required network model is a multilingual BERT (Bidirectional Encoder Representation from Transformers) model.
[0057] The above-mentioned sample visual features can be obtained by extracting features from the unit information contained in the sample video data. Specifically, the required network model can be determined according to the modality of the sample video data, and the unit information of the sample video data can be input into the determined network model to obtain the sample visual features. For example, when extracting features from the sample video data, a key frame image extracted from the video data can be used. Correspondingly, the modality is an image, so it can be determined that the required network model is an image processing model, and the specific model type can be a convolutional neural network model or a ViT (Vision Transformer) model.
[0058] Step S102: Input each sample text feature and each sample visual feature into the initial model to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the initial text fusion feature after the initial model fuses each sample text feature and the initial visual fusion feature after the initial model fuses each sample visual feature during the detection process.
[0059] Specifically, the initial model detects whether the sample video data is the retrieval result of the sample retrieval text, and can make a judgment based on the similarity between the initial text fusion feature and the initial visual fusion feature. For example, when the similarity between the initial text fusion feature and the initial visual fusion feature reaches a preset similarity threshold, the sample video data is determined to be the retrieval result of the sample retrieval text.
[0060] The initial model is a network model for detecting whether sample video data and sample retrieval text description contents are similar, and the parameter values of the model parameters are the parameter values before model training.
[0061] In one embodiment of the present invention, in the process of detecting whether the sample video data is the retrieval result of the sample retrieval text, the initial model can first perform feature fusion on each feature input into the model, and then perform retrieval based on the fused features. Based on this, it can be considered that the initial model contains a fusion sub-model for feature fusion. Therefore, each sample text feature can be input into the above fusion sub-model for fusion to obtain the initial text fusion feature. The fusion method can be to splice and add the vectors representing each sample text feature. The fusion sub-model used can be a network model such as a bidirectional LSTM (Long Short-Term Memory) model, a bidirectional GRU (Gate Recurrent Unit) model, etc.
[0062] The method for obtaining the initial visual fusion feature is similar to the method for obtaining the initial text fusion feature mentioned above. The only difference is the replacement of the names and concepts such as the initial visual fusion feature and the initial text fusion feature, the sample visual feature and the sample text feature, which will not be described in detail here.
[0063] Since the initial model has not been trained, the fusion sub-model it includes has not been trained, and the model parameters have not been tuned through the training process. In this case, the initial text fusion features obtained are the text features before tuning, and the initial visual fusion features obtained are the visual features before tuning.
[0064] Step S103: Input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the optimized text fusion feature after the model to be trained fuses each sample text feature and the optimized visual fusion feature after the model to be trained fuses each sample visual feature during the detection process.
[0065] The model to be trained is a model obtained by pre-training the initial model. Therefore, the model to be trained and the initial model have the same model structure, and the model to be trained is obtained by adjusting the model parameters of the initial model.
[0066] In the model to be trained, the method of detecting whether the sample video data is the retrieval result of the sample retrieval text and obtaining the tuned text fusion feature and the tuned visual fusion feature is similar to step S102. The only difference is the replacement of the name concepts such as the tuned text fusion feature and the initial text fusion feature, the tuned visual fusion feature and the initial visual fusion feature, which will not be described in detail here.
[0067] Since the model to be trained has been trained, the fusion sub-model it includes has also been trained, and the model parameters are tuned through the training process. In this case, the tuned text fusion features obtained are the tuned text features, and the tuned visual fusion features are the tuned visual features.
[0068] Step S104: obtaining a text feature mapping error between the initial text fusion feature and the tuned text fusion feature, and a visual feature mapping error between the initial visual fusion feature and the tuned visual fusion feature.
[0069] In one embodiment of the present invention, the initial text fusion features and the tuned text fusion features can be represented by vectors in a low-dimensional vector space, and the difference between the vector representations corresponding to the initial text fusion features and the initial visual fusion features can be calculated as the above-mentioned text feature mapping error.
[0070] The method of obtaining the visual feature mapping error is similar to that of the text feature mapping error. The only difference is the replacement of the names of the initial visual fusion feature and the initial text fusion feature, the tuned visual fusion feature and the tuned text fusion feature, which will not be described in detail.
[0071] The specific method of calculating the mapping error can refer to the following Figure 3 The steps of the illustrated embodiment will not be described in detail here.
[0072] Step S105: adjusting the model parameters of the model to be trained based on the text feature mapping error, the visual feature mapping error and the sample annotation.
[0073] The sample annotation is the annotation information representing whether the sample video data is the retrieval result of the sample retrieval text. In the solution provided by the embodiment of the present invention, the training model can be trained by using positive samples of the sample video data being the retrieval result of the sample retrieval text and negative samples of the sample video data not being the retrieval result of the sample retrieval text.
[0074] Specifically, the output information of the model indicates whether the sample video data is the retrieval result of the sample retrieval text. The total loss of the model is calculated based on the error between the output information of the model and the sample annotation, the text feature mapping error, and the visual feature mapping error. The model parameters of the model to be trained are adjusted by minimizing the total loss, that is, the values of each model parameter of the network model are set to the values when the total loss is minimized, thereby realizing the training of the network model. Specifically, when minimizing the total loss, the total loss can be minimized based on algorithms such as the gradient descent method and the stochastic gradient descent method.
[0075] It can be seen from the above that when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the sample annotation that characterizes whether the sample video data is the retrieval result of the sample retrieval text is taken into consideration. In this way, through training, the model to be trained can learn the characteristics of the sample video data that is the retrieval result of the sample retrieval text, thereby enabling the above-mentioned model to have the ability to detect whether the video data is the retrieval result of the retrieval text.
[0076] In addition, when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the situation that the model to be trained before starting the training, that is, the initial model, fuses features in the process of responding to the retrieval request is also considered. Specifically, the mapping error between the fused features obtained after the initial model and the model to be trained fuse the same features is used to constrain the training process of the model to be trained, so that after the parameters of the model to be trained are adjusted, the model still has a feature fusion capability similar to that of the initial model, which can effectively reduce the model performance fluctuation introduced by the model training process.
[0077] Combine the following Figure 2 The embodiment shown introduces a model training method, wherein the aforementioned step S105 can be implemented by steps S205-S206 in the following embodiment.
[0078] See also Figure 2 In one embodiment of the present invention, a second model training method is provided, which includes the following steps S201-S206.
[0079] Step S201: obtaining sample text features of multiple unit information in a sample search text and sample visual features of multiple unit information in a sample video data.
[0080] Step S202: Input each sample text feature and each sample visual feature into the initial model to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the initial text fusion feature after the initial model fuses each sample text feature during the detection process and the initial visual fusion feature after the initial model fuses each sample visual feature.
[0081] Step S203: Input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the tuned text fusion feature after the model to be trained fuses each sample text feature and the tuned visual fusion feature after the model to be trained fuses each sample visual feature during the detection process.
[0082] The model to be trained is: a model obtained by pre-training the initial model.
[0083] Step S204: obtaining a text feature mapping error between the initial text fusion feature and the tuned text fusion feature, and a visual feature mapping error between the initial visual fusion feature and the tuned visual fusion feature.
[0084] The above steps S201-S204 are respectively consistent with the above steps S101-S104, and will not be described in detail here.
[0085] Step S205: According to the fine-tuned text fusion features and the fine-tuned visual fusion features, a metric error of a retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text is obtained.
[0086] Since the tuned text fusion feature is obtained based on the sample text feature of the unit information in the sample retrieval text, and the tuned visual fusion feature is obtained based on the sample visual feature of the unit information in the sample video data, when the sample video data is the retrieval result of the sample retrieval text, it is expected that the error between the tuned text fusion feature and the tuned visual fusion feature obtained by the model to be trained is small; and in the case of sample video data, it is expected that the error between the tuned text fusion feature and the tuned visual fusion feature obtained by the model to be trained is large. Therefore, in this step, a metric error is obtained based on the tuned text fusion feature and the tuned visual fusion feature, and by comparing the metric error with the expected error between the tuned text fusion feature and the tuned visual fusion feature, the model parameters are adjusted so that the error between the tuned text fusion feature and the tuned visual fusion feature meets the expected value.
[0087] In one embodiment of the present invention, a feature vector representing a fine-tuned text fusion feature and a feature vector representing a fine-tuned visual fusion feature can be mapped into the same vector space, in which a mapping vector representing the fine-tuned text fusion feature and a mapping vector representing the fine-tuned visual fusion feature are formed, and then the difference between the obtained mapping vectors is calculated as a metric error.
[0088] In one implementation, more than one vector space can be selected, and the above mapping process can be completed in each selected vector space to obtain a mapping vector representing the tuned text fusion feature and a mapping vector representing the tuned visual fusion feature in each vector space, and then the sub-errors in each vector space are calculated based on each mapping vector in the vector space, and a metric error is generated based on all sub-errors.
[0089] The specific implementation method of calculating the metric error can refer to the steps in the following embodiment, which will not be described in detail here.
[0090] Step S206: adjusting the model parameters of the model to be trained based on the text feature mapping error, the visual feature mapping error, the metric error and the sample annotation.
[0091] The method of adjusting the model parameters of the model to be trained is similar to the above step S105, the only difference is that the above total loss also includes the measurement error in this step, which will not be described in detail here.
[0092] It can be seen from the above that in the solution provided by the embodiment of the present invention, the metric error obtained by tuning the text fusion features and the tuned visual fusion features is used when adjusting the model parameters, so that after adjusting the model parameters, the metric error obtained by tuning the text fusion features and the tuned visual fusion features is more consistent with the expected error between the tuned text fusion features and the tuned visual fusion features. In this case, it is more accurate to use the tuned text fusion features and the tuned visual fusion features to judge the relationship between the sample retrieval text and the sample video data.
[0093] The specific method of obtaining the measurement error in step S205 is described below.
[0094] In one embodiment of the present invention, the above step S205 can be implemented in the following three ways:
[0095] In one implementation, the difference between the fine-tuned text fusion feature and the fine-tuned visual fusion feature can be calculated as a metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text.
[0096] Specifically, the difference between the tuned text fusion feature and the tuned visual fusion feature can be obtained by a mapping vector representing the tuned text fusion feature and a mapping vector representing the tuned visual fusion feature. For example, the distance or similarity coefficient of the above mapping vectors can be calculated, and the embodiments of the present invention are not limited to this.
[0097] In another implementation method, distribution features reflecting the frequency distribution of unit information in the sample retrieval text can be obtained. Based on the distribution features, tuned text fusion features and tuned visual fusion features, the metric error of the retrieval result of the trained model detecting whether the sample video data is the sample retrieval text is obtained.
[0098] The above distribution characteristics represent the frequency of occurrence of unit information in the sample search text, which can be obtained by counting the number of occurrences of each word in the sample search text.
[0099] The specific implementation method of obtaining the measurement error according to the distribution feature, the tuning of the text fusion feature and the tuning of the visual fusion feature can be referred to the steps in the following embodiment, which will not be described in detail here.
[0100] In another implementation, the metric errors calculated in the above two implementations can be used as sub-errors at the same time, and a total metric error can be generated based on each sub-error. For example, linear weighted calculation is performed on each sub-error, and the linear weighted sum is used as the total metric error.
[0101] As can be seen from the above, in the solution provided by the embodiment of the present invention, different implementation methods are used to calculate the metric error. In one implementation method, the difference between the tuned text fusion feature and the tuned visual fusion feature is calculated as the metric error, so that after the parameters are adjusted according to the metric error, the tuned text fusion feature and the tuned visual fusion feature obtained by the training model are more accurate in indicating whether the sample video data is the retrieval result of the sample retrieval text; in another implementation method, the distribution feature is used when calculating the metric error. The distribution feature retains the frequency distribution of the unit information in the sample retrieval text, and does not use all the feature information in all the unit information, so that the distribution feature has a lower feature dimension, and the calculation complexity is lower when the distribution feature is used to calculate the metric error; in another implementation method, the metric errors calculated by the above two methods are used at the same time to generate the total metric error, so that the information referenced to generate the metric error is more sufficient and the calculated error is more accurate.
[0102] The following describes a specific implementation method for obtaining the metric error based on distribution features, fine-tuning text fusion features, and fine-tuning visual fusion features.
[0103] In one embodiment of the present invention, obtaining the metric error of the retrieval result of whether the sample video data is the sample retrieval text by the to-be-trained model based on the distribution feature, the optimized text fusion feature and the optimized visual fusion feature includes:
[0104] Based on the difference between the distribution features and the tuned text fusion features, and the difference between the distribution features and the tuned visual fusion features, a metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text is generated.
[0105] Specifically, the difference between the distribution feature and the optimized text fusion feature can be calculated according to the following formula:
[0106] MSE(Y-MFC(V))
[0107] Among them, MSE() represents the mean square error function, and the calculation result of the mean square error function is the metric error, Y represents the distribution feature, V represents the tuned text fusion feature, MFC(V) represents the linear transformation of V based on at least one fully connected layer, and the linear transformation operation form of each fully connected layer in MFC(V) is W*V+b, W represents the preset linear transformation matrix, and b represents the bias term.
[0108] The difference between calculating the distribution feature and tuning the visual fusion feature is calculated in a similar way to the difference between calculating the distribution feature and tuning the text fusion feature. The only difference is the replacement of the name concepts such as tuning the visual fusion feature and tuning the text fusion feature, which will not be described in detail here.
[0109] In one implementation, a linear weighted sum of the differences between the distribution feature and the tuned text fusion feature and the tuned visual fusion feature may be calculated, and the obtained linear weighted sum may be used as the metric error.
[0110] It can be seen from the above that in the solution provided by the embodiment of the present invention, distribution features are used in the process of generating metric errors. Because the feature dimension of the distribution features is relatively low, when the difference between the distribution features and the third fusion features is calculated through linear transformation, the feature dimension of the third fusion feature is consistent with the feature dimension of the distribution features. Similarly, the feature dimension of the fourth fusion feature is consistent with the feature dimension of the distribution features. Each feature for calculating the metric error has a relatively low feature dimension, thereby reducing the computational complexity.
[0111] Combine the following Figure 3 The embodiment shown introduces a model training method, wherein the aforementioned step S104 can be implemented by steps S304-S306 in the following embodiment.
[0112] See also Figure 3In one embodiment of the present invention, a flow chart of a third model training method is provided, and the method includes the following steps S301-S307:
[0113] Step S301: obtaining sample text features of a plurality of unit information in a sample search text and sample visual features of a plurality of unit information in a sample video data.
[0114] Step S302: Input each sample text feature and each sample visual feature into the initial model to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the initial text fusion feature after the initial model fuses each sample text feature and the initial visual fusion feature after the initial model fuses each sample visual feature during the detection process.
[0115] Step S303: Input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the retrieval result of the sample retrieval text, and obtain the tuned text fusion feature after the model to be trained fuses each sample text feature and the tuned visual fusion feature after the model to be trained fuses each sample visual feature during the detection process.
[0116] The above steps S301-S303 are respectively consistent with the above steps S101-S103, and will not be described in detail here.
[0117] Step S304: Mapping the initial text fusion features to a preset manifold space to obtain initial text mapping features, and mapping the optimized text fusion features to the manifold space to obtain optimized text mapping features.
[0118] In one embodiment of the present invention, the initial text fusion features can be transformed by PCA (Principal Component Analysis) to obtain the corresponding initial dimensionality reduction vector, the optimized text fusion features can be transformed by PCA to obtain the corresponding optimized dimensionality reduction vector, and then SVD (Singular Value Decomposition) can be used to obtain the initial text mapping features and the optimized text mapping features.
[0119] Specifically, the above process can be completed according to the following formula:
[0120] Formula 1:
[0121]
[0122] Formula 2:
[0123] R T P t =-U2Σ(1)V T
[0124] In the above formula 1, P t-1 represents the initial dimension reduction vector, P t Represents the optimized dimension reduction vector, U1 is The matrix composed of the eigenvectors of the obtained matrix, V T for The transpose of the matrix consisting of the eigenvectors of the obtained matrix. Γ(1) is a diagonal matrix and contains Singular values of the resulting matrix.
[0125] In the above formula 2, R T is the transposed matrix of the orthogonal complement of the optimized dimension reduction vector. U2 is R T P t The matrix composed of the first set of eigenvectors of the obtained matrix, V T For R T P t The transpose matrix of the matrix composed of the second set of eigenvectors of the obtained matrix, Σ(1) is a diagonal matrix and contains R T P t Singular values of the resulting matrix.
[0126] According to V obtained by singular value decomposition in Formula 1 and Formula 2, the initial dimensionality reduction vector and the tuned dimensionality reduction vector can be projected to obtain the initial text mapping feature and the tuned text mapping feature.
[0127] Step S305: based on the difference between the initial text mapping feature and the tuned text mapping feature, a text feature mapping error between the initial text fusion feature and the tuned text fusion feature is obtained.
[0128] In one embodiment of the present invention, the text manifold mapping error, that is, the text feature mapping error obtained based on the manifold space, can be calculated according to the relative relationship between the initial text mapping feature and the tuned text mapping feature in the manifold space.
[0129] The specific calculation method of the text feature mapping error refers to the steps in the following embodiment, which will not be described in detail here.
[0130] Step S306: Obtaining a visual feature mapping error between the initial visual fusion feature and the tuned visual fusion feature.
[0131] The calculation method of the visual feature mapping error is similar to the calculation method of the text feature mapping error in steps S304-305, and the only difference is the replacement of the names of the visual feature mapping error and the text feature mapping error, the initial visual fusion feature and the initial text fusion feature, the tuned visual fusion feature and the tuned text fusion feature. Similarly, the visual manifold mapping error can be calculated based on the relative relationship between the initial visual mapping feature and the tuned visual mapping feature in the manifold space, that is, the visual feature mapping error obtained based on the manifold space.
[0132] Step S307: adjusting the model parameters of the model to be trained based on the text feature mapping error, the visual feature mapping error and the sample annotation.
[0133] The above step S307 is consistent with the above step S105 and will not be described in detail here.
[0134] As can be seen from the above, in the solution provided by the embodiment of the present invention, a transformation matrix is used to calculate the text feature mapping error. The transformation matrix is used to transform the third feature vector into a text feature vector, which reflects the degree of change of the tuned text fusion feature and the initial text fusion feature. By minimizing the text feature mapping error during training, the degree of change represented by the transformation matrix can be reduced accordingly, thereby ensuring the similarity between the initial text fusion feature and the tuned text fusion feature. Because the initial text fusion feature represents the fusion feature of the initial model, and the tuned text fusion feature represents the fusion feature output by the model to be trained, this solution can ensure that the feature fusion capability of the initial model is similar to the feature fusion capability of the model to be trained, thereby improving the stability of model training.
[0135] The specific method of obtaining the text feature mapping error in step S305 is described below.
[0136] In one embodiment of the present invention, the above step S305 can be implemented in the following manner:
[0137] Determine the transformation relationship from the initial text mapping feature to the tuned text mapping feature; generate the text feature mapping error between the initial text fusion feature and the tuned text fusion feature according to the initial text fusion feature, the tuned text fusion feature and the transformation relationship.
[0138] Specifically, the above transformation relationship can be expressed as a transformation matrix for calculating the singular values obtained in the above formula 1 and formula 2. Specifically, the calculation can be performed with reference to the following formula:
[0139]
[0140]
[0141]
[0142] Δ=[P t-1 U1 RU2]
[0143]
[0144] Without loss of generality, assuming that n singular values are obtained and a sequence is formed in a certain order, the i in the above formula represents the calculation of the i-th singular value in the sequence, and i can be any integer from 1, 2...n.
[0145] In the above formula, ω i represents the angular variable corresponding to the i-th singular value. t-1 , U1, R, and U2 have the same meanings as the parameters with the same names in the aforementioned formulas 1 and 2.
[0146] Q is the change matrix, and λ1 is formed as follows: 1i The calculation method is to calculate the λ corresponding to the first singular value for all the n singular values obtained. 11 , the second singular value corresponding to λ 11 ...calculate the nth singular value λ 1n , forming a diagonal matrix λ1 based on all the calculated values.
[0147] The formation of λ2 and λ3 is similar to that of λ1, except that 2i , 3i With λ 1i The conceptual replacement of names will not be elaborated here.
[0148] The obtained transformation matrix Q can be used to calculate the text feature mapping error, which can be calculated according to the following formula:
[0149]
[0150] Among them, L GeoDL represents the text feature mapping error, z t represents the optimized text fusion feature, z t-1 Represents the initial text fusion features.
[0151] As can be seen from the above, in the solution provided by the embodiment of the present invention, the transformation relationship between the mapping features corresponding to the tuned text fusion features and the initial text fusion features is used, so that the difference between the mapping features can be referred to when calculating the loss. Because the mapping features obtained in the manifold space can accurately retain the original fusion features, the difference between the mapping features represented by the transformation relationship from the initial text mapping features to the tuned text mapping features can accurately reflect the error between the tuned text fusion features and the initial text fusion features, thereby increasing the reliability of the calculation error.
[0152] The following is based on Figure 4 The illustrated embodiment illustrates the complete training process of the initial model and the model to be trained.
[0153] In one embodiment of the present invention, see Figure 4 , a flowchart of the fourth model training method is provided.
[0154] Among them, the initial model on the video sequence process and the initial model on the text sequence process are the same model, that is, the initial model in the aforementioned embodiment, which is used to process different features of the video sequence and the text sequence respectively; similarly, the model to be trained on the video sequence process and the model to be trained on the text sequence process are the same model; wherein the above-mentioned initial model may be a model to be trained whose model parameters have not been tuned through model training; accordingly, the model to be trained in the figure is obtained by pre-training the above-mentioned model to be trained.
[0155] The initial model may be a RNN (Recurrent Neural Network) model. Accordingly, the pre-trained model to be trained is an RNN model having the same model structure as the initial model, except that the parameter values of the model parameters are different.
[0156] The text sequence in the figure is the sample retrieval text, and the video sequence is the sample video data.
[0157] In the text sequence process, multiple unit information in the text sequence is obtained, including word 1 and word 2 obtained by segmenting the text sequence. The entire sentence, word 1, and word 2 in the text sequence are input into the multilingual BERT model to obtain sample text features, which are the text whole sentence features, text sequence features 1, and text sequence features 2 shown in the figure. The text whole sentence features, text sequence features 1, and text sequence features 2 are input into the initial model to obtain the initial text fusion features after the input features are fused. The text whole sentence features, text sequence features 1, and text sequence features 2 are input into the model to be trained to obtain the tuned text fusion features after the input features are fused. The text feature mapping error of the tuned text features and the text features is obtained.
[0158] In the video sequence process, multiple unit information in the video sequence is obtained, namely, image 1 and image 2. Image 1 and image 2 are input into the CNN model or the ViT model to obtain sample visual features, including visual feature 1 extracted from image 1 and visual feature 2 extracted from image 2. Visual feature 1 and visual feature 2 are input into the initial model to obtain initial visual fusion features after the input features are fused; visual feature 1 and visual feature 2 are input into the model to be trained to obtain tuned visual fusion features after the input features are fused, and visual features before tuning and visual feature mapping errors of visual features are obtained.
[0159] In the text sequence process, the word segmentation sequence corresponding to the text sequence can be obtained, and the distribution characteristics can be obtained according to the frequency of occurrence of the word segmentation sequence. The distribution characteristics are represented as the text label vector in the figure.
[0160] After obtaining the tuned text fusion features and the tuned visual fusion features, the feature vectors representing the tuned text fusion features and the tuned visual fusion features are mapped to the vector space of the preset hidden layer through the fully connected layer MFC_V1 and the fully connected layer MFC_T1, and the mapping vector of each feature vector in the vector space of the hidden layer is obtained, and the error between the mapping vectors is calculated, that is, the measurement error obtained by the feature error measurement module in the figure; and the feature vectors representing the tuned text fusion features and the visual features are transferred to the vector space where the text label vector is located through the fully connected layer MFC_V2 and the fully connected layer MFC_T2, and the error between the tuned text fusion features, the tuned visual fusion features, and the text label vector is calculated, that is, the measurement error obtained by the label error measurement module in the figure.
[0161] Finally, according to the obtained visual manifold mapping error, text manifold mapping error, various metric errors, and preset sample annotations, the model parameters of the model to be trained are adjusted to realize model training.
[0162] See also Figure 5 In one embodiment of the present invention, a flowchart of an information retrieval method is provided, the method comprising the following steps S501-S502:
[0163] Step S501: obtaining text features of multiple units of information in the retrieved text and visual features of multiple units of information in the video data.
[0164] Among them, the modalities of retrieving text and video data are different.
[0165] The method of obtaining text features and visual features is similar to that of obtaining sample text features and sample visual features in the aforementioned step S101. The only difference is the replacement of the names and concepts such as text features and sample text features, visual features and sample visual features, retrieval text and sample retrieval text, video data and sample video data, which will not be described in detail here.
[0166] Step S502: Input each text feature and each visual feature into the retrieval model to detect whether the video data is the retrieval result of the retrieval text.
[0167] Among them, the retrieval model is: a model trained according to the model training method of any one of the above embodiments.
[0168] Specifically, when the retrieval model makes a judgment on the retrieval results, it can obtain the fusion features of each text feature and the fusion features of each visual feature, calculate the similarity between the feature vectors representing the obtained fusion features as the similarity between the retrieval text and the video data, and use the video data with a similarity higher than a preset threshold as the retrieval result of the retrieval text.
[0169] Among them, the similarity coefficients between the feature vectors representing the fusion features of each text feature and the fusion features of each visual feature in multiple vector spaces can be calculated, and weights can be assigned to all the similarity coefficients obtained, and linear weighted calculations can be performed to use the results as the similarity between the retrieved text and the video data.
[0170] As can be seen from the above, in the solution provided by the embodiment of the present invention, a retrieval model trained according to the model training method in the above embodiment is used. The retrieval model can learn the characteristics of the sample data of the retrieval results belonging to the sample retrieval text through training, and judge whether the video data has the characteristics of the retrieval results belonging to the retrieval text based on the text features and visual features of the input model, thereby determining whether the sample video data is the retrieval result of the retrieval text, thereby improving the accuracy of obtaining the retrieval results.
[0171] See also Figure 6 In one embodiment of the present disclosure, a schematic diagram of the structure of a model training device is provided, including:
[0172] A sample feature acquisition module 601 is used to obtain sample text features of multiple unit information in a sample search text and sample visual features of multiple unit information in a sample video data;
[0173] The initial fusion feature acquisition module 602 is used to input each sample text feature and each sample visual feature into the initial model to detect whether the sample video data is the search result of the sample search text, and obtain the initial text fusion feature after the initial model fuses each sample text feature and the initial visual fusion feature after the initial model fuses each sample visual feature during the detection process;
[0174] The optimized fusion feature acquisition module 603 is used to input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the search result of the sample search text, and obtain the optimized text fusion feature after the model to be trained fuses each sample text feature and the optimized visual fusion feature after the model to be trained fuses each sample visual feature in the detection process, wherein the model to be trained is: a model obtained by pre-training the initial model;
[0175] A mapping error obtaining module 604 is used to obtain a text feature mapping error between the initial text fusion feature and the optimized text fusion feature, and a visual feature mapping error between the initial visual fusion feature and the optimized visual fusion feature;
[0176] The model parameter adjustment module 605 is used to adjust the model parameters of the model to be trained based on the text feature mapping error, the visual feature mapping error and the sample annotation, wherein the sample annotation represents the annotation information of whether the sample video data is the retrieval result of the sample retrieval text.
[0177] It can be seen from the above that when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the sample annotation that characterizes whether the sample video data is the retrieval result of the sample retrieval text is taken into consideration. In this way, through training, the model to be trained can learn the characteristics of the sample video data that is the retrieval result of the sample retrieval text, thereby enabling the above-mentioned model to have the ability to detect whether the video data is the retrieval result of the retrieval text.
[0178] In addition, when the solution provided by the embodiment of the present invention is applied to train the model to be trained, the situation that the model to be trained before starting the training, that is, the initial model, fuses features in the process of responding to the retrieval request is also considered. Specifically, the mapping error between the fused features obtained after the initial model and the model to be trained fuse the same features is used to constrain the training process of the model to be trained, so that after the parameters of the model to be trained are adjusted, the model still has a feature fusion capability similar to that of the initial model, which can effectively reduce the model performance fluctuation introduced by the model training process.
[0179] In one embodiment of the present invention, the device further comprises:
[0180] A metric error obtaining module, used for obtaining a metric error of a retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text according to the tuned text fusion feature and the tuned visual fusion feature before the model parameter adjustment module adjusts the model parameters of the to-be-trained model based on the text feature mapping error, the visual feature mapping error and the sample annotation;
[0181] The model parameter adjustment module 605 is specifically used to adjust the model parameters of the to-be-trained model based on the text feature mapping error, the visual feature mapping error, the metric error and the sample annotation.
[0182] It can be seen from the above that in the solution provided by the embodiment of the present invention, the metric error obtained by tuning the text fusion features and the tuned visual fusion features is used when adjusting the model parameters, so that after adjusting the model parameters, the metric error obtained by tuning the text fusion features and the tuned visual fusion features is more consistent with the expected error between the tuned text fusion features and the tuned visual fusion features. In this case, it is more accurate to use the tuned text fusion features and the tuned visual fusion features to judge the relationship between the sample retrieval text and the sample video data.
[0183] In one embodiment of the present invention, the metric error obtaining module includes:
[0184] A metric error calculation unit, used to calculate the difference between the tuned text fusion feature and the tuned visual fusion feature as a metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text;
[0185] and / or
[0186] The metric error obtaining unit is used to obtain the distribution characteristics reflecting the frequency distribution of unit information in the sample retrieval text, and obtain the metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text based on the distribution characteristics, the tuned text fusion characteristics and the tuned visual fusion characteristics.
[0187] As can be seen from the above, in the solution provided by the embodiment of the present invention, different implementation methods are used to calculate the metric error. In one implementation method, the difference between the tuned text fusion feature and the tuned visual fusion feature is calculated as the metric error, so that after the parameters are adjusted according to the metric error, the tuned text fusion feature and the tuned visual fusion feature obtained by the training model are more accurate in indicating whether the sample video data is the retrieval result of the sample retrieval text; in another implementation method, the distribution feature is used when calculating the metric error. The distribution feature retains the frequency distribution of the unit information in the sample retrieval text, and does not use all the feature information in all the unit information, so that the distribution feature has a lower feature dimension, and the calculation complexity is lower when the distribution feature is used to calculate the metric error; in another implementation method, the metric errors calculated by the above two methods are used at the same time to generate the total metric error, so that the information referenced to generate the metric error is more sufficient and the calculated error is more accurate.
[0188] In one embodiment of the present invention, the metric error obtaining unit is specifically used to obtain distribution features that reflect the frequency distribution of unit information in the sample retrieval text; based on the difference between the distribution features and the tuned text fusion features, and the difference between the distribution features and the tuned visual fusion features, generate the metric error of the retrieval result of the trained model to detect whether the sample video data is the sample retrieval text.
[0189] It can be seen from the above that in the solution provided by the embodiment of the present invention, distribution features are used in the process of generating metric errors. Because the feature dimension of the distribution features is relatively low, when the difference between the distribution features and the third fusion features is calculated through linear transformation, the feature dimension of the third fusion feature is consistent with the feature dimension of the distribution features. Similarly, the feature dimension of the fourth fusion feature is consistent with the feature dimension of the distribution features. Each feature for calculating the metric error has a relatively low feature dimension, thereby reducing the computational complexity.
[0190] In one embodiment of the present invention, the mapping error obtaining module 604 includes:
[0191] A text feature mapping error obtaining unit is used to map the initial text fusion feature to a preset manifold space to obtain an initial text mapping feature, and map the tuned text fusion feature to the manifold space to obtain a tuned text mapping feature; based on the difference between the initial text mapping feature and the tuned text mapping feature, obtain the text feature mapping error between the initial text fusion feature and the tuned text fusion feature.
[0192] As can be seen from the above, in the solution provided by the embodiment of the present invention, a transformation matrix is used to calculate the text feature mapping error. The transformation matrix is used to transform the third feature vector into a text feature vector, which reflects the degree of change of the tuned text fusion feature and the initial text fusion feature. By minimizing the text feature mapping error during training, the degree of change represented by the transformation matrix can be reduced accordingly, thereby ensuring the similarity between the initial text fusion feature and the tuned text fusion feature. Because the initial text fusion feature represents the fusion feature of the initial model, and the tuned text fusion feature represents the fusion feature output by the model to be trained, this solution can ensure that the feature fusion capability of the initial model is similar to the feature fusion capability of the model to be trained, thereby improving the stability of model training.
[0193] In one embodiment of the present invention, the text feature mapping error obtaining unit is specifically used to: map the initial text fusion feature to a preset manifold space to obtain an initial text mapping feature, and map the tuned text fusion feature to the manifold space to obtain a tuned text mapping feature; determine a transformation relationship from the initial text mapping feature to the tuned text mapping feature; and generate a text feature mapping error between the initial text fusion feature and the tuned text fusion feature based on the initial text mapping feature, the tuned text mapping feature and the transformation relationship.
[0194] As can be seen from the above, in the solution provided by the embodiment of the present invention, the transformation relationship between the mapping features corresponding to the tuned text fusion features and the initial text fusion features is used, so that the difference between the mapping features can be referred to when calculating the loss. Because the mapping features obtained in the manifold space can accurately retain the original fusion features, the difference between the mapping features represented by the transformation relationship from the initial text mapping features to the tuned text mapping features can accurately reflect the error between the tuned text fusion features and the initial text fusion features, thereby increasing the reliability of the calculation error.
[0195] See also Figure 7 In one embodiment of the present invention, a schematic diagram of the structure of an information retrieval device is provided, including:
[0196] A feature acquisition module 701 is used to acquire text features of multiple units of information in the retrieved text and visual features of multiple units of information in the video data;
[0197] The retrieval result detection module 702 is used to input each text feature and each visual feature into a retrieval model to detect whether the video data is the retrieval result of the retrieval text; wherein the retrieval model is: a model trained by the device described in any one of the above embodiments.
[0198] As can be seen from the above, in the solution provided by the embodiment of the present invention, a retrieval model trained according to the model training method in the above embodiment is used. The retrieval model can learn the characteristics of the sample data of the retrieval results belonging to the sample retrieval text through training, and judge whether the video data has the characteristics of the retrieval results belonging to the retrieval text based on the text features and visual features of the input model, thereby determining whether the sample video data is the retrieval result of the retrieval text, thereby improving the accuracy of obtaining the retrieval results.
[0199] The embodiment of the present invention further provides an electronic device, such as Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.
[0200] Memory 803, used for storing computer programs;
[0201] The processor 801 is used to implement the steps of the aforementioned model training method or the steps of the aforementioned information retrieval method when executing the program stored in the memory 803.
[0202] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0203] The communication interface is used for communication between the above electronic device and other devices.
[0204] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0205] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0206] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the model training and information retrieval method described in any of the above embodiments is implemented.
[0207] In another embodiment provided by the present invention, a computer program product containing instructions is also provided, which, when executed on a computer, enables the computer to execute the model training and information retrieval methods described in any one of the above embodiments.
[0208] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0209] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover 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 also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0210] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0211] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A model training method, characterized in that: The method comprises: Obtaining sample text features of multiple units of information in a sample search text and sample visual features of multiple units of information in sample video data; Input each sample text feature and each sample visual feature into the initial model to detect whether the sample video data is the search result of the sample search text, and obtain the initial text fusion feature after the initial model fuses each sample text feature and the initial visual fusion feature after the initial model fuses each sample visual feature during the detection process; Input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the search result of the sample search text, and obtain the tuned text fusion feature after the model to be trained fuses each sample text feature and the tuned visual fusion feature after the model to be trained fuses each sample visual feature in the detection process, wherein the model to be trained is: a model obtained by pre-training the initial model; Obtaining a text feature mapping error between the initial text fusion feature and the tuned text fusion feature, and a visual feature mapping error between the initial visual fusion feature and the tuned visual fusion feature; Adjusting the model parameters of the model to be trained based on the text feature mapping error, the visual feature mapping error and the sample annotation, wherein the sample annotation is annotation information representing whether the sample video data is a retrieval result of the sample retrieval text; The step of obtaining a text feature mapping error between the initial text fusion feature and the optimized text fusion feature includes: Mapping the initial text fusion feature to a preset manifold space to obtain an initial text mapping feature, and mapping the optimized text fusion feature to the manifold space to obtain an optimized text mapping feature; Determining a transformation relationship from the initial text mapping feature to the optimized text mapping feature; A text feature mapping error between the initial text fusion feature and the optimized text fusion feature is generated according to the initial text fusion feature, the optimized text fusion feature and the transformation relationship.
2. The method according to claim 1, characterized in that Before adjusting the model parameters of the to-be-trained model based on the text feature mapping error, the visual feature mapping error and the sample annotation, the method further includes: Obtaining, according to the tuned text fusion feature and the tuned visual fusion feature, a metric error of a retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text; The adjusting the model parameters of the to-be-trained model based on the text feature mapping error, the visual feature mapping error and the sample annotation includes: Based on the text feature mapping error, the visual feature mapping error, the metric error and the sample annotation, the model parameters of the model to be trained are adjusted.
3. The method according to claim 2, characterized in that The step of obtaining the metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text according to the tuned text fusion feature and the tuned visual fusion feature comprises: Calculating the difference between the tuned text fusion feature and the tuned visual fusion feature as a metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text; and / or A distribution feature reflecting the frequency distribution of unit information in the sample retrieval text is obtained, and based on the distribution feature, the tuned text fusion feature and the tuned visual fusion feature, a metric error of the retrieval result of the trained model detecting whether the sample video data is the sample retrieval text is obtained.
4. The method according to claim 3, characterized in that The step of obtaining the metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text according to the distribution feature, the optimized text fusion feature and the optimized visual fusion feature comprises: Based on the difference between the distribution feature and the tuned text fusion feature, and the difference between the distribution feature and the tuned visual fusion feature, a metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text is generated.
5. An information retrieval method, characterized in that: The method comprises: Obtaining text features of multiple units of information in the retrieved text and visual features of multiple units of information in the video data; Input each text feature and each visual feature into a retrieval model to detect whether the video data is a retrieval result of the retrieval text; wherein the retrieval model is: a model trained according to the method described in any one of claims 1-4.
6. A model training device, characterized in that: The device comprises: A sample feature acquisition module, used to obtain sample text features of multiple unit information in the sample search text, and sample visual features of multiple unit information in the sample video data; An initial fusion feature acquisition module is used to input each sample text feature and each sample visual feature into an initial model to detect whether the sample video data is a retrieval result of the sample retrieval text, and obtain an initial text fusion feature after the initial model fuses each sample text feature and an initial visual fusion feature after the initial model fuses each sample visual feature during the detection process; The module for obtaining optimized fusion features is used to input each sample text feature and each sample visual feature into the model to be trained to detect whether the sample video data is the search result of the sample search text, and obtain the optimized text fusion feature after the model to be trained fuses each sample text feature and the optimized visual fusion feature after the model to be trained fuses each sample visual feature in the detection process, wherein the model to be trained is: a model obtained by pre-training the initial model; A mapping error obtaining module, used to obtain a text feature mapping error between the initial text fusion feature and the tuned text fusion feature, and a visual feature mapping error between the initial visual fusion feature and the tuned visual fusion feature; A model parameter adjustment module, used to adjust the model parameters of the to-be-trained model based on the text feature mapping error, the visual feature mapping error and the sample annotation, wherein the sample annotation is annotation information indicating whether the sample video data is a retrieval result of the sample retrieval text; Wherein, the mapping error obtaining module includes: A text feature mapping error obtaining unit is used to map the initial text fusion feature to a preset manifold space to obtain an initial text mapping feature, and map the tuned text fusion feature to the manifold space to obtain a tuned text mapping feature; determine a transformation relationship from the initial text mapping feature to the tuned text mapping feature; and generate a text feature mapping error between the initial text fusion feature and the tuned text fusion feature according to the initial text mapping feature, the tuned text mapping feature and the transformation relationship.
7. The device according to claim 6, characterized in that The device also includes: A metric error obtaining module, used for obtaining a metric error of a retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text according to the tuned text fusion feature and the tuned visual fusion feature before the model parameter adjustment module adjusts the model parameters of the to-be-trained model based on the text feature mapping error, the visual feature mapping error and the sample annotation; The model parameter adjustment module is specifically used to adjust the model parameters of the model to be trained based on the text feature mapping error, the visual feature mapping error, the metric error and the sample annotation.
8. The device according to claim 7, characterized in that The measurement error obtaining module includes: A metric error calculation unit, used to calculate the difference between the tuned text fusion feature and the tuned visual fusion feature as a metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text; and / or The metric error obtaining unit is used to obtain the distribution characteristics reflecting the frequency distribution of unit information in the sample retrieval text, and obtain the metric error of the retrieval result of the to-be-trained model detecting whether the sample video data is the sample retrieval text based on the distribution characteristics, the tuned text fusion characteristics and the tuned visual fusion characteristics.
9. The device according to claim 8, characterized in that The metric error obtaining unit is specifically used to obtain distribution features that reflect the frequency distribution of unit information in the sample retrieval text; based on the difference between the distribution features and the tuned text fusion features, and the difference between the distribution features and the tuned visual fusion features, generate the metric error of the retrieval result of the trained model to detect whether the sample video data is the sample retrieval text.
10. An information retrieval device, characterized in that: The device comprises: A feature acquisition module, used to acquire text features of multiple unit information in the retrieved text and visual features of multiple unit information in the video data; A retrieval result detection module is used to input each text feature and each visual feature into a retrieval model to detect whether the video data is the retrieval result of the retrieval text; wherein the retrieval model is: a model trained by the device according to any one of claims 6-9.
11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 5 when executing a program stored in a memory.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Image-text mutual retrieval method based on complementary semantic alignment and symmetric retrieval
CN109255047A
End-to-end training method and application of image feature module in visual question-answering system
CN111814843A
