Image-text data processing method and apparatus, and device, storage medium and program product
By constructing a unified visual text representation space and introducing semantic relevance constraints, multi-language image and text weakly aligned data samples are used for feature extraction and model training, which solves the problem of relying on strictly aligned data in the existing technology and improves the accuracy of the model. and generalization ability.
Patent Information
- Application Number
- PCT/CN2023/134353
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-26
- Filing Date
- 2023-11-27
- Publication Date
- 2024-10-31
AI Technical Summary
Existing cross-modal language machine learning models rely on strictly aligned image-text pairs during the training process, which limits the scope of data utilization and the generalization ability of the model, and lacks methods to effectively utilize weakly aligned multi-language image and text data. .
By constructing a unified visual text representation space, using weakly aligned data samples of multi-language images and texts for feature extraction and model training, the semantic correlation between texts is introduced as a constraint to expand the training data of the model and improve the accuracy of the model.
Effectively utilizing weakly aligned multilingual image and text data improves the accuracy of the unified visual text representation space and the generalization ability of the model, and enhances the ability to extract semantic features from image and text data.
Smart Images

Figure CN2023134353_31102024_PF_FP_ABST
Abstract
Description
Graphical data processing method, device, equipment, storage medium and program product
[0001] This application claims priority to the Chinese patent application filed on April 26, 2023, with application number 202310477720.6 and invention name “Graphic and text data processing method, device, equipment, storage medium and program product”, all contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, storage medium and program product for processing graphic and text data. Background Art
[0003] With the continuous development of AI technology, the application of cross-modal language machine learning models has received increasing attention.
[0004] In related technologies, cross-modal language machine learning models are typically trained using image-text pairs. Specifically, developers pre-collect multilingual image-text pairs as training data to train cross-modal language machine learning models. For the same image, there are corresponding descriptions in multiple languages, and these texts in multiple languages are translations of each other.
[0005] Summary of the Invention
[0006] The present application provides a method, apparatus, device, storage medium, and program product for processing graphic data. The technical solution is as follows:
[0007] In one aspect, a method for processing graphic data is provided, the method comprising:
[0008] Acquire first image and text data, where the first image and text data includes at least one image and at least one text;
[0009] Performing feature extraction on the first image-text data to map the first image-text data to a unified visual text representation space to obtain data features of the first image-text data; the unified visual text representation space is a feature space constructed based on the first image-text data sample and constrained by the semantic relevance between texts in the first image-text data sample; the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other;
[0010] The data features of the first graphic data are sent to a task processing component, and the task processing component outputs a processing result of a target task based on the data features; the target task is a classification or regression task based on the graphic data.
[0011] In one aspect, a method for processing graphic data is provided, the method comprising:
[0012] Constructing a first anchor sample, a first positive sample, and a first negative sample based on a first image-text data sample; the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other;
[0013] Inputting the first anchor sample, the first positive sample, and the first negative sample into a second feature extraction model to obtain a first sample feature output by the second feature extraction model;
[0014] Based on the first sample feature, and with the semantic relevance between texts in the first graphic and text data sample as a constraint, obtaining a first loss function value;
[0015] Updating parameters of the second feature extraction model using the first loss function value;
[0016] In response to the second feature extraction model satisfying the convergence condition, a first feature extraction model is constructed based on the second feature extraction model; the first feature extraction model is used to process the input first graphic data to obtain data features of the first graphic data, and the data features of the first graphic data are processed by the task processing component to output the processing results of the target task; the target task is a classification or regression task based on graphic data.
[0017] In another aspect, a device for processing graphic and text data is provided, the device comprising:
[0018] A data acquisition module, configured to acquire first graphic and text data, wherein the first graphic and text data includes at least one picture and at least one text;
[0019] a feature mapping module configured to extract features from the first image-text data to map the first image-text data to a unified visual text representation space to obtain data features of the first image-text data; the unified visual text representation space is a feature space constructed based on the first image-text data sample and constrained by the semantic relevance between texts in the first image-text data sample; the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other;
[0020] The task processing module is used to send the data features of the first graphic data to the task processing component, and the task processing component outputs the processing results of the target task based on the data features; the target task is a classification or regression task based on the graphic data.
[0021] In another aspect, a device for processing graphic and text data is provided, the device comprising:
[0022] a sample construction module, configured to construct a first anchor sample, a first positive sample, and a first negative sample based on a first image-text data sample; the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other;
[0023] a sample input module, configured to input the first anchor sample, the first positive sample, and the first negative sample into a second feature extraction model to obtain a first sample feature output by the second feature extraction model;
[0024] a loss calculation module, configured to obtain a first loss function value based on the first sample feature and with the semantic relevance between texts in the first graphic and text data sample as a constraint;
[0025] a parameter updating module, configured to update parameters of the second feature extraction model using the first loss function value;
[0026] A model construction module is used to construct a first feature extraction model based on the second feature extraction model in response to the second feature extraction model satisfying the convergence condition; the first feature extraction model is used to process the input first graphic data to obtain data features of the first graphic data, and the data features of the first graphic data are processed by the task processing component to output the processing results of the target task; the target task is a classification or regression task based on graphic data.
[0027] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the above-mentioned graphic data processing method.
[0028] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned graphic data processing method.
[0029] In another aspect, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the graphic data processing methods provided in the various optional implementations described above.
[0030] The technical solution provided by this application may have the following beneficial effects:
[0031] A unified visual text representation space is constructed using at least one first image sample and at least two text samples in different languages corresponding to the first image sample as training data. When performing an image and text data processing task, the image and text data is mapped to the unified visual text representation space, and the task processing result is output based on the data features obtained by the mapping through the task processing component. In the above scheme, on the one hand, since the at least two text samples in different languages corresponding to the first image sample are not translations of each other, it is possible to fully utilize multilingual image and text weak alignment data samples with large data volume and low acquisition difficulty, thereby expanding the construction data of the unified visual text representation space and improving the accuracy of the unified visual text representation space. On the other hand, in the process of constructing the unified visual text representation space, the semantic relevance between the texts in the image and text data samples is introduced as a constraint, so that the constructed unified visual text representation space can more accurately extract the semantic features of the input data, further improving the accuracy of the unified visual text representation space constructed by the first image sample and the corresponding text sample. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] FIG1 is a schematic diagram of a system used in the method for processing graphic and text data provided by the present application;
[0033] FIG2 is a schematic diagram of a strictly aligned multi-language image and text involved in this application;
[0034] FIG3 is a schematic diagram of a weakly aligned multilingual image and text involved in this application;
[0035] FIG4 is a flow chart of a method for processing graphic and text data according to an exemplary embodiment of the present application;
[0036] FIG5 is a flow chart of a method for processing graphic and text data according to an exemplary embodiment of the present application;
[0037] FIG6 is a flowchart of a method for processing graphic and text data according to an exemplary embodiment of the present application;
[0038] FIG7 is a schematic diagram of a network structure of a second feature extraction model involved in this application;
[0039] FIG8 is a schematic diagram of the smooth linear interpolation method involved in this application;
[0040] FIG9 is a schematic diagram of constrained cross-language visual-text contrastive learning involved in this application;
[0041] FIG10 is a schematic diagram of a network structure of a second feature extraction model involved in the present application;
[0042] FIG11 is a block diagram of a graphic data processing device provided by one embodiment of the present application;
[0043] FIG12 is a block diagram of a graphic data processing device provided by one embodiment of the present application;
[0044] FIG13 shows a structural block diagram of a computer device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0045] The embodiment of the present application provides a data processing method for images and texts. For ease of understanding, several terms involved in the present application are explained below.
[0046] 1) Strictly-aligned multilingual images and text
[0047] The so-called strict alignment of multilingual images and texts means that the image content and its corresponding descriptive text have a high semantic correlation, and the descriptive texts in multiple languages are also corresponding translations of each other; strict alignment of multilingual images and texts can also be called semantic parallelism, that is, the descriptive texts in multiple languages have the same semantics.
[0048] 2) Weakly-aligned multilingual graphics and text
[0049] The so-called weak alignment of multilingual images and text means that the image content and its corresponding descriptive text have a high semantic correlation, but the descriptive texts in multiple languages may not be translations of each other. Weak alignment of multilingual images and text can also be called semantically related but not parallel. That is, the descriptive texts in multiple languages are all related to the same image, but the semantics of the descriptive texts in multiple languages are different / not completely the same.
[0050] FIG1 shows a schematic diagram of a system used in a method for processing graphic and text data provided by an exemplary embodiment of the present application. As shown in FIG1 , the system includes a server 110 and a terminal 120 .
[0051] The server 110 may include a server that is deployed with a graphic data processing system and provides graphic data processing services to users through the graphic data processing system. Alternatively, the server 110 may also include a server that is deployed with a graphic data processing system and trains or updates the graphic data processing system.
[0052] The terminal 120 may include a user terminal for receiving graphic data processing services, or the terminal 120 may also include a development terminal used by developers of the graphic data processing system.
[0053] Optionally, a graphic data processing system may also be deployed in the terminal 120 .
[0054] Optionally, the above system includes one or more servers 110 and multiple terminals 120. The embodiment of the present application does not limit the number of servers 110 and terminals 120.
[0055] The terminal and the server are connected via a communication network. Optionally, the communication network is a wired network or a wireless network.
[0056] Cross-modal and cross-lingual models based on images and text have significant advantages in multimodal task processing. Consequently, pre-training of these models has received increasing attention in recent years. Typically, developers primarily train using image-text pairs with strictly aligned text and images in multiple languages. For example, developers can translate the predominantly English descriptive text in an image-text pair dataset into multiple languages, and design a series of cross-modal and cross-lingual pre-training tasks to enable the model to learn a better universal representation.
[0057] For example, please refer to Figure 2, which shows a schematic diagram of a strictly aligned multilingual image and text involved in this application. As shown in Figure 2, the strictly aligned multilingual image and text includes a picture 21, an English text 22 and a Chinese text 23; wherein the above-mentioned picture 21 and English text 22 can be pictures and texts collected in advance by developers, and the above-mentioned Chinese text 23 can be a text obtained by developers translating the English text 22 through translation tools.
[0058] The subsequent embodiments of this application propose an improved cross-modal and cross-lingual pre-training framework that can effectively utilize a large amount of multi-language weakly aligned multi-modal data that is more widely available and easier to collect. The weakly aligned multi-language images and text can be collected from the Internet.
[0059] For example, please refer to Figure 3, which shows a schematic diagram of a weakly aligned multilingual image and text involved in this application. As shown in Figure 3, the weakly aligned multilingual image and text includes a picture 31, an English text 32 and a Chinese text 33; wherein, the above-mentioned English text 32 and Chinese text 33 are description texts of the picture 31 in different languages obtained by developers when searching for the same picture 31 on the Internet with the help of automated retrieval tools.
[0060] FIG4 shows a flowchart of a method for processing graphic data according to an exemplary embodiment of the present application. The method is executed by a computer device, which may be implemented as a terminal or a server. The terminal or server may be the terminal or server shown in FIG1 . As shown in FIG4 , the method for processing graphic data includes the following steps:
[0061] Step 410: Acquire first image and text data, where the first image and text data includes at least one image and at least one text.
[0062] In an embodiment of the present application, the first image-text data may include at least one image-text pair, and each image-text pair is an image-text pair consisting of an image and a line of text.
[0063] Step 420: Perform feature extraction on the first image-text data to map the first image-text data to a unified visual text representation space to obtain data features of the first image-text data; the unified visual text representation space is a feature space constructed based on the first image-text data sample and with the semantic relevance between texts in the first image-text data sample as a constraint; the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other.
[0064] In an embodiment of the present application, the above-mentioned process of extracting features from the first graphic data is the process of mapping the first graphic data to a unified visual text representation space to obtain data features of the first graphic data; in other words, the step of mapping the first graphic data to a unified visual text representation space is achieved by extracting features from the first graphic data.
[0065] In machine learning, performing one or more feature mappings on raw input data yields a higher-dimensional abstract representation. This abstract representation is called the feature of the raw data in machine learning terms. The space formed by the features obtained from performing one or more feature mappings on all possible input data is called the feature space. In other words, the features in the feature space are a higher-dimensional representation of all possible input data.
[0066] The unified visual text representation space is a feature space used to uniformly represent two types of data: images and text.
[0067] In the embodiment of the present application, two different types of data, image and text, can be fused into a unified feature space (i.e., the unified visual text representation space mentioned above). The data features obtained by mapping the first image and text data into the unified visual text representation space can be expressed in the form of feature vectors or feature matrices.
[0068] Among them, the above-mentioned construction of a unified visual text representation space based on the first graphic and text data sample and with the semantic relevance between the texts in the first graphic and text data sample as a constraint may mean: when constructing a unified visual text representation space based on the first graphic and text data sample, the construction of a unified visual text representation space is carried out with the goal of reducing the semantic distance between the texts in the first graphic and text data sample (or increasing the semantic relevance).
[0069] The at least two text samples in different languages corresponding to the above-mentioned first image sample may mean that one first image sample corresponds to at least two text samples, and the at least two text samples belong to different languages (for example, Chinese, English, French, etc.), and the semantics of the at least two text samples are related to the first image sample.
[0070] In addition, the fact that the at least two text samples in different languages corresponding to the above-mentioned first image sample are not translations of each other may mean that the semantic features of the at least two text samples in different languages corresponding to the first image sample are different; for example, after translating the at least two text samples in different languages corresponding to the first image sample into the same language, semantic extraction is performed respectively to obtain semantic feature vectors of the translated text samples in at least two different languages, and then the similarity between these semantic feature vectors is calculated. If the similarity between any two of these semantic feature vectors is not greater than a certain similarity threshold, it can be considered that the at least two text samples in different languages corresponding to the first image sample are not translations of each other; for another example, after translating the at least two text samples in different languages corresponding to the first image sample into the same language, keyword extraction is performed respectively to obtain keywords after the translation of the text samples in at least two different languages. If the keywords after the translation of the text samples in at least two different languages are different, it can be considered that the at least two text samples in different languages corresponding to the first image sample are not translations of each other.
[0071] For example, suppose the image content of the first image sample is "There is a house at the foot of the mountain, and there are two puppies in front of the house." The first image sample has two text samples, one of which is in Chinese and is "There is a house at the foot of the mountain," and the other is in English and is "There are two puppies in front of the house." The semantics of these two text samples are the same as the first image sample, but the semantic features / keywords extracted after translating these two text samples into the same language are different. In other words, these two text samples are not translations of each other.
[0072] The first image and text data sample may be a multi-language image and text weakly aligned data sample.
[0073] Step 430: Send the data features of the first graphic data to the task processing component, and the task processing component outputs the processing result of the target task based on the data features; the target task is a classification or regression task based on the graphic data.
[0074] The above-mentioned task processing component can be a software module (machine learning model) set in the current computer device; at this time, the computer device can input the data features obtained by the above-mentioned mapping into the task processing component.
[0075] Alternatively, the task processing component may be a software module provided in another computer device other than the current computer device; in this case, the computer device may send the data features to the other computer device via a wired / wireless network, and the other computer device may input the data features into the task processing component.
[0076] In an embodiment of the present application, the data features obtained by mapping the first image and text data to the unified visual text representation space in the above step 420 can be used for any subsequent classification task or regression task based on images and texts.
[0077] Among them, the above-mentioned classification task refers to the task of outputting a classification probability after processing the above-mentioned data features; the above-mentioned regression task refers to the task of outputting an image / text / image-text pair, or outputting another data feature after processing the above-mentioned data features.
[0078] For example, the data features obtained by mapping the first image and text data to the unified visual text representation space are processed by the task processing component to output a classification probability (such as the probability of whether the image and text match, or the probability that the image belongs to a certain type, etc.), or output a regression result (such as outputting a reconstructed image, or outputting a reconstructed / translated text), etc. The embodiments of the present application do not limit the classification tasks or regression tasks implemented based on images and text.
[0079] To sum up, the scheme shown in the embodiment of the present application constructs a unified visual text representation space through at least one first image sample and at least two text samples in different languages corresponding to the first image sample as training data. When performing a graphic data processing task, the graphic data is mapped to the unified visual text representation space, and the task processing component outputs the processing result of the task based on the data features obtained by mapping. In the above scheme, on the one hand, since the at least two text samples in different languages corresponding to the first image sample are not translations of each other, it is possible to fully utilize the multi-language graphic and text weakly aligned data samples with large data volume and low acquisition difficulty, thereby expanding the construction data of the unified visual text representation space and improving the accuracy of the unified visual text representation space. On the other hand, in the process of constructing the unified visual text representation space, the semantic relevance between the texts in the graphic data samples is introduced as a constraint, so that the constructed unified visual text representation space can more accurately extract the semantic features of the input data, further improving the accuracy of the unified visual text representation space constructed by the first image sample and the corresponding text sample.
[0080] In the embodiment shown in FIG2 , the unified visual text representation space can be represented by a machine learning model. After the machine learning model is pre-trained using training data consisting of image-text pairs, it can process subsequently input image-text data to obtain data features of the image-text data in the unified visual text representation space.
[0081] Based on the embodiment shown in FIG4 , please refer to FIG5 , which shows a flowchart of a method for processing graphic data according to an exemplary embodiment of the present application. The method is executed by a computer device, which can be implemented as a terminal or a server. The terminal or server can be the terminal or server shown in FIG1 . As shown in FIG5 , the training and application process of the machine learning model for graphic data processing may include the following steps:
[0082] Step 510: Construct a first anchor point sample, a first positive sample, and a first negative sample based on the first image and text data sample.
[0083] The first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other.
[0084] In an embodiment of the present application, developers can pre-collect weakly aligned image and text data samples (i.e., the first image and text data samples mentioned above), and then construct the samples required for contrastive learning based on the first image and text data samples, including the first anchor point sample as the anchor point, the first positive example sample as the positive sample, and the first negative example sample as the negative sample.
[0085] The first positive sample refers to a sample that matches the first anchor sample feature, and the first negative sample refers to a sample that does not match the first anchor sample feature.
[0086] For example, when the first anchor sample includes a picture-text pair, the first positive sample and the first negative sample may also each include a picture-text pair, and the relationship between the picture and text in the first positive sample is similar to the relationship between the picture and text in the first anchor sample, and the relationship between the picture and text in the first negative sample is not similar to the relationship between the picture and text in the first anchor sample.
[0087] For example, the first anchor sample, the first positive sample, and the first negative sample respectively contain the same picture, and the first anchor sample, the first positive sample, and the first negative sample respectively contain different texts. The texts in the first anchor sample and the first positive sample are different, but the semantics of these two texts are similar to the semantics of the picture, while the semantics of the text in the first negative sample are not similar or relevant to the semantics of the picture.
[0088] For another example, when the first anchor sample contains a text, the first positive sample and the first negative sample may also contain a text respectively, and the text in the first positive sample is semantically similar to the text in the first anchor sample, while the text in the first negative sample is semantically different from the text in the first anchor sample.
[0089] Step 520: Input the first anchor point sample, the first positive sample, and the first negative sample into the second feature extraction model to obtain the first sample feature output by the second feature extraction model.
[0090] In an embodiment of the present application, the computer device can input the first anchor point sample, the first positive sample and the first negative sample into the second feature extraction model respectively, and the second feature model can process the first anchor point sample, the first positive sample and the first negative sample respectively, and output the sample features of the first anchor point sample, the first positive sample and the first negative sample respectively. The sample features of the first anchor point sample, the first positive sample and the first negative sample respectively can constitute the above-mentioned first sample features.
[0091] Step 530: Based on the first sample feature, and with the semantic relevance between texts in the first graphic and text data sample as a constraint, obtain a first loss function value.
[0092] In an embodiment of the present application, when a computer device generates a first loss function value based on a first sample feature, it may consider the semantic relevance between texts in the first graphic data sample. That is, the computer device may combine the first sample feature and the semantic relevance information between texts in the first graphic data sample to generate the above-mentioned first loss function value.
[0093] Among them, the semantic relevance information between the texts in the above-mentioned first graphic data sample can be calculated based on the first sample features; for example, the computer device can process the features related to the texts in the first anchor point sample, the first positive sample and the first negative sample in the above-mentioned first sample features to obtain the semantic relevance information between the texts in the first anchor point sample, the first positive sample and the first negative sample.
[0094] The semantic relevance mentioned above may refer to the degree of semantic similarity between two or more texts.
[0095] The process of obtaining the first loss function value by the computer device based on the first sample feature and taking the semantic relevance between texts in the first graphic and text data sample as a constraint may include:
[0096] The computer device generates a part of the loss function value based on the first sample feature in a comparative learning manner, and then generates another part of the loss function value based on the semantic relevance information. Then, the two parts of the loss function value are added or weighted together to obtain the above-mentioned first loss function value.
[0097] Step 540: Update the parameters of the second feature extraction model using the first loss function value.
[0098] In an embodiment of the present application, since the calculation process of the first loss function value takes into account the semantic relevance information between the texts in the first anchor sample, the first positive sample, and the first negative sample, it can support training using weakly aligned image and text data samples, thereby enabling the training data available to the second feature extraction model to be extended to weakly aligned image and text data samples, thereby achieving the effect of expanding the training data of the model, and more training data helps to improve the accuracy of model training.
[0099] Step 550: In response to the second feature extraction model satisfying the convergence condition, constructing the first feature extraction model based on the second feature extraction model.
[0100] Among them, the first feature extraction model is used to process the input first graphic data to obtain the data features of the first graphic data. The data features of the first graphic data are processed by the task processing component and then the processing results of the target task are output; the target task is a classification or regression task based on the graphic data.
[0101] That is to say, the above-mentioned first feature extraction model is a machine learning network constructed based on the second feature extraction model; the second feature extraction model is a machine learning model obtained by machine learning training based on the first image and text data sample and with the semantic relevance between the texts in the first image and text data sample as a constraint.
[0102] In a possible implementation, the second feature extraction model can be directly used as the first feature extraction model deployed in the application for feature extraction of graphic and text data.
[0103] In another possible implementation, developers may also improve the second feature extraction model through computer equipment, and use the improved second feature extraction model as the first feature extraction model deployed in the application for feature extraction of graphic and text data.
[0104] For example, developers can use computer equipment to optimize the second feature extraction model to obtain the above-mentioned first feature extraction model. For example, developers can use computer equipment to retrain the second feature extraction model to make it more suitable for a specific graphic data processing business; for another example, developers can use computer equipment to simplify the second feature extraction model (such as pruning, distillation, etc.) to obtain a lightweight first feature extraction model, thereby improving the processing speed of the model.
[0105] Step 560: Acquire first image and text data, where the first image and text data includes at least one image and at least one text.
[0106] After the first feature extraction model is applied and deployed, the computer device on which the first feature extraction model is deployed can execute the graphic data processing task. At this time, the computer device can obtain the first graphic data to be processed.
[0107] In a possible implementation, the first image-text data may include several image-text pairs.
[0108] Step 570: Input the first image-text data into the first feature extraction model to obtain data features of the first image-text data output by the first feature extraction model.
[0109] The first feature extraction model is used to map the features of the input graphic and text data to a unified visual text representation space.
[0110] In one possible implementation, the computer device may assign several image-text pairs in the first image-text data to the above-mentioned first feature extraction model respectively, so that the first feature extraction model processes the image-text pairs and outputs the data features of the first image-text data.
[0111] Step 580: Send the data features of the first graphic data to the task processing component, and the task processing component outputs the processing result of the target task based on the data features; the target task is a classification or regression task based on the graphic data.
[0112] In which, the above embodiment involves the training process of the second feature extraction model (steps 510 to 540), the construction process of the first feature extraction model (step 550), and the application process of the first feature extraction model (steps 560 to 580); the above three processes can be executed by different computer devices respectively; or, two of the above three processes can be executed by one computer device, and the other process can be executed by another computer device; or, the above three processes can be executed by the same computer device.
[0113] In an embodiment of the present application, the computer device maps the input first graphic data to a unified visual text representation space through a pre-trained first feature extraction model, thereby improving the accuracy of the feature mapping and further improving the accuracy of the processing results of subsequent target tasks.
[0114] In an embodiment of the present application, the computer device can train the second feature extraction model through comparative learning based on the first anchor point sample, the first positive sample and the first negative sample constructed by the first graphic data sample.
[0115] In a possible implementation, the above-mentioned first anchor point sample includes a first anchor point image and text sample and a first anchor point text sample; the first positive sample includes at least one first positive image and text sample and at least one first positive text sample; the first negative sample includes at least one first negative image and text sample and at least one first negative text sample.
[0116] The first anchor image-text sample, the first positive image-text sample, and the first negative image-text sample each contain a picture-text pair, and the first anchor image-text sample, the first positive image-text sample, and the first negative image-text sample contain the same first picture; the text in the first positive image-text sample and the text in the first anchor image-text sample are semantically matched with the first picture, respectively, and the text in the first negative image-text sample does not semantically match the first picture; the first anchor text sample contains the text in the first anchor image-text sample, the first positive text sample contains the text in the first positive image-text sample, and the first negative text sample contains the text in the first negative image-text sample.
[0117] Based on the embodiment shown in FIG5 , please refer to FIG6 , which shows a flowchart of a method for processing graphic data according to an exemplary embodiment of the present application. As shown in FIG6 , step 520 in the embodiment shown in FIG5 can be implemented as steps 520a and 520b, and step 530 can be implemented as steps 530a to 530d:
[0118] Step 520a: Input the first anchor image and text sample, the first positive image and text sample, and the first negative image and text sample into the second feature extraction model to obtain sample features of the first anchor image and text sample, the first positive image and text sample, and the first negative image and text sample.
[0119] In an embodiment of the present application, a computer device used to train a second feature extraction model can input the first anchor image and text sample, the first positive image and text sample, and the first negative image and text sample into the second feature extraction model respectively, and the second feature extraction model outputs the sample features of the first anchor image and text sample, the first positive image and text sample, and the first negative image and text sample respectively.
[0120] In one possible implementation, the second feature extraction model may include at least one feature extraction network; when at least two feature extraction networks are included, the network structures and parameters of the at least two feature extraction networks may be the same or different. For example, all or part of the at least two feature extraction networks may be connected sequentially, or connected in a residual manner, or connected in a cross manner, or connected in a cyclic manner, etc. The embodiment of the present application does not limit the connection method between the feature extraction networks.
[0121] For example, please refer to Figure 7, which shows a schematic diagram of the network structure of a second feature extraction model involved in an embodiment of the present application. As shown in Figure 7, the second feature extraction model can be divided into a text feature extraction branch 701, a picture feature extraction branch 702, and a feature fusion branch 703 according to the function; after the computer device inputs a picture-text pair into the second feature extraction model, the picture (or picture sample) in the picture-text pair (or picture-text sample pair) will be input into the picture feature extraction branch 702 to obtain picture features (or picture sample features), the text (or text sample) in the picture-text pair (or picture-text sample pair) will be input into the text feature extraction branch 701 to obtain text features (or text sample features), the above-mentioned picture features (or picture sample features) and text features (or text sample features) will be input into the feature fusion branch 703 to obtain the data features (or data sample features) output by the model.
[0122] Among them, the above Figure 7 only shows a possible network structure of the second feature extraction model in an exemplary manner. Optionally, the above second feature extraction model can also adopt other structures, such as other connection structures, other network branch division methods, etc.
[0123] Step 520b: Input the first anchor text sample, the first positive text sample, and the first negative text sample into the second feature extraction model to obtain sample features of the first anchor text sample, the first positive text sample, and the first negative text sample.
[0124] In an embodiment of the present application, the above-mentioned second feature extraction model may include a text feature extraction network (such as the text feature extraction branch 701 in Figure 7 above), and the computer device may input the above-mentioned first anchor text sample, the first positive text sample and the first negative text sample into the above-mentioned text feature extraction network respectively to obtain the sample features of the above-mentioned first anchor text sample, the first positive text sample and the first negative text sample respectively.
[0125] Step 530a: Based on the sample features of the first anchor image-text sample, the sample features of the first positive image-text sample, the sample features of the first negative image-text sample, the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample, obtain semantic relevance information; the semantic relevance information is used to indicate the semantic relevance between texts in the first image-text data sample.
[0126] In the above embodiment, the sample features of the first anchor text sample, the first positive text sample and the first negative text sample are text-related features, and the sample features of the first anchor image-text sample, the first positive image-text sample and the first negative image-text sample also include some text-related features. In this regard, the computer device can combine the sample features of the image-text sample and the sample features of the text sample to calculate the semantic relevance between the texts in the first image-text data sample.
[0127] Step 530b: Generate a semantic relevance loss function value based on the semantic relevance information.
[0128] In one possible implementation, the acquiring of semantic relevance information based on the sample features of the first anchor image-text sample, the sample features of the first positive image-text sample, the sample features of the first negative image-text sample, the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample includes:
[0129] Normalizing the sample features of the first anchor image and text sample, the sample features of the first positive example image and text sample, and the sample features of the first negative example image and text sample to obtain first relevance distribution information in the semantic relevance information;
[0130] Normalization processing is performed on the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample to obtain second relevance distribution information in the semantic relevance information.
[0131] In an embodiment of the present application, the computer device can calculate the semantically relevant correlation distribution information of each data type according to the data type corresponding to the feature (graphic data or plain text data) through normalization processing; specifically, the computer device can calculate the semantically relevant correlation distribution information of the graphic data based on the sample features of the first anchor graphic sample, the first positive graphic sample, and the first negative graphic sample; in addition, the computer device can also calculate the semantically relevant correlation distribution information of the plain text data based on the sample features of the first anchor text sample, the first positive text sample, and the first negative text sample. These two types of correlation distribution information constitute the above-mentioned semantic correlation information.
[0132] The above-mentioned generation of the semantic relevance loss function value based on the semantic relevance information includes: calculating the KL divergence of the first relevance distribution information and the second relevance distribution information to obtain the semantic relevance loss function value.
[0133] In an embodiment of the present application, a computer device can calculate the KL divergence of the first correlation distribution information and the second correlation distribution information, thereby fusing the first correlation distribution information and the second correlation distribution information into a semantic correlation loss function value to characterize the semantic correlation between the texts in the first graphic data sample, thereby realizing the construction of a semantic correlation-related loss function value, and further realizing the expansion of the training data available to the second feature extraction model to weakly aligned graphic data samples.
[0134] Alternatively, the computer device may also obtain semantic relevance information in other ways. For example, the computer device may first fuse the sample features of the first anchor image and text sample and the sample features of the first anchor text sample. For example, the sample features of the first anchor image and text sample and the sample features of the first anchor text sample are spliced and then fused through a fusion network (for example, the fusion network may include a fully connected layer, a convolutional layer, a pooling layer, and other network layers) to obtain fused anchor sample features. Similarly, the computer device may fuse the sample features of the first positive image and text sample and the sample features of the first positive text sample to obtain fused positive sample features. The computer device may fuse the sample features of the first negative image and text sample and the sample features of the first negative text sample to obtain fused negative sample features. Then, the computer device calculates the above-mentioned semantic relevance information based on the fused anchor sample features, the fused positive sample features, and the fused negative sample features. At this time, the computer device may calculate the semantic relevance loss function value based on the above-mentioned semantic relevance information.
[0135] Step 530c: Generate a first contrastive learning loss function value based on the sample features of the first anchor image-text sample, the sample features of the first positive image-text sample, and the sample features of the first negative image-text sample.
[0136] In an embodiment of the present application, in addition to the semantic relevance loss function value, the computer device can also combine the sample features of the first anchor image and text sample, the sample features of the first positive image and text sample, and the sample features of the first negative image and text sample to generate a first contrastive learning loss function value through contrastive learning to improve the accuracy of subsequent model training.
[0137] Step 530d: Obtain a first loss function value based on the semantic relevance loss function value and the first contrastive learning loss function value.
[0138] In an embodiment of the present application, the computer device can combine the semantic relevance loss function value and the first comparative learning loss function value to calculate the first loss function value. For example, the computer device can add the semantic relevance loss function value and the first comparative learning loss function value, or perform weighted summation to obtain the above-mentioned first loss function value; the weight of the above-mentioned weighted summation can be pre-set by the developer.
[0139] In the scheme shown in the embodiment of the present application, the computer device can calculate the semantic relevance loss function value through the features of the input text-related samples, and then obtain the first loss function value in combination with the loss function value of contrastive learning, and further update the parameters of the second feature extraction model through the first loss function value, so as to use the semantic relevance between the texts in the first graphic data sample as a constraint and integrate it into the model training process, so that the training data available to the second feature extraction model can be extended to the weakly aligned graphic data samples, thereby achieving the effect of expanding the training data of the model, and more training data helps to improve the accuracy of model training.
[0140] In a possible implementation, the method further includes:
[0141] Generate a second loss function value based on the sample feature of the first anchor text sample, the sample feature of the first positive text sample, and the sample feature of the first negative text sample;
[0142] The parameters of the second feature extraction model are updated using the second loss function value.
[0143] In an embodiment of the present application, the computer device can also update the parameters of the second feature extraction model based solely on the sample features of the text sample to expand the training data of the second feature extraction model and improve the extraction effect of the second feature extraction model.
[0144] For example, still taking Figure 7 as an example, after the computer device inputs the first anchor text sample, the first positive text sample and the first negative text sample into the text feature extraction branch 701, and obtains the sample features of the first anchor text sample, the sample features of the first positive text sample and the sample features of the first negative text sample, in addition to calculating the above-mentioned first loss function value, it can also calculate the second loss function value through comparative learning based solely on the sample features of the first anchor text sample, the sample features of the first positive text sample and the sample features of the first negative text sample, and update the parameters of the second feature extraction model through the second loss function value, for example, update the parameters of the text feature extraction branch in the second feature extraction model through the second loss function value.
[0145] In a possible implementation, the method further includes:
[0146] A second anchor image-text sample, a second positive image-text sample, and a second negative image-text sample are constructed based on the second image-text data sample; the second image-text data sample includes at least one second image sample, and at least two text samples in different languages corresponding to the second image sample, and the at least two text samples in different languages corresponding to the second image sample are translations of each other; the second anchor image-text sample, the second positive image-text sample, and the second negative image-text sample each include an image-text pair, and the second anchor image-text sample, the second positive image-text sample, and the second negative image-text sample each include the same second image; the text in the second positive image-text sample and the text in the second anchor image-text sample each match the semantics of the second image, and the text in the second negative image-text sample does not match the semantics of the second image;
[0147] Inputting the second anchor image and text sample, the second positive image and text sample, and the second negative image and text sample into the second feature extraction model to obtain sample features of the second anchor image and text sample, sample features of the second positive image and text sample, and sample features of the second negative image and text sample;
[0148] Generate a third loss function value based on the sample features of the second anchor image and text sample, the sample features of the second positive image and text sample, and the sample features of the second negative image and text sample;
[0149] The parameters of the second feature extraction model are updated using the third loss function value.
[0150] In an embodiment of the present application, in addition to training the second feature model through the weakly aligned first image and text data samples, the computer device can also train the second feature model through the strictly aligned second image and text data samples. The process of training the second feature model through the second image and text data samples, compared with the process of training the second feature model through the weakly aligned first image and text data samples, subtracts the calculation process of the semantic relevance loss function value. The calculation process of the above-mentioned third loss function value is similar to the calculation process of the first contrastive learning loss function value, and will not be repeated here.
[0151] In the embodiment of the present application, a constrained cross-lingual visual text contrastive learning (Regularized Cross-lingual Visio-textual Contrastive Learning, R-XVtCL) task can be used to base on a multilingual weakly aligned image-text pair dataset (i.e., the first image-text data sample mentioned above, with D wOptionally, this task can also involve a strictly aligned image-text pair dataset of multiple languages (i.e., the first image-text data sample above, represented by D s express).
[0152] Optionally, the embodiment of the present application can also train the second machine learning model through a cross-lingual textual contrastive learning (XTCL) task.
[0153] The XTCL task aims to obtain meaningful textual representations (TRs) for multilingual text in a Universal Textual Representation Space (UTRS). In this UTRS space, representations of texts with high semantic relevance should be close together, while representations of texts with low relevance should be far apart. This application performs contrastive learning in the UTRS space, enabling the model to produce representations that satisfy these properties.
[0154] Specifically, given a multilingual text dataset D containing large-scale parallel language pairs t , sample a batch from it For B t A parallel pair in by The text representation is used as an anchor in UTRS, denoted as tr * .because and The texts expressed have the same semantics, so the corresponding texts are represented as tr + As UTRS space for tr * For example, other sentences x from the same batch - The text representation of tr - (x - ) is taken as a negative example. So the objective function of XTCL can be written as:
[0155] in Representative for For the negative example set, and Represents the positive example representation tr in UTRS space + And negative examples represent tr - (x - ) to the anchor point represents tr* The Euclidean distance.
[0156] In the constrained cross-lingual visual-text contrastive learning task during the pre-training phase, in addition to using Euclidean distance to measure the similarity between positive and negative examples and anchor points, other text relevance measurement methods can also be used, such as cosine similarity between feature vectors. In other words, the above-mentioned Euclidean distance can be replaced by cosine similarity.
[0157] Among them, the negative example representation obtained by the above method may not be difficult enough for the model to perform comparative learning and training, and cannot enable the model to learn a more informative and effective text representation in the UTRS space. At this time, the solution shown in the embodiment of the present application can also use a negative example representation generation method based on smooth linear interpolation to generate negative examples that are more difficult and more difficult to distinguish. For example, for A negative example x in - , which itself represents the text of tr - (x - ) through the anchor point representation tr * The interpolation is converted into a UTRS space for tr * For example, the more difficult negative text representation Referring to the schematic diagram of the smooth linear interpolation method shown in FIG8 , the specific construction method can be written as the following formula:
[0158] The λ in the above formula is calculated by the following formula:
[0159] Where ζ is a pre-set scaling factor, is the log-probability obtained in the 100 steps before the current training step The average probability value after calculation. The significance of this interpolation method is that when the difficulty of the negative example is too low, will rise, and λ will fall, which will bring about the - (x′) more difficult negative examples This enables the model to learn more meaningful image-text representations in the UTRS space.
[0160] Among them, the goal of the R-XVtCL task is to enable the model to learn meaningful representations for multilingual visual text input in a unified visual text representation space (Universal Visio-textual Representation Space, UVtRS) through contrastive learning.
[0161] For ease of understanding, we first consider contrastive learning on Strictly-aligned multilingual image-text pair data, given from D s A batch of bilingual parallel visual text triplets For one of the triples make Splice with v respectively, The representation after splicing the input to the model encoder is used as the anchor point representation vtr in the UVtRS space * ,and Because with Represents the same visual text semantics, its visual text representation vtr + In UVtRS space, it can be used as a positive example with vtr * For the construction of negative examples, this application uses the same training batch B vt Another set of multilingual visual-text triplets The negative examples are divided into the following three types: (1) The image input is the same, but the text input comes from a different image The description text of and (2) with The pictures are different, but the text input is the description text from v, i.e. and (3) with The images and texts of and With the above positive and negative examples, this application performs comparative learning in the UVtRS space through a smooth linear interpolation method similar to the previous pre-training task. The objective function can be written as:
[0162] Among them, N(v′,x′) is a set of negative examples constructed from the three above. and Respectively represent the positive example representation vtr in UVtRS space + And each negative example (v′, x′) corresponds to the interpolated representation To the anchor point represents vtr * The Euclidean distance.
[0163] However, in the above process of contrastive learning using “Strictly-aligned” image-text data, we will vtr + Considered necessary with vtr *However, this relationship will produce deviations on data that only satisfy the "weakly-aligned" relationship, that is, the semantics of descriptive texts in different languages corresponding to the same image may be related to a certain extent but not equivalent. In this case, simply vtr + and vtr * It is unreasonable to directly close them. This requires us to be able to measure the semantic similarity between multilingual texts in order to more effectively capture the semantic relationship between them in the UVtRS space, thereby obtaining a better visual text representation. Therefore, on the "Weakly-aligned" multilingual image-text data, this application uses the text semantic relevance between multilingual description texts to impose additional constraints on the above comparative learning process. For the semantic relevance of any two texts, this application measures it through the Euclidean distance between the text representations in the UTRS space learned in the XVTCL task, that is, the smaller the corresponding distance, the more relevant the text semantics.
[0164] Specifically, given from D w Two multilingual visual text triplets in a batch of bilingual parallel visual text triplets and First of all, for and Calculate and Each with The Euclidean distance between text representations in UTRS space is denoted as and but and Each with The semantic relevance of and The larger the value, the higher the correlation. and Normalized into a correlation distribution P in UTRS space tr ,in:
[0165] At the same time, select Image-text pairs with the same image input but different description texts include and Similarly, the visual text representation of each is calculated and its The Euclidean distance in UVtRS space is expressed as and After that, normalization is performed in a similar way to obtain the correlation distribution P in the UVtRS space. vtr ,in:
[0166] We then use KL divergence to bring the two distributions closer together and train them together with the conventional contrastive learning objective, which is constrained cross-lingual visual-text contrastive learning, which can be expressed as:
[0167] Finally, the synthesis comes from D s and D w The training instance is shown in Figure 9, which is a schematic diagram of constrained cross-lingual visual text contrast learning. The training objective of R-XVtCL can be written as follows:
[0168] For example, please refer to Figure 10, which shows a schematic diagram of the network structure of a second feature extraction model involved in an embodiment of the present application. In the process of training the second feature model based on weakly aligned graphic data samples, as shown in Figure 10, the second feature extraction model can be divided into a text feature extraction branch 1001, an image feature extraction branch 1002 and a feature fusion branch 1003 according to function; the computer device pre-collects graphic data samples 1004, including weakly aligned first graphic data samples, and constructs input samples based on the graphic data samples 1004, including: constructing a first anchor graphic sample, a first anchor text sample, a first positive graphic sample, a first positive text sample, a first negative graphic sample and a first negative text sample based on the first graphic data sample.
[0169] Then, the computer device inputs the text in the constructed input sample into the text feature extraction branch 1001 to obtain sample features 1005 of the input text, including sample features of the first anchor text sample, the first positive text sample, and the first negative text sample; inputs the picture in the text in the constructed input sample into the picture feature extraction branch 1002 to obtain sample features 1006 of the input picture; the sample features 1005 and the sample features 1006 are input into the feature fusion branch 1003 to obtain sample features 1007, including sample features of the first anchor text sample, the first positive text sample, the first positive text sample, and the first negative text sample.
[0170] Then, on the one hand, the computer device generates first correlation distribution information 1008 through sample features 1007, and generates second correlation distribution information 1009 through sample features 1006, and generates a correlation loss function value 1010 based on the first correlation distribution information 1008 and the second correlation distribution information 1009; on the other hand, the computer device generates a first comparative learning loss function value 1011 through sample features 1007, and then generates a first loss function value 1012 through the correlation loss function value 1010 and the first comparative learning loss function value 1011; finally, the computer device updates the parameters of the second feature extraction model through the first loss function value 1012.
[0171] In a possible implementation, the method further includes:
[0172] Constructing a first image-text sample and a translation annotation of the first image-text sample based on the third image-text data sample; the third image-text data sample includes at least one third image sample and at least two text samples in different languages corresponding to the third image sample, and the at least two text samples in different languages corresponding to the second image sample are translations of each other; the first image-text sample includes the third image sample and a text sample corresponding to the first image sample; the translation annotation includes another text sample corresponding to the third image sample;
[0173] After partially masking the text sample in the first image and text sample, the mask is input into a second feature extraction model to obtain a first sample feature and a second sample feature of the first image and text sample output by the second feature extraction model;
[0174] Inputting the first sample feature into the first output network to obtain a first prediction result output by the first output network, wherein the first prediction result is used to indicate a predicted text of a masked portion of the text sample in the first image-text sample;
[0175] Inputting the second sample feature into the second output network to obtain a second prediction result output by the second output network, wherein the second prediction result is used to indicate a predicted text of the translation annotation;
[0176] Generate a fourth loss function value based on the first prediction result and the masked portion of the text sample in the first image-text sample;
[0177] generating a fifth loss function value based on the second prediction result and the translation annotation;
[0178] Based on the fourth loss function value and the fifth loss function value, parameters of the second feature extraction model are updated.
[0179] In an embodiment of the present application, the computer device updates the parameters of the second feature extraction model by combining the image translation task, so as to expand the training data and training method of the second feature extraction model and improve the extraction effect of the second feature extraction model.
[0180] In an embodiment of the present application, the second feature extraction model may also be trained through a masked conditional language model (MCLM) training task.
[0181] MCLM consists of the standard Masked Language Modeling (MLM) task on the source language encoder side and the Conditional Language Modeling (CLM) task on the target language decoder side. i and language j Image description text and Each word in has a 15% probability of being replaced by a special [MASK] token. On the encoder side, the training target of MLM is based on the image v and Unmasked words in To predict all masked words It can be written in the following form:
[0182] Among them D s Represents a multi-language image-text pair dataset with strict alignment of images and texts, θ e Represents the trainable parameters of the model encoder. On the decoder side, this application also trains the model to decode and generate in an autoregressive manner based on the visual text input on the encoder side through the CLM target. The form can be written as:
[0183] where θ d Represents the trainable parameters of the model decoder. Combining the objectives of both the encoder and decoder, the overall MCLM objective can be written as L MCLM =L mlm +L clm .
[0184] In a possible implementation, the method further includes:
[0185] Obtain a third positive example image-text sample and a third negative example image-text sample; the third positive example image-text sample includes a semantically matching image-text pair, and the third negative example image-text sample includes a semantically mismatched image-text pair;
[0186] Inputting the third positive example image and text sample and the third negative example image and text sample into the second feature extraction model to obtain the sample features of the third positive example image and text sample and the sample features of the third negative example image and text sample output by the second feature extraction model;
[0187] Inputting the sample features of the third positive example image and text sample and the sample features of the third negative example image and text sample into the third output network, and obtaining the semantic matching probability of the third positive example image and text sample and the semantic matching probability of the third negative example image and text sample output by the third output network;
[0188] Generate a sixth loss function value based on the semantic matching probability of the third positive example image-text sample and the semantic matching probability of the third negative example image-text sample;
[0189] Based on the sixth loss function value, the parameters of the second feature extraction model are updated.
[0190] In the embodiment of the present application, the second feature extraction model can also be trained through an image-text matching (ITM) task.
[0191] In an embodiment of the present application, the computer device updates the parameters of the second feature extraction model by combining the task of image-text matching prediction to expand the training data and training method of the second feature extraction model and improve the extraction effect of the second feature extraction model.
[0192] The goal of the ITM task is to judge the given image input v and text input x l Is it a matching image-text pair? The objective function can be written as:
[0193] where y∈{0, 1} represents the text x l Whether it matches the image v, is to combine v and x l After concatenation, the data is fed into the model encoder. The final layer representation corresponding to the first special marker [CLS] is passed through a fully connected linear mapping layer and a sigmoid activation layer to obtain a score between 0 and 1. Positive examples are strictly aligned images and text, while negative examples are randomly selected from the same training batch with misaligned image and text pairs.
[0194] That is to say, the above embodiment of the present application proposes a pre-training framework for more effectively utilizing a large amount of multi-language weakly aligned multi-modal data. The entire training process can include four pre-training objectives: Masked Conditional Language Modelling (MCLM), Image-Text Matching (ITM), Cross-lingual Textual Contrastive Learning (XTCL), and Regularized Cross-lingual Visio-textual Contrastive Learning (R-XVtCL). Through the four pre-training tasks, the above embodiment enables the model to learn better visual text representations in a unified cross-modal and cross-lingual vector representation space, thereby increasing the effect of improving a series of downstream visual text tasks.
[0195] FIG11 shows a block diagram of a graphic data processing apparatus according to an exemplary embodiment of the present application. The apparatus can be used to execute all or part of the steps in the method shown in FIG4 , FIG5 , or FIG6 . As shown in FIG11 , the apparatus includes:
[0196] The data acquisition module 1101 is configured to acquire first graphic and text data, where the first graphic and text data includes at least one picture and at least one text;
[0197] A feature mapping module 1102 is configured to perform feature extraction on the first image-text data to map the first image-text data to a unified visual text representation space to obtain data features of the first image-text data; the unified visual text representation space is a feature space constructed based on the first image-text data sample and constrained by the semantic relevance between texts in the first image-text data sample; the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other;
[0198] The task processing module 1103 is used to send the data features of the first graphic data to the task processing component, and the task processing component outputs the processing results of the target task based on the data features; the target task is a classification or regression task based on the graphic data.
[0199] In a possible implementation, the feature mapping module 1102 is configured to:
[0200] Inputting the first graphic data into a first feature extraction model to obtain data features of the first graphic data output by the first feature extraction model;
[0201] The first feature extraction model is a machine learning network constructed based on the second feature extraction model; the second feature extraction model is a machine learning model obtained by machine learning training based on the first image and text data sample and with the semantic relevance between the texts in the first image and text data sample as a constraint.
[0202] In a possible implementation, the device further includes: a model training module, configured to:
[0203] Constructing a first anchor point sample, a first positive sample, and a first negative sample based on the first image and text data sample;
[0204] Inputting the first anchor sample, the first positive sample, and the first negative sample into the second feature extraction model to obtain a first sample feature output by the second feature extraction model;
[0205] Based on the first sample feature, and with the semantic relevance between texts in the first graphic and text data sample as a constraint, obtaining a first loss function value;
[0206] Parameters of the second feature extraction model are updated using the first loss function value.
[0207] In a possible implementation, the first anchor sample includes a first anchor image-text sample and a first anchor text sample; the first positive sample includes at least one first positive image-text sample and at least one first positive text sample; the first negative sample includes at least one first negative image-text sample and at least one first negative text sample;
[0208] The first anchor image-text sample, the first positive image-text sample, and the first negative image-text sample each include a picture-text pair, and the first anchor image-text sample, the first positive image-text sample, and the first negative image-text sample include the same first picture; the text in the first positive image-text sample and the text in the first anchor image-text sample are semantically matched with the first picture, and the text in the first negative image-text sample does not semantically match the first picture; the first anchor text sample includes the text in the first anchor image-text sample, the first positive text sample includes the text in the first positive image-text sample, and the first negative text sample includes the text in the first negative image-text sample;
[0209] The model training module is used to:
[0210] Inputting the first anchor image and text sample, the first positive image and text sample, and the first negative image and text sample into the second feature extraction model to obtain sample features of the first anchor image and text sample, sample features of the first positive image and text sample, and sample features of the first negative image and text sample;
[0211] Inputting the first anchor text sample, the first positive text sample, and the first negative text sample into the second feature extraction model to obtain sample features of the first anchor text sample, sample features of the first positive text sample, and sample features of the first negative text sample;
[0212] Acquire semantic relevance information based on the sample features of the first anchor image-text sample, the sample features of the first positive image-text sample, the sample features of the first negative image-text sample, the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample; the semantic relevance information is used to indicate the semantic relevance between texts in the first image-text data sample;
[0213] generating a semantic relevance loss function value based on the semantic relevance information;
[0214] generating a first contrastive learning loss function value based on the sample features of the first anchor image-text sample, the sample features of the first positive example image-text sample, and the sample features of the first negative example image-text sample;
[0215] The first loss function value is obtained based on the semantic relevance loss function value and the first contrastive learning loss function value.
[0216] In a possible implementation, the model training module is used to:
[0217] Normalizing the sample features of the first anchor image and text sample, the sample features of the first positive example image and text sample, and the sample features of the first negative example image and text sample to obtain first relevance distribution information in the semantic relevance information;
[0218] Normalizing the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample to obtain second relevance distribution information in the semantic relevance information;
[0219] The KL divergence is calculated for the first relevance distribution information and the second relevance distribution information to obtain the semantic relevance loss function value.
[0220] In a possible implementation, the model training module is used to:
[0221] generating a second loss function value based on the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample;
[0222] Parameters of the second feature extraction model are updated using the second loss function value.
[0223] In a possible implementation, the model training module is used to:
[0224] A second anchor image-text sample, a second positive image-text sample, and a second negative image-text sample are constructed based on the second image-text data sample; the second image-text data sample includes at least one second image sample, and at least two text samples in different languages corresponding to the second image sample, and the at least two text samples in different languages corresponding to the second image sample are translations of each other; the second anchor image-text sample, the second positive image-text sample, and the second negative image-text sample each include an image-text pair, and the second anchor image-text sample, the second positive image-text sample, and the second negative image-text sample each include the same second image; the text in the second positive image-text sample and the text in the second anchor image-text sample are respectively semantically matched with the second image, and the text in the second negative image-text sample does not semantically match the second image;
[0225] Inputting the second anchor image and text sample, the second positive image and text sample, and the second negative image and text sample into the second feature extraction model to obtain sample features of the second anchor image and text sample, sample features of the second positive image and text sample, and sample features of the second negative image and text sample;
[0226] Generate a third loss function value based on the sample features of the second anchor image and text sample, the sample features of the second positive example image and text sample, and the sample features of the second negative example image and text sample;
[0227] Parameters of the second feature extraction model are updated using the third loss function value.
[0228] In a possible implementation, the model training module is used to:
[0229] Constructing a first image-text sample and a translation annotation of the first image-text sample based on a third image-text data sample; the third image-text data sample includes at least one third image sample and at least two text samples in different languages corresponding to the third image sample, and the at least two text samples in different languages corresponding to the second image sample are translations of each other; the first image-text sample includes the third image sample and a text sample corresponding to the first image sample; the translation annotation includes another text sample corresponding to the third image sample;
[0230] After partially masking the text sample in the first image and text sample, the masked text sample is input into the second feature extraction model to obtain a first sample feature and a second sample feature of the first image and text sample output by the second feature extraction model;
[0231] Inputting the first sample feature into a first output network to obtain a first prediction result output by the first output network, wherein the first prediction result is used to indicate a predicted text of a masked portion of the text sample in the first image-text sample;
[0232] Inputting the second sample feature into a second output network to obtain a second prediction result output by the second output network, wherein the second prediction result is used to indicate a predicted text of the translation annotation;
[0233] generating a fourth loss function value based on the first prediction result and the masked portion of the text sample in the first image-text sample;
[0234] generating a fifth loss function value based on the second prediction result and the translation annotation;
[0235] Based on the fourth loss function value and the fifth loss function value, parameters of the second feature extraction model are updated.
[0236] In a possible implementation, the model training module is used to:
[0237] Obtaining a third positive example image-text sample and a third negative example image-text sample; the third positive example image-text sample includes a semantically matching image-text pair, and the third negative example image-text sample includes a semantically mismatched image-text pair;
[0238] Inputting the third positive example image and text sample and the third negative example image and text sample into the second feature extraction model to obtain the sample features of the third positive example image and text sample and the sample features of the third negative example image and text sample output by the second feature extraction model;
[0239] Inputting the sample features of the third positive example image and text sample and the sample features of the third negative example image and text sample into a third output network, and obtaining the semantic matching probability of the third positive example image and text sample and the semantic matching probability of the third negative example image and text sample output by the third output network;
[0240] generating a sixth loss function value based on the semantic matching probability of the third positive example image-text sample and the semantic matching probability of the third negative example image-text sample;
[0241] Based on the sixth loss function value, parameters of the second feature extraction model are updated.
[0242] FIG12 shows a block diagram of a graphic data processing device according to an exemplary embodiment of the present application. The device can be used to execute all or part of the steps in the method shown in FIG5 or FIG6. As shown in FIG12 , the device includes:
[0243] A sample construction module 1201 is configured to construct a first anchor sample, a first positive sample, and a first negative sample based on a first image-text data sample, wherein the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other;
[0244] A sample input module 1202 is configured to input the first anchor sample, the first positive sample, and the first negative sample into a second feature extraction model to obtain first sample features output by the second feature extraction model;
[0245] A loss calculation module 1203 is configured to obtain a first loss function value based on the first sample feature and with the semantic relevance between texts in the first graphic and text data sample as a constraint;
[0246] A parameter updating module 1204 is configured to update parameters of the second feature extraction model using the first loss function value;
[0247] The model construction module 1205 is used to construct a first feature extraction model based on the second feature extraction model in response to the second feature extraction model satisfying the convergence condition; the first feature extraction model is used to process the input first graphic data to obtain the data features of the first graphic data, and the data features of the first graphic data are processed by the task processing component to output the processing results of the target task; the target task is a classification or regression task based on graphic data.
[0248] Figure 13 shows a block diagram of a computer device 1300 shown in an exemplary embodiment of the present application. The computer device can be implemented as a server or terminal in the above-mentioned solution of the present application. In this embodiment, the computer device is described as a server. The computer device 1300 includes a central processing unit (CPU) 1301, a system memory 1304 including a random access memory (RAM) 1302 and a read-only memory (ROM) 1303, and a system bus 1305 connecting the system memory 1304 and the central processing unit 1301. The computer device 1300 also includes a mass storage device 1306 for storing an operating system 1309, application programs 1310, and other program modules 1311.
[0249] The mass storage device 1306 is connected to the central processing unit 1301 via a mass storage controller (not shown) connected to the system bus 1305. The mass storage device 1306 and its associated computer-readable media provide non-volatile storage for the computer device 1300. In other words, the mass storage device 1306 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM drive.
[0250] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, tape cassettes, magnetic tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above-mentioned ones. The above-mentioned system memory 1304 and mass storage device 1306 can be collectively referred to as memory.
[0251] According to various embodiments of the present disclosure, the computer device 1300 can also be connected to a remote computer on a network such as the Internet for operation. That is, the computer device 1300 can be connected to the network via the network interface unit 1307 connected to the system bus 1305, or the network interface unit 1307 can be used to connect to other types of networks or remote computer systems (not shown).
[0252] The memory further includes at least one computer program, which is stored in the memory. The central processing unit 1301 implements all or part of the steps in the methods shown in the above embodiments by executing the at least one computer program.
[0253] In an exemplary embodiment, a computer-readable storage medium is further provided, storing at least one computer program. The at least one computer program is loaded and executed by a processor to implement all or part of the steps of the methods described in the above embodiments. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, or an optical data storage device.
[0254] In an exemplary embodiment, a computer program product is also provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform all or part of the steps of the methods described in the various embodiments above.
Claims
1. A method for processing graphic data, the method being executed by a computer device, the method comprising: Acquire first image and text data, where the first image and text data includes at least one image and at least one text; Performing feature extraction on the first image-text data to map the first image-text data to a unified visual text representation space to obtain data features of the first image-text data; the unified visual text representation space is a feature space constructed based on the first image-text data sample and with the semantic relevance between texts in the first image-text data sample as a constraint; the first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other; The data features of the first graphic data are sent to a task processing component, and the task processing component outputs a processing result of a target task based on the data features; the target task is a classification or regression task based on the graphic data.
2. According to the method of claim 1, the extracting features of the first graphic data to map the first graphic data to a unified visual text representation space to obtain data features of the first graphic data comprises: Inputting the first graphic data into a first feature extraction model to obtain data features of the first graphic data output by the first feature extraction model; The first feature extraction model is a machine learning network constructed based on the second feature extraction model; the second feature extraction model is a machine learning model obtained by machine learning training based on the first image and text data sample and with the semantic relevance between texts in the first image and text data sample as a constraint.
3. The method according to claim 2, further comprising: Constructing a first anchor point sample, a first positive sample, and a first negative sample based on the first graphic data sample; Inputting the first anchor point sample, the first positive sample, and the first negative sample into the second feature extraction model to obtain a first sample feature output by the second feature extraction model; Based on the first sample feature, taking the semantic relevance between texts in the first graphic data sample as a constraint, obtaining a first loss function value; The parameters of the second feature extraction model are updated according to the first loss function value.
4. According to the method of claim 3, the first anchor sample comprises a first anchor image-text sample and a first anchor text sample; the first positive sample comprises at least one first positive image-text sample and at least one first positive text sample; the first negative sample comprises at least one first negative image-text sample and at least one first negative text sample; The first anchor image-text sample, the first positive example image-text sample, and the first negative example image-text sample each include a picture-text pair, and the first anchor image-text sample, the first positive example image-text sample, and the first negative example image-text sample include the same first picture; the text in the first positive example image-text sample and the text in the first anchor image-text sample are semantically matched with the first picture, respectively, and the text in the first negative example image-text sample does not semantically match the first picture; the first anchor text sample includes the text in the first anchor image-text sample, the first positive example text sample includes the text in the first positive example image-text sample, and the first negative example text sample includes the text in the first negative example image-text sample; The step of inputting the first anchor sample, the first positive sample, and the first negative sample into the second feature extraction model to obtain the first sample feature output by the second feature extraction model includes: Inputting the first anchor image and text sample, the first positive image and text sample, and the first negative image and text sample into the second feature extraction model to obtain sample features of the first anchor image and text sample, sample features of the first positive image and text sample, and sample features of the first negative image and text sample; Inputting the first anchor text sample, the first positive text sample, and the first negative text sample into the second feature extraction model to obtain sample features of the first anchor text sample, sample features of the first positive text sample, and sample features of the first negative text sample; The obtaining of a first loss function value based on the first sample feature and taking the semantic relevance between texts in the first graphic data sample as a constraint includes: Based on the sample features of the first anchor image-text sample, the sample features of the first positive image-text sample, the sample features of the first negative image-text sample, the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample, semantic relevance information is acquired; the semantic relevance information is used to indicate the semantic relevance between texts in the first image-text data sample; Generate a semantic relevance loss function value based on the semantic relevance information; Generate a first contrastive learning loss function value based on the sample features of the first anchor image-text sample, the sample features of the first positive example image-text sample, and the sample features of the first negative example image-text sample; The first loss function value is obtained based on the semantic relevance loss function value and the first contrastive learning loss function value.
5. According to the method of claim 4, the acquiring semantic relevance information based on the sample features of the first anchor image-text sample, the sample features of the first positive image-text sample, the sample features of the first negative image-text sample, the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample comprises: Normalizing the sample features of the first anchor image and text sample, the sample features of the first positive example image and text sample, and the sample features of the first negative example image and text sample to obtain first relevance distribution information in the semantic relevance information; Normalizing the sample features of the first anchor text sample, the sample features of the first positive example text sample, and the sample features of the first negative example text sample to obtain second relevance distribution information in the semantic relevance information; The generating a semantic relevance loss function value based on the semantic relevance information includes: The KL divergence is calculated for the first relevance distribution information and the second relevance distribution information to obtain the semantic relevance loss function value.
6. The method according to claim 4 or 5, further comprising: Generate a second loss function value based on the sample features of the first anchor text sample, the sample features of the first positive example text sample, and the sample features of the first negative example text sample; The parameters of the second feature extraction model are updated according to the second loss function value.
7. The method according to any one of claims 2 to 6, further comprising: Constructing a second anchor image and text sample, a second positive example image and text sample, and a second negative example image and text sample based on the second image and text data sample; The second image-text data sample includes at least one second image sample and at least two text samples in different languages corresponding to the second image sample, and the at least two text samples in different languages corresponding to the second image sample are translations of each other; the second anchor image-text sample, the second positive example image-text sample, and the second negative example image-text sample each include an image-text pair, and the second anchor image-text sample, the second positive example image-text sample, and the second negative example image-text sample each include the same second image; the text in the second positive example image-text sample and the text in the second anchor example image-text sample each match the semantics of the second image, and the text in the second negative example image-text sample does not match the semantics of the second image; Inputting the second anchor image and text sample, the second positive image and text sample, and the second negative image and text sample into the second feature extraction model to obtain sample features of the second anchor image and text sample, sample features of the second positive image and text sample, and sample features of the second negative image and text sample; Generate a third loss function value based on the sample features of the second anchor image and text sample, the sample features of the second positive example image and text sample, and the sample features of the second negative example image and text sample; The parameters of the second feature extraction model are updated according to the third loss function value.
8. The method according to any one of claims 2 to 7, further comprising: constructing a first image-text sample based on the third image-text data sample, and a translation annotation of the first image-text sample; The third image-text data sample includes at least one third image sample, and at least two text samples in different languages corresponding to the third image sample, and the at least two text samples in different languages corresponding to the second image sample are translations of each other; The first image-text sample includes the third image sample and a text sample corresponding to the first image sample; the translation annotation includes another text sample corresponding to the third image sample; After partially masking the text sample in the first image and text sample, the mask is input into the second feature extraction model to obtain the first sample feature and the second sample feature of the first image and text sample output by the second feature extraction model; Inputting the first sample feature into a first output network to obtain a first prediction result output by the first output network, wherein the first prediction result is used to indicate a predicted text of a masked portion of a text sample in the first image-text sample; Inputting the second sample feature into a second output network to obtain a second prediction result output by the second output network, wherein the second prediction result is used to indicate a predicted text of the translation annotation; Generate a fourth loss function value based on the first prediction result and the masked portion of the text sample in the first image-text sample; Based on the second prediction result and the translation annotation, generating a fifth loss function value; Based on the fourth loss function value and the fifth loss function value, parameters of the second feature extraction model are updated.
9. The method according to any one of claims 2 to 8, further comprising: Obtaining a third positive example image and text sample and a third negative example image and text sample; The third positive example image-text sample includes a semantically matching image-text pair, and the third negative example image-text sample includes a semantically mismatched image-text pair; Inputting the third positive example image and text sample and the third negative example image and text sample into the second feature extraction model to obtain sample features of the third positive example image and text sample and sample features of the third negative example image and text sample output by the second feature extraction model; Inputting the sample features of the third positive example image and text sample and the sample features of the third negative example image and text sample into a third output network, and obtaining the semantic matching probability of the third positive example image and text sample and the semantic matching probability of the third negative example image and text sample output by the third output network; Generate a sixth loss function value based on the semantic matching probability of the third positive example image and text sample and the semantic matching probability of the third negative example image and text sample; Based on the sixth loss function value, parameters of the second feature extraction model are updated.
10. A method for processing graphic data, the method being executed by a computer device, the method comprising: Constructing a first anchor point sample, a first positive sample, and a first negative sample based on the first image and text data sample; The first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other; Inputting the first anchor point sample, the first positive sample, and the first negative sample into a second feature extraction model to obtain a first sample feature output by the second feature extraction model; Based on the first sample feature, taking the semantic relevance between texts in the first graphic data sample as a constraint, obtaining a first loss function value; Performing parameter update on the second feature extraction model according to the first loss function value; In response to the second feature extraction model satisfying the convergence condition, a first feature extraction model is constructed based on the second feature extraction model; the first feature extraction model is used to process the input first graphic data to obtain data features of the first graphic data, and the data features of the first graphic data are processed by the task processing component to output the processing results of the target task; the target task is a classification or regression task based on graphic data.
11. A graphic data processing device, the device comprising: A data acquisition module, used to acquire first graphic data, wherein the first graphic data includes at least one picture and at least one text; A feature mapping module is used to extract features from the first graphic data to map the first graphic data to a unified visual text representation space to obtain data features of the first graphic data; the unified visual text representation space is a feature space constructed based on the first graphic data sample and with the semantic relevance between the texts in the first graphic data sample as a constraint; the first graphic data sample includes at least one first picture sample, and the first picture sample corresponding to at least two text samples in different languages, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other; The task processing module is used to send the data features of the first graphic data to the task processing component, and the task processing component outputs the processing results of the target task based on the data features; the target task is a classification or regression task based on the graphic data.
12. The apparatus according to claim 11, wherein the feature mapping module is used to: Inputting the first graphic data into a first feature extraction model to obtain data features of the first graphic data output by the first feature extraction model; The first feature extraction model is a machine learning network constructed based on the second feature extraction model; the second feature extraction model is a machine learning model obtained by machine learning training based on the first image and text data sample and with the semantic relevance between texts in the first image and text data sample as a constraint.
13. The device according to claim 12, further comprising: Model training module, used to Constructing a first anchor point sample, a first positive sample, and a first negative sample based on the first graphic data sample; Inputting the first anchor point sample, the first positive sample, and the first negative sample into the second feature extraction model to obtain a first sample feature output by the second feature extraction model; Based on the first sample feature, taking the semantic relevance between texts in the first graphic data sample as a constraint, obtaining a first loss function value; The parameters of the second feature extraction model are updated according to the first loss function value.
14. The apparatus according to claim 13, wherein the first anchor sample comprises a first anchor image-text sample and a first anchor text sample; the first positive sample comprises at least one first positive image-text sample and at least one first positive text sample; the first negative sample comprises at least one first negative image-text sample and at least one first negative text sample; The first anchor image-text sample, the first positive example image-text sample, and the first negative example image-text sample each include a picture-text pair, and the first anchor image-text sample, the first positive example image-text sample, and the first negative example image-text sample include the same first picture; the text in the first positive example image-text sample and the text in the first anchor image-text sample are semantically matched with the first picture, respectively, and the text in the first negative example image-text sample does not semantically match the first picture; the first anchor text sample includes the text in the first anchor image-text sample, the first positive example text sample includes the text in the first positive example image-text sample, and the first negative example text sample includes the text in the first negative example image-text sample; The model training module is used to: Inputting the first anchor image and text sample, the first positive image and text sample, and the first negative image and text sample into the second feature extraction model to obtain sample features of the first anchor image and text sample, sample features of the first positive image and text sample, and sample features of the first negative image and text sample; Inputting the first anchor text sample, the first positive text sample, and the first negative text sample into the second feature extraction model to obtain sample features of the first anchor text sample, sample features of the first positive text sample, and sample features of the first negative text sample; Based on the sample features of the first anchor image-text sample, the sample features of the first positive image-text sample, the sample features of the first negative image-text sample, the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample, semantic relevance information is acquired; the semantic relevance information is used to indicate the semantic relevance between texts in the first image-text data sample; Generate a semantic relevance loss function value based on the semantic relevance information; Generate a first contrastive learning loss function value based on the sample features of the first anchor image-text sample, the sample features of the first positive example image-text sample, and the sample features of the first negative example image-text sample; The first loss function value is obtained based on the semantic relevance loss function value and the first contrastive learning loss function value.
15. The device according to claim 14, wherein the model training module is used to: Normalizing the sample features of the first anchor image and text sample, the sample features of the first positive example image and text sample, and the sample features of the first negative example image and text sample to obtain first relevance distribution information in the semantic relevance information; Normalizing the sample features of the first anchor text sample, the sample features of the first positive text sample, and the sample features of the first negative text sample to obtain second relevance distribution information in the semantic relevance information; The KL divergence is calculated for the first relevance distribution information and the second relevance distribution information to obtain the semantic relevance loss function value.
16. The device according to claim 14, wherein the model training module is further used to: Generate a second loss function value based on the sample features of the first anchor text sample, the sample features of the first positive example text sample, and the sample features of the first negative example text sample; The parameters of the second feature extraction model are updated according to the second loss function value.
17. A graphic data processing device, the device comprising: A sample construction module, used to construct a first anchor point sample, a first positive sample and a first negative sample based on the first image and text data sample; The first image-text data sample includes at least one first image sample and at least two text samples in different languages corresponding to the first image sample, and the at least two text samples in different languages corresponding to the first image sample are not translations of each other; A sample input module, used for inputting the first anchor point sample, the first positive sample and the first negative sample into a second feature extraction model to obtain a first sample feature output by the second feature extraction model; A loss calculation module, configured to obtain a first loss function value based on the first sample feature and with the semantic relevance between texts in the first graphic data sample as a constraint; A parameter updating module, used for updating the parameters of the second feature extraction model according to the first loss function value; A model building module is used to build a first feature extraction model based on the second feature extraction model in response to the second feature extraction model satisfying the convergence condition; the first feature extraction model is used to process the input first graphic data to obtain the data features of the first graphic data, and the data features of the first graphic data are processed by the task processing component to output the processing results of the target task; the target task is a classification or regression task based on the graphic data.
18. A computer device, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the graphic data processing method according to any one of claims 1 to 10.
19. A computer-readable storage medium, wherein at least one computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the graphic data processing method according to any one of claims 1 to 10.
20. A computer program product, comprising a computer program, wherein the computer program is stored in a computer-readable storage medium; the computer program is read and executed by a processor of a computer device to implement the graphic data processing method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Method and device for classifying and extracting data asset values
CN112784077A
Method for training image-text retrieval model and multi-modal image retrieval method and device
CN113656613A
Training method and device of multi-language multi-mode pre-training model and electronic equipment
CN114970721A
Data processing method and device, electronic equipment and storage medium
CN115115913A
Information identification method and device and computer readable storage medium
CN115115914A
Cited By
Consistency comparison method and system for multi-mode electronic signed files
CN120599630A
