Identification information determination method and device, affiliation model training method and device, equipment and medium
The tag affiliation model is used to calculate the matching degree between the information to be identified and the tag vector, and determine the target tag, which solves the problems of low efficiency, poor accuracy and high cost of information tagging in the existing technology, and achieves efficient and accurate information tagging.
Patent Information
- Application Number
- CN202310189425.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2024-08-23
AI Technical Summary
The existing technology has problems of low annotation efficiency, poor accuracy and high cost in information annotation. Especially when optimizing massive labels and deep learning models, the accuracy of other labels will be affected.
Using the tag affiliation model, by obtaining the information to be identified and all preset tags to be selected, the matching degree of the tag vector and the information vector is calculated, the target tag is determined, the cost of information annotation is reduced, and the efficiency and accuracy are improved.
The identification information of the information to be identified is marked with a matching target label, which improves the efficiency and accuracy of information labeling and reduces the cost of labeling.
Smart Images

Figure CN118535946A
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of data processing technology, and in particular to a method for determining identification information, a method for training a dependent model, an apparatus, a device, and a medium. Background Art
[0002] In recent years, with the development of big data technology, the amount of content materials has increased rapidly. In order to clearly understand the specific meaning of the content materials, it is often necessary to use labels to finely stratify the massive content materials, so as to reflect the differences between the contents. At present, there are three main ways to label content materials. One way is to label based on rule methods such as keyword matching, another way is to label similar content based on the similarity between the calculated content and the label, and the other way is to label based on the existing deep learning model.
[0003] When implementing the technical solution based on the above method, the inventor found the following problems:
[0004] The rule-based method for labeling is computationally intensive when there are a large number of labels, and has problems with low labeling efficiency and poor accuracy. Another method based on similarity labeling requires manual labeling of new labels before they can be used, which has problems with high labeling costs and low efficiency. Another method is to iterate deep learning models through a large amount of label data. When you want to optimize a label, it will affect the accuracy of other labels in the deep learning model, resulting in a decrease in the accuracy of other labels. Summary of the invention
[0005] The present invention provides a method for determining identification information, a method for training a model, a device, equipment and a medium, which can improve the efficiency and accuracy of information labeling while reducing the cost of information labeling, so that the identification information labeled for the information to be identified matches it.
[0006] In a first aspect, an embodiment of the present invention provides a method for determining identification information, the method comprising:
[0007] Obtaining information to be identified of identification information to be determined;
[0008] Input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified;
[0009] Based on the label vector and the information vector, determining the matching degree between each to-be-selected label and the to-be-identified information;
[0010] Based on each matching degree, a target tag corresponding to the information to be identified is determined from the tags to be selected.
[0011] Furthermore, the method also includes: the information to be identified includes at least one of text, video frame and image.
[0012] Furthermore, the method further comprises:
[0013] Processing the to-be-selected labels based on the label encoder in the label attachment model to obtain label alignment vectors corresponding to each to-be-selected label; and
[0014] Processing the information to be identified based on the content encoder in the tag attachment model to obtain a content vector to be aligned;
[0015] The label vector to be aligned is processed based on a first feature map alignment layer corresponding to the label encoder to obtain a label vector; and the content vector to be aligned is processed based on a second feature map alignment layer corresponding to the content encoder to obtain an information vector.
[0016] Furthermore, the method further comprises:
[0017] The cosine similarity between each label vector and the information vector is determined to obtain a matching degree corresponding to each label to be selected.
[0018] Furthermore, the method further comprises:
[0019] Based on the matching degrees and the preset selection conditions, the target tag is determined from the tags to be selected.
[0020] Furthermore, the method further comprises:
[0021] Acquire a plurality of first samples and a plurality of second samples, wherein the first samples include theoretical labels and mask labels, and the second samples include content to be processed and corresponding mask content;
[0022] Pre-training a label encoder in the label attachment model based on the first sample;
[0023] The content encoder in the label anchoring model is pre-trained based on the second sample.
[0024] Furthermore, the method further comprises:
[0025] Inputting the mask content into the content encoder to obtain output content;
[0026] Determining a loss value based on the output content and the content to be processed corresponding to the mask content;
[0027] Model parameters in the content encoder are modified based on the loss value to obtain a pre-trained content encoder.
[0028] Furthermore, the method further comprises:
[0029] Acquire a plurality of third samples, wherein the third samples include content to be processed and corresponding content titles;
[0030] Inputting the to-be-processed content in the plurality of third samples into a pre-trained content encoder to obtain a content vector to be aligned; and inputting a content title corresponding to the to-be-processed content into a pre-trained label encoder to obtain a title vector to be aligned;
[0031] Processing the title vector to be aligned based on the first feature mapping alignment layer to obtain a title alignment vector, and processing the content vector to be aligned based on the second feature mapping alignment layer to obtain a content alignment vector;
[0032] Determine a label probability distribution corresponding to each third sample based on the title alignment vector and the content alignment vector;
[0033] Based on the label probability distribution and a preset contrast loss function, modifying model parameters in the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer;
[0034] The convergence of the contrast loss function is used as a training target to obtain the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer.
[0035] Furthermore, the method further comprises:
[0036] Inputting the to-be-processed content and the corresponding theoretical label information in the fourth sample into the label attachment model to obtain output label information corresponding to the to-be-processed content;
[0037] Based on the output label information, the theoretical label information and a preset contrast loss function, correcting the model parameters in the label attachment model;
[0038] The convergence of the contrast loss function is used as a training goal to obtain the label attachment model.
[0039] Furthermore, the method further comprises:
[0040] Acquire multiple verification samples, wherein the verification samples include content to be processed and corresponding verification label information;
[0041] Input the content to be processed and the verification label information into the label attachment model to obtain corresponding actual label information;
[0042] According to the verification label information of each verification sample and the corresponding actual label information, determine the actual accuracy rate corresponding to each label information;
[0043] Based on the actual accuracy and a preset accuracy threshold, determine whether to train the label anchoring model again.
[0044] Furthermore, the method further comprises:
[0045] If there is label information whose actual accuracy is lower than the preset accuracy threshold, a plurality of fifth samples are obtained, wherein the fifth samples include the content to be processed and the corresponding theoretical label information;
[0046] Under the condition of fixing the model parameters of the label encoder, content encoder, first feature map alignment layer and the second feature map alignment layer in the label hanging model, the label orientation optimization layer in the label hanging model is trained based on the fifth sample to update the label hanging model.
[0047] In a second aspect, an embodiment of the present invention further provides a method for training a label-hanging model, the method comprising:
[0048] Acquire multiple training samples; wherein the training samples include content to be processed, corresponding content titles and theoretical label information;
[0049] For each training sample, based on the to-be-processed content, content title, pre-trained label encoder and content encoder in the training sample, determine a content vector to be aligned and a title vector to be aligned corresponding to the training sample;
[0050] For each training sample, based on the content vector to be aligned, the title vector to be aligned, the first feature map alignment layer to be trained, and the second feature map alignment layer to be trained of the training sample, determine the trained content encoder, title encoder, first feature map alignment layer, and second feature map alignment layer;
[0051] For each training sample, the label attachment model is trained based on the content to be processed of the training sample, theoretical label information, the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer, so as to process the information to be identified based on the label attachment model and determine the target label.
[0052] In a third aspect, an embodiment of the present invention further provides a device for determining identification information, the device comprising:
[0053] An information acquisition module, used to acquire information to be identified of identification information to be determined;
[0054] A vector determination module, used for inputting the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified;
[0055] A matching degree determination module, used to determine the matching degree between each to-be-selected label and the to-be-identified information based on the label vector and the information vector;
[0056] The target tag determination module is used to determine the target tag corresponding to the information to be identified from the tags to be selected based on the matching degrees.
[0057] In a fourth aspect, an embodiment of the present invention further provides a training device for a label hanging model, the device comprising:
[0058] A sample acquisition module, used to acquire a plurality of training samples; wherein the training samples include the content to be processed, the corresponding content title and theoretical label information;
[0059] An alignment vector determination module is used to determine, for each training sample, a content vector to be aligned and a title vector to be aligned corresponding to the training sample based on the content to be processed, the content title, the pre-trained label encoder and the content encoder in the training sample;
[0060] A sub-model determination module is used to determine, for each training sample, a content encoder, a title encoder, a first feature map alignment layer, and a second feature map alignment layer obtained by training based on the content vector to be aligned, the title vector to be aligned, the first feature map alignment layer to be trained, and the second feature map alignment layer to be trained of the training sample;
[0061] The hanging model determination module is used to train the label hanging model for each training sample based on the content to be processed of the training sample, theoretical label information, the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer, so as to process the information to be identified based on the label hanging model and determine the target label.
[0062] In a fifth aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0063] one or more processors;
[0064] a storage device for storing one or more programs,
[0065] When one or more programs are executed by one or more processors, the one or more processors implement any identification information determination method or label attachment model training method of the embodiments of the present invention.
[0066] In a sixth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute any identification information determination method or label attachment model training method of the embodiments of the present invention.
[0067] The technical solution of the embodiment of the present invention is to obtain the information to be identified of the identification information to be determined; input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified; based on the label vector and the information vector, determine the matching degree between each label to be selected and the information to be identified; based on each matching degree, determine the target label corresponding to the information to be identified from the labels to be selected. The technical solution of the embodiment of the present invention solves the technical problems in the prior art of information labeling based on rules, statistics or deep learning models, which leads to low labeling efficiency, poor accuracy and high cost. It is realized by inputting the information to be identified and all the labels to be selected into a pre-trained label attachment model, determining the label vector of each label to be selected and the information vector of the information to be identified based on the label attachment model, and then calculating the matching degree between each label to be selected and the information to be identified based on the label vector and the information vector, so as to characterize the matching degree between the label to be selected and the information to be identified based on the matching degree, and then selecting the target label that matches the information to be identified from the labels to be selected based on each matching degree, so that the identification information annotated for the information to be identified is matched with it, thereby improving the efficiency and accuracy of information labeling and also achieving the technical effect of reducing the cost of information labeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required to describe the embodiments. Obviously, the drawings introduced are only drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0069] Figure 1 A schematic diagram of a flow chart of a method for determining identification information provided by an embodiment of the present invention;
[0070] Figure 2 A schematic diagram of a flow chart of a method for determining identification information provided by an embodiment of the present invention;
[0071] Figure 3 A schematic diagram of a method for pre-training a content encoder provided by an embodiment of the present invention;
[0072] Figure 4 A schematic diagram of a flow chart of a method for determining identification information provided by an embodiment of the present invention;
[0073] Figure 5 A schematic diagram of a flow chart of a method for determining identification information provided by an embodiment of the present invention;
[0074] Figure 6 A schematic diagram of the structure of a tag mounting model provided in an embodiment of the present invention;
[0075] Figure 7 A schematic diagram of a method for determining identification information provided by an embodiment of the present invention;
[0076] Figure 8 A schematic diagram of a method for determining identification information provided by an embodiment of the present invention;
[0077] Fig. 9 A schematic diagram of the structure of an identification information determination device provided by an embodiment of the present invention;
[0078] Fig.10 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0079] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0080] Before introducing the technical solution, the application scenario may be described first. For example, if you want to tag content with a matching tag so that the tag can accurately represent the meaning of the content, you can use the technical solution provided by the embodiment of the present invention to implement it.
[0081] Figure 1 A flow chart of a method for determining identification information provided in an embodiment of the present invention. This embodiment is applicable to the situation of determining a label corresponding to information to be identified. The method can be executed by an identification information determination device, which can be implemented in the form of software and / or hardware. The hardware can be an electronic device, such as a mobile terminal, a PC or a server.
[0082] like Figure 1 As shown, the method includes:
[0083] S110, obtaining information to be identified of identification information to be determined.
[0084] The information to be identified may be content information whose identification information needs to be determined, and the information to be identified may be at least one of text, video frame and image, or may be content information composed of text, video frame and / or image. For example, the information to be identified 1 is composed of the text "baby milk powder" and the image of a baby carriage. The determined identification information may be used to characterize the attributes, classification and / or content meaning of the information to be identified.
[0085] In this embodiment, the information to be identified of the identification information to be determined may be acquired remotely through a network connection, or the information to be identified may be retrieved from a local cache.
[0086] S120, input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified.
[0087] Among them, the tag to be selected refers to a tag that can be selected for use, and its representation form can be text, numbers, symbols, icons, etc. For example, the tag to be selected can be "Favorite Sports", "Daily Life", "TV Series", "Variety Show", "Movies", etc. The tag to be selected can be pre-set and stored in a cache location for call selection. The tag attachment model can refer to a model for determining identification information that matches the information to be identified. The tag vector can be used to represent the specific content of the tag to be selected. The information vector is used to represent the specific content of the information to be identified.
[0088] In this embodiment, the information to be identified and all the labels to be selected can be used as inputs of the label attachment model, and the label attachment model encodes the information to be identified and each label to be selected respectively to obtain the label vector of each label to be selected and the information vector of the information to be identified.
[0089] It should be noted that in the process of encoding the information to be identified and the label to be selected based on the label attachment model, the encoded vectors may be distributed in different vector spaces. In order to improve the accuracy of matching the information to be identified and the label to be selected, the encoding vectors corresponding to the two can be feature aligned so that the final determined label vector and information vector are in the same vector space.
[0090] In this embodiment, the information to be identified and all pre-set labels to be selected are input into a pre-trained label attachment model to obtain label vectors corresponding to each label to be selected and information vectors corresponding to the information to be identified, including: processing the label to be selected based on the label encoder in the label attachment model to obtain label alignment vectors corresponding to each label to be selected; and, processing the information to be identified based on the content encoder in the label attachment model to obtain content alignment vectors; processing the label alignment vectors based on the first feature mapping alignment layer corresponding to the label encoder to obtain label vectors; and, processing the content alignment vectors based on the second feature mapping alignment layer corresponding to the content encoder to obtain information vectors.
[0091] Among them, the label attachment model includes a label encoder and a content encoder. The label encoder can be used to encode labels and extract label features. For example, the label encoder can be a BERT based model. The content encoder can be used to encode content and extract content features. The content encoder can be a unimodal encoder or a multimodal encoder. The first feature map alignment layer and the second feature map alignment layer can be linear mapping layers, which are used to realize feature mapping from one vector space to another vector space. It should be noted that in actual applications, the first feature map alignment layer and the second feature map alignment layer are relative, and the feature map alignment layer corresponding to the label encoder is used as the first feature map alignment layer, and the feature map alignment layer corresponding to the content encoder is used as the second feature map alignment layer. The first feature map alignment layer and the second feature map alignment layer can be the same feature map alignment layer or two independent feature map alignment layers.
[0092] In this embodiment, after each tag to be selected is input into the tag attachment model, the tag encoder extracts the tag feature information in the tag to be selected for encoding processing, and outputs the encoding vector corresponding to each tag to be selected as the tag alignment vector. After the information to be identified is input into the tag attachment model, the content encoder extracts the content feature information in the information to be identified for encoding processing, and outputs the encoding vector corresponding to the information to be identified as the content alignment vector. Further, the tag alignment vector can be input into the first feature mapping alignment layer corresponding to the tag encoder, and the first feature mapping alignment layer performs feature mapping processing on the tag alignment vector to obtain the processed encoding vector as the tag vector. The content alignment vector can be input into the second feature mapping alignment layer corresponding to the content encoder, and the second feature mapping alignment layer performs feature mapping processing on the content alignment vector to obtain the processed information vector. In this way, the output of the tag encoder and the output of the content encoder are mapped to the same space and aligned, so that the matching tags and contents are as close as possible in this space, and the mismatched tags and contents are as far as possible in this space, thereby improving the matching accuracy.
[0093] It should be noted that after the label alignment vector is processed based on the first feature map alignment layer corresponding to the label encoder to obtain the label vector, the process further includes: inputting the label vector into the label orientation optimization layer, processing the label vector through the label orientation optimization layer, and obtaining an optimized label vector, so as to determine the matching degree between each label to be selected and the information to be identified based on the label vector and the information vector. For example, the label vector input to the label orientation optimization layer is TF i , the output label vector TE i =M i *TF i , at this time, TE i As a new label vector, the output features of the label attachment model are made more reasonable, thereby improving the accuracy of identification information determination.
[0094] S130: Based on the label vector and the information vector, determine the matching degree between each label to be selected and the information to be identified.
[0095] In this embodiment, a distance-based similarity calculation method (such as Euclidean distance, Manhattan distance, Jaccard distance or Mahalanobis distance, etc.) can be used to calculate the distance between each label vector and the information vector, and the distance value can be used as the matching degree between the label to be selected and the information to be identified. If the distance between the two vectors is closer, it can be said that the information corresponding to the two vectors is more matched. A similarity calculation method based on the cosine of the angle (such as cosine similarity) can also be used to process each label vector and the information vector respectively to obtain the matching degree between each label to be selected and the information to be identified.
[0096] In this embodiment, based on the label vector and the information vector, the matching degree between each label to be selected and the information to be identified can be determined by determining the cosine similarity between each label vector and the information vector to obtain the matching degree corresponding to each label to be selected.
[0097] Specifically, the cosine value of the angle between each label vector and the information vector can be calculated as the cosine similarity. The cosine similarity can be used to measure the matching degree between the label to be selected and the information to be identified. If the cosine similarity between the two vectors is closer to 1, the angle is closer to 0°, indicating that the two vectors are more similar, and the labels to be selected corresponding to the two vectors are more matched with the information to be identified. If the cosine similarity between the two vectors is closer to 0, the angle is closer to 90°, indicating that the two vectors are less similar, and the labels to be selected corresponding to the two vectors are less matched with the information to be identified. Accordingly, the cosine similarity between the label vector and the information vector can be used as the matching degree between the corresponding label to be selected and the information to be identified.
[0098] Exemplarily, after determining the label vector TE of the label to be selected T1 and the information vector CE of the information to be identified C1, the cosine similarity sim(TE, CE) between TE and CE may be calculated. The calculation method may be: Wherein, || || is the norm, and sim() is the similarity function (such as cosine similarity). The matching degree score between the tag to be selected T1 and the information to be identified C1 is = sim(TE, CE).
[0099] S140: Based on each matching degree, determine a target tag corresponding to the information to be identified from the tags to be selected.
[0100] In this embodiment, each matching degree can be compared, and a tag to be selected with a high matching degree with the information to be identified can be selected from each tag to be selected as a target tag. Specifically, the implementation method of determining the target tag corresponding to the information to be identified from the tags to be selected can be: based on each matching degree and a preset selection condition, the target tag is determined from the tags to be selected.
[0101] The preset selection condition may be a pre-configured condition for selecting tags that match the information to be identified. For example, the preset selection condition may be selecting tags to be selected that are higher than a preset matching degree threshold, or may be obtaining a preset number of tags to be selected in descending order of matching degrees. The preset matching degree threshold and the preset number may be determined by the technician according to actual needs, and are not limited by this technical solution.
[0102] Specifically, each matching degree can be compared with a preset matching degree threshold, and the to-be-selected tag with a matching degree higher than the preset matching degree threshold is used as the target tag. The matching degrees can also be sorted from high to low, and the to-be-selected tags with a preset number of tags in the front are used as the target tags. In this case, it is considered that the determined target tag matches the information to be identified. The target tag can be used as identification information of the information to be identified.
[0103] The technical solution of the embodiment of the present invention is to obtain the information to be identified of the identification information to be determined; input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified; based on the label vector and the information vector, determine the matching degree between each label to be selected and the information to be identified; based on each matching degree, determine the target label corresponding to the information to be identified from the labels to be selected. The technical solution of the embodiment of the present invention solves the technical problems in the prior art of information labeling based on rules, statistics or deep learning models, which leads to low labeling efficiency, poor accuracy and high cost. It is realized by inputting the information to be identified and all the labels to be selected into a pre-trained label attachment model, determining the label vector of each label to be selected and the information vector of the information to be identified based on the label attachment model, and then calculating the matching degree between each label to be selected and the information to be identified based on the label vector and the information vector, so as to characterize the matching degree between the label to be selected and the information to be identified based on the matching degree, and then selecting the target label that matches the information to be identified from the labels to be selected based on each matching degree, so that the identification information annotated for the information to be identified is matched with it, thereby improving the efficiency and accuracy of information labeling and also achieving the technical effect of reducing the cost of information labeling.
[0104] Figure 2 This is a flow chart of a method for determining identification information provided by an embodiment of the present invention. Based on the above embodiment, the embodiment of the present invention can also pre-train the label encoder and content encoder in the label hanging model to improve the accuracy of the model. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above embodiment are not repeated here.
[0105] like Figure 2 As shown, the method specifically comprises the following steps:
[0106] S210: Acquire a plurality of first samples and a plurality of second samples.
[0107] Among them, the first sample includes theoretical labels and mask labels. Mask labels refer to content that is randomly or regularly masked from theoretical labels, that is, mask labels may include part of the theoretical label information. For example, the theoretical label is "This TV series is really good". After mask processing, the obtained mask label may be "The drama is good". The theoretical label is the label output by the expected label encoder. The second sample includes the content to be processed and the corresponding mask content. The content to be processed may include any of text, video, and image. Mask content refers to the content that is masked from the content to be processed. The masked ratio can be 10% or 15%, without limitation.
[0108] In this embodiment, in order to improve the accuracy of the model, the first samples and the second samples may be obtained as much and as rich as possible, so as to train the label encoder based on the first samples and train the content encoder based on the second samples.
[0109] S220: pre-train the label encoder in the label attachment model based on the first sample.
[0110] Among them, the label encoder can be a BERT based model.
[0111] In this embodiment, the mask label in the first sample can be input into the label encoder to obtain the output label, and then the error value is determined based on the output label and the theoretical label corresponding to the mask label. The model parameters in the label encoder can be corrected based on the error value to obtain a pre-trained label encoder. The specific implementation method can be: input the mask label in the first sample into the label encoder, and after obtaining the output label, the output label is compared with the theoretical label corresponding to the mask label to calculate the similar error value, and then the model parameters in the label encoder can be adjusted based on the error value, and the model parameters are continuously tuned. The training error of the loss function, that is, the loss parameter, can be used as a condition for detecting whether the loss function has reached convergence at present, such as whether the training error is less than the preset error or whether the error change trend tends to be stable, or whether the current number of iterations is equal to the preset number. If the convergence condition is detected, such as the training error of the loss function is less than the preset error or the error change tends to be stable, it indicates that the label encoder training is completed, and the iterative training can be stopped at this time. If it is detected that the convergence condition is not reached at present, the first sample can be further obtained to pre-train the label encoder until the training error of the loss function is within the preset range. When the training error of the loss function reaches convergence, the label encoder at this time can be used as a pre-trained label encoder. So that when a mask label with less information is input, the label encoder can output the expected theoretical label with more information. Exemplarily, the label encoder can be pre-trained through a large amount of content data in a set scenario (such as an e-commerce scenario), and the training uses a mask language model (MLM) scheme to obtain a pre-trained label encoder. The advantage of this setting is that by randomly masking out part of the content, the label encoder is allowed to learn, which solves the problem that the label encoder can only use one-way information and improves the generalization ability of the model.
[0112] S230: Pre-train the content encoder in the label anchoring model based on the second sample.
[0113] In this embodiment, the implementation method of pre-training the content encoder in the label attachment model based on the second sample can be: inputting the mask content into the content encoder to obtain the output content; determining the loss value based on the output content and the content to be processed corresponding to the mask content; and correcting the model parameters in the content encoder based on the loss value to obtain the pre-trained content encoder.
[0114] Specifically, the mask content in the second sample can be input into the content encoder to obtain the output content, and then the obtained output content can be compared with the content to be processed corresponding to the mask content, and the similarity error value, that is, the loss value, can be calculated. Then, the model parameters in the content encoder can be adjusted based on the loss value, and the model parameters can be continuously tuned. The training error of the loss function, that is, the loss parameter, can be used as a condition for detecting whether the loss function has reached convergence at present, such as whether the training error is less than the preset error or whether the error change trend tends to be stable, or whether the current number of iterations is equal to the preset number. If the convergence condition is reached, such as the training error of the loss function is less than the preset error or the error change tends to be stable, it indicates that the content encoder training is completed, and the iterative training can be stopped at this time. If it is detected that the convergence condition is not reached at present, the second sample can be further obtained to pre-train the content encoder until the training error of the loss function is within the preset range. When the training error of the loss function reaches convergence, the content encoder at this time can be used as the content encoder obtained by pre-training. So that when the mask content containing less information is input, the content encoder can output the expected content to be processed containing more information.
[0115] It should be noted that in actual applications, if the content information to be identified includes multiple types of information such as text and images, then the content encoder needs to process multimodal content information including text and images. Due to the different types of information, the corresponding encoding methods may be different. In order to improve the accuracy of the content encoder, an encoder of the type corresponding to the content information can be used to encode it. For example, when the content information to be identified includes text and images, a text encoder can be used to encode the text information, and an image encoder can be used to encode the image information. For example, see Figure 3 , Figure 3 It can be represented as a schematic diagram of a method for pre-training a content encoder. The content encoder can include a text encoder and an image encoder. The text encoder can use a BERT based model, and the image encoder can use a Vision Transformer (ViT) model. A second sample can be collected in a set field, and the content to be processed in the second sample includes text and images. The text in the content to be processed can be input into the text encoder to obtain a text character code; the image in the content to be processed can be input into the image encoder to obtain an image code. Furthermore, the text character code corresponding to the content to be processed and the image code can be feature spliced to obtain the spliced coding features and sent to the BERT based model for modal fusion. MLM is used for training to predict the masked (masked) content through the coding features.
[0116] The technical solution of the embodiment of the present invention obtains multiple first samples containing theoretical labels and masked labels based on masked out to pre-train the label encoder in the label hanging model, and obtains multiple second samples containing content to be processed and corresponding masked content based on masked out to pre-train the content encoder in the label hanging model, thereby realizing input of masked labels and masked contents with a small amount of data into the model for prediction processing, saving time cost and reducing the risk of overfitting, and also achieving the technical effect of improving the generalization ability of the label encoder and the content encoder.
[0117] Figure 4 A flowchart of a method for determining identification information provided by an embodiment of the present invention. On the basis of the above-mentioned embodiment, the label encoder and the corresponding first feature map alignment layer can also be pre-trained, and the content encoder and the corresponding second feature map alignment layer can be pre-trained to improve the feature alignment effect, thereby improving the matching accuracy. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above-mentioned embodiment are not repeated here.
[0118] like Figure 4 As shown, the method includes:
[0119] S310: Acquire multiple third samples.
[0120] In order to improve the accuracy of the model, the third samples can be obtained as much and as rich as possible. The third samples include the content to be processed and the corresponding content title. The content title can indicate the main content and meaning of the content to be processed, which can be a concise sentence or word, etc. The title is more inductive and has a similar function to a label.
[0121] S320, input the content to be processed in the plurality of third samples into a pre-trained content encoder to obtain a content vector to be aligned; and input the content title corresponding to the content to be processed into a pre-trained label encoder to obtain a title vector to be aligned.
[0122] Specifically, the content to be processed in the third sample can be input into a pre-trained content encoder, and the content encoder encodes the content to be processed to obtain an encoded feature vector as the content vector to be aligned. The content title corresponding to the content to be processed can be input into a pre-trained label encoder, and the label encoder encodes the content title to obtain an encoded feature vector as the title vector to be aligned.
[0123] S330, processing the title vector to be aligned based on the first feature mapping alignment layer to obtain a title alignment vector, and processing the content vector to be aligned based on the second feature mapping alignment layer to obtain a content alignment vector.
[0124] In this embodiment, the title vector to be aligned obtained in step S320 can be input into the first feature mapping alignment layer, and the label vector to be aligned is mapped from one vector space to another vector space through the first feature mapping alignment layer, and the coded vector after feature mapping is obtained as the title alignment vector. The content vector to be aligned is input into the second feature mapping alignment layer, and the content vector to be aligned is mapped from one vector space to another vector space (the space is the same space as the other vector space mapped by the first feature mapping alignment layer) through the second feature mapping alignment layer, and the coded vector after feature mapping is obtained as the content alignment vector. At this time, the title alignment vector and the content alignment vector are in the same space and aligned.
[0125] S340: Determine a label probability distribution corresponding to each third sample based on the title alignment vector and the content alignment vector.
[0126] In this embodiment, the content to be processed and the content title in a third sample are in one-to-one correspondence. Accordingly, the true probability distribution corresponding to the third sample can be determined based on the correspondence between the content to be processed and all the content titles in the third sample. For example, for the third sample I, the third sample I contains the content to be processed A and the corresponding content title B. The component between the content to be processed A and the content title B can be set to 1, and the component between the content to be processed A and the content titles other than the content title B can be set to 0, such as (1, 0, 0, 0, 0, 0, 0) is the true probability distribution corresponding to the third sample I. The estimated probability distribution corresponding to each third sample can also be solved based on the title alignment vector and the content alignment vector. For example, for a third sample, the cosine similarity and coefficient between the title alignment vector and the content alignment vector of the content to be processed in the third sample can be taken as the quotient to obtain the quotient value, and then the quotient value can be used as an exponent, and a preset value (such as e) can be used as the base, so that the exponent base is multiplied to obtain the product value. The multiplication value corresponding to the third sample and the sum of the multiplication values of all third samples can be used as a quotient to obtain the quotient value as the estimated probability distribution of the third sample. The true probability distribution and the estimated probability distribution of the third sample can both be used as the label probability distribution.
[0127] For example, i is the predicted probability distribution of the ith third sample, Among them, TE i is the title alignment vector of the content title, CE i is the content alignment vector of the content to be processed, sim() is a similarity function, such as cosine similarity, and τ is the temperature coefficient.
[0128] S350, based on the label probability distribution and the preset contrast loss function, modify the model parameters in the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer.
[0129] In this embodiment, the contrast loss function can be: contrastive (p,q)=-∑ i [p i logq i +(1-p i )log(1-q i )]. The true probability distribution p in the label probability distribution can be i and the expected probability distribution q i As an input parameter of the contrast loss function, a loss value is obtained, and based on the loss value, the model parameters in the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer are corrected, and the model parameters are continuously adjusted to make the model optimal.
[0130] S360, taking the convergence of the contrast loss function as a training goal, and obtaining a content encoder, a title encoder, a first feature map alignment layer, and a second feature map alignment layer.
[0131] Among them, the training goal is to train to achieve the convergence of the contrast loss function.
[0132] In this embodiment, the training error of the contrast loss function, that is, the loss parameter, can be used as a condition for detecting whether the contrast loss function has reached convergence, such as whether the training error is less than a preset error or whether the error change trend tends to be stable, or whether the current number of iterations is equal to the preset number. If the detection reaches the convergence condition, such as the training error of the contrast loss function is less than the preset error or the error change tends to be stable, it indicates that the training of the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer is completed, and the iterative training can be stopped at this time. If it is detected that the convergence condition is not reached at present, a third sample can be further obtained to train the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer until the training error of the contrast loss function is within the preset range. When the training error of the contrast loss function reaches convergence, it can be considered that the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer are obtained.
[0133] The technical solution of the embodiment of the present invention is to obtain multiple third samples including content to be processed and corresponding content titles, and then input the content to be processed in the multiple third samples into the pre-trained content encoder to obtain the content to be aligned vector, and input the content title corresponding to the content to be processed into the pre-trained label encoder to obtain the title to be aligned vector, and then process the title to be aligned vector based on the first feature map alignment layer to obtain the title alignment vector, and process the content to be aligned vector based on the second feature map alignment layer to obtain the content alignment vector, so that the title alignment vector and the content alignment vector are aligned in the same vector space, thereby improving the accuracy of vector matching. Based on the title alignment vector and the content alignment vector, the label probability distribution corresponding to each third sample is obtained, and then based on the label probability distribution and the contrast loss function, the model parameters in the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer are corrected, the model parameters are continuously optimized, and the model accuracy is improved to obtain the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer, thereby improving the accuracy of information labeling.
[0134] Figure 5 A flowchart of a method for determining identification information provided by an embodiment of the present invention, based on the above-mentioned embodiment, after obtaining the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer in the label hanging model, the model parameters in the label hanging model can be further corrected to improve the accuracy of the model, and its specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above-mentioned embodiment are not repeated here.
[0135] like Figure 5 As shown, the method includes:
[0136] S410: Input the content to be processed and the corresponding theoretical label information in the fourth sample into the label attachment model to obtain output label information corresponding to the content to be processed.
[0137] It should be noted that after taking the convergence of the contrast loss function as the training goal and obtaining the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer, the model parameters in the label hanging model can be fine-tuned as a whole. At this time, multiple fourth samples can be obtained to further train the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer in the label hanging model to improve model accuracy.
[0138] In this embodiment, multiple fourth samples can be obtained, and the theoretical label information corresponding to the content to be processed in the fourth sample can be manually annotated, or it can be pseudo-label data, which matches the content to be processed. The content to be processed in the fourth sample and the corresponding theoretical label information can be used as the input of the label attachment model, and the content to be processed is processed by the label attachment model, and the output is the output label information determined by the content to be processed. At this time, the output label information may have a certain error with the theoretical label information, so as to correct the model parameters of the label attachment model based on the output label information and the theoretical label information.
[0139] S420: Based on the output label information, the theoretical label information and the preset contrast loss function, the model parameters in the label attachment model are corrected.
[0140] In this embodiment, the output label information is input into the first feature map alignment layer to obtain a label alignment vector, the theoretical label information is input into the second feature map alignment layer to obtain a content alignment vector, and the label probability distribution corresponding to each fourth sample is determined. Further, the label probability distribution corresponding to each fourth sample and the contrast loss function are used to modify the model parameters in the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer.
[0141] S430, taking the convergence of the contrast loss function as a training goal to obtain a label attachment model.
[0142] Exemplarily, the label encoder, content encoder, first feature map alignment layer and second feature map alignment layer can be trained using the content to be processed in the fourth sample and the corresponding theoretical label information, and the training method can be consistent with the training method of the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer obtained based on the third sample training. The label data source of the theoretical label information can be pseudo-label data or data accumulated by manual labeling.
[0143] S440. Obtain multiple verification samples.
[0144] The verification sample includes the content to be processed and the corresponding verification label information, and the verification label information is used to verify the accuracy of the output results of the label attachment model.
[0145] S450: Input the content to be processed and the verification tag information into the tag attachment model to obtain the corresponding actual tag information.
[0146] S460: Determine the actual accuracy rate corresponding to each label information according to the verification label information of each verification sample and the corresponding actual label information.
[0147] S470: Based on the actual accuracy and the preset accuracy threshold, determine whether to train the label attachment model again.
[0148] Specifically, the actual accuracy rate corresponding to each tag information can be compared with the preset accuracy rate threshold. If the proportion of tag information above the preset accuracy rate threshold is greater than the preset value, then it can be considered that the accuracy of the tag-hanging model meets the standard, and the tag-hanging model does not need to be trained again. If the proportion of tag information above the preset accuracy rate threshold is less than the preset value, then it can be considered that the accuracy of the tag-hanging model does not meet the standard, and the tag-hanging model can be trained again. Alternatively, if the proportion of tag information below the preset accuracy rate threshold is greater than the set value, then it can be considered that the accuracy of the tag-hanging model does not meet the standard, and the tag-hanging model can be trained again. If the proportion of tag information below the preset accuracy rate threshold is less than the set value, then it can be considered that the accuracy of the tag-hanging model meets the standard, and the tag-hanging model does not need to be trained again. Alternatively, if there is tag information whose actual accuracy rate is lower than the preset accuracy rate threshold, it is considered that the tag-hanging model needs to be trained.
[0149] It should be noted that after the label attachment model is obtained by taking the convergence of the contrast loss function as the training goal, the label attachment model at this time has the ability to determine the matching identification information for the information to be identified, but there may be a situation where the output label information output by the label attachment model based on some fourth samples is less accurate. In order to further enhance the accuracy of the label attachment model, the content alignment vector can be optimized after the first feature mapping alignment layer outputs the content alignment vector, so that the content alignment vector output for each label is more reasonable, thereby improving the matching accuracy.
[0150] In this embodiment, it also includes: if there is label information whose actual accuracy is lower than the preset accuracy threshold, multiple fifth samples are obtained; under the condition of fixing the model parameters of the label encoder, content encoder, first feature mapping alignment layer and second feature mapping alignment layer in the label hanging model, the label directional optimization layer in the label hanging model is trained based on the fifth samples to update the label hanging model.
[0151] Among them, the fifth sample includes the content to be processed and the corresponding theoretical label information. It should be noted that in order to ensure that the effects of other labels are not affected while optimizing the features of certain labels, the model parameters in the label hanging model can be fine-tuned for labels with specific low accuracy, thereby achieving the purpose of directional optimization. Optionally, the fifth sample can be a verification sample below a preset accuracy threshold. The label directional optimization layer is used to optimize label features so that the output features of each label are more reasonable. For example, the label directional optimization layer can be a unit matrix M initialized to E*E, where E is the feature dimension.
[0152] Specifically, if there is label information whose actual accuracy is lower than the preset accuracy threshold, the label information lower than the preset accuracy threshold can be screened out, and the fourth sample corresponding to the screened label information can be used as the fifth sample. Furthermore, the model parameters of the label encoder, content encoder, first feature map alignment layer and second feature map alignment layer in the label attachment model can be fixed, that is, the label encoder, content encoder, first feature map alignment layer and second feature map alignment layer are not trained, and the label orientation optimization layer in the label attachment model is trained based on the fifth sample to obtain a trained label attachment model.
[0153] Exemplarily, the training method for training the label-oriented optimization layer based on the fifth sample can be combined with Figure 6 The structural diagram of the label attachment model shown is used for explanation. The label attachment model includes a label encoder, a content encoder, a first feature map alignment layer, a second feature map alignment layer, a label orientation optimization layer and a matching module. The fifth sample can be input into the label attachment model, and the content to be processed in the fifth sample is used as the input of the content encoder. The theoretical label information corresponding to the content to be processed is used as the input of the label encoder. The content encoder outputs the content to be aligned vector of the content to be processed, and the label encoder outputs the label to be aligned vector of the theoretical label information. The content to be aligned vector is input into the second feature map alignment layer to obtain the content alignment vector, and the label to be aligned vector is input into the first feature map alignment layer to obtain the label alignment vector. Further, the label alignment vector is input into the label orientation optimization layer for optimization processing to obtain the optimized label vector. For example, the input label alignment vector is TF. i , the output label vector TE i =M i *TF i The output label vector, content alignment vector and pre-set classification loss function can be used to modify the model parameters in the label attachment model, and the convergence of the classification loss function is used as the training target to obtain the label attachment model. Among them, the classification loss function can be expressed as: L classification (p i ,q i )=∑ i p i1 log(q i )+p i0 log(1-q i ). i1 represents the probability that the fifth i-th sample is a positive sample, p i0 represents the probability that the fifth i-th sample is a negative sample, q i =sim(TE i , C.E. i) represents the probability that the fifth sample of the i-th order is predicted as a positive sample, TE i is the label vector of theoretical label information, CE i is the content vector of the content to be processed. The more the positive sample represents the content to be processed in the fifth sample and the theoretical label information match, the more the negative sample represents the content to be processed in the fifth sample and the theoretical label information do not match. Specifically, the probability that the fifth sample is a negative sample and the probability that it is a positive sample can be calculated based on the output label vector and content vector (i.e., content alignment vector). For example, the similarity error value between the label vector and the content vector can be calculated. If the similarity error value is larger, the probability that the fifth sample is a negative sample is smaller, and the probability that it is a positive sample is larger; if the similarity error value is smaller, the probability that the fifth sample is a negative sample is larger, and the probability that it is a positive sample is smaller. Correspondingly, the similarity error value can be used as the probability that the fifth sample is a positive sample, and 1 minus the similarity error value can be used as the probability that the fifth sample is a negative sample. The cosine similarity between the label vector and the content vector can be used as the probability that the fifth sample is predicted to be a positive sample. The probability q that the fifth sample is predicted to be a positive sample can be calculated. i , the probability that the fifth sample is a positive sample, and the probability that the fifth sample is a negative sample are used as input parameters of the classification loss function, and the output value is used as the loss value. The model parameters of the label-oriented optimization layer in the label-attached model are corrected to obtain the trained label-oriented optimization layer and update the label-attached model. In this way, a whole round of model training is completed, but because the label library is always changing dynamically, many new labels will be added and old labels will be removed. When old labels are removed, this label can be directly disabled, but when new labels are added, since the model has not seen these labels before, these new labels can be used as verification samples to determine whether to train the label-attached model again based on the actual accuracy and the preset accuracy threshold to improve performance and ensure accuracy.
[0154] It is understandable that if a tag is not optimized for tag targeting, the corresponding M i It is always the unit matrix, that is, TE = TF. The advantage of training the label directional optimization layer in the label attachment model based on the fifth sample is that it can support the directional optimization of label granularity, fine-tune specific substandard samples, and does not affect the labeling effect of other labels, thereby improving the accuracy of the model.
[0155] The technical solution of the embodiment of the present invention is to input the content to be processed and the corresponding theoretical label information in the fourth sample into the label hanging model to obtain the output label information corresponding to the content to be processed; based on the output label information, the theoretical label information and the pre-set contrast loss function, the model parameters in the label hanging model are corrected to fine-tune the model parameters in the label hanging model as a whole to improve the model accuracy, and then the convergence of the contrast loss function is used as the training target to obtain the label hanging model. In addition, a plurality of verification samples containing the content to be processed and the corresponding verification label information are input into the label hanging model to obtain the corresponding actual label information; then, according to the verification label information of each verification sample and the corresponding actual label information, the actual accuracy rate corresponding to each label information is determined to characterize whether the accuracy rate of the label is up to standard based on the actual accuracy rate, and then the label hanging model is trained based on the data whose actual accuracy rate is lower than the preset accuracy rate threshold, so as to achieve directional optimization of labels. When optimizing labels in a directional manner, the accuracy rates of other labels will not be affected, thereby ensuring the overall accuracy of the model.
[0156] Figure 7 A schematic diagram of a method for determining identification information provided by an embodiment of the present invention, see Figure 7, the implementation method of determining the identification information provided in this embodiment can be: first, when pre-training the label encoder and the content encoder, a large amount of content data in a set scene (such as an e-commerce scene) can be obtained as the first sample, and the label encoder (such as a BERT based model) is pre-trained, and the training uses a mask language model (MLM) scheme to obtain a pre-trained label encoder. Multimodal content information containing text and images is obtained as a second sample, and the content encoder is pre-trained, and the training uses MLM to obtain a pre-trained content encoder. In order to predict the masked (masked) words through image features, the content encoder can include a text encoder and an image encoder. The text encoder can use the BERT based model, and the image encoder can use the Vision Transformer (ViT) model. The text in the second sample is input into the text encoder to obtain the text character encoding, and the image is input into the image encoder to obtain the image patch encoding. The text character encoding and the image patch encoding are spliced and sent to the BERT based model for modal fusion to obtain the fusion encoding, that is, the content vector of the content to be processed, so that the content vector of the content to be processed and the corresponding mask content train the content encoder. Secondly, the content to be processed including content and content pictures and its corresponding content title can be obtained as the third sample to train the label encoder, the first feature map alignment layer, the content encoder, and the second feature map alignment layer for training. The content to be processed including content and content pictures can be used as the input of the content encoder to output the content vector to be aligned, and the content title can be used as the input of the label encoder to output the title vector to be aligned. The title vector to be aligned is processed based on the first feature map alignment layer to obtain the title alignment vector, and the content vector to be aligned is processed based on the second feature map alignment layer to obtain the content alignment vector.
[0157] Further, based on the title alignment vector and the content alignment vector, the label probability distribution corresponding to each third sample is determined, and based on the label probability distribution and the contrast loss function, the model parameters in the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer are modified to obtain the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer. For example, see Figure 8, the content (such as C1) can be used as the input of the content encoder, and the output of the content encoder can be used as the input of the second feature map alignment layer to obtain the content vector (CE). The label (T1, T2, T3 respectively) can be used as the input of the label encoder, and the output of the label encoder can be used as the input of the first feature map alignment layer to obtain the label vector (TF1, TF2, TF3). Based on the content vector (CE) and the label vector (TF1, TF2, TF3) and the contrast loss function, the model parameters in the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer are corrected, and the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer are obtained when the contrast loss function converges. The contrast loss function can be: L contrastive (p, q) = -∑ i [p i logq i +(1-p i )log(1-q i )], where p i is the true probability distribution of the third sample of the ith class. Since the content and title correspond one to one, the ith component is 1, and the rest are vectors of 0. i is the predicted probability distribution of the ith third sample, Among them, TE i is the title alignment vector of the content title, CE iis the content alignment vector of the content to be processed, sim() is a similarity function, such as cosine similarity, and τ is the temperature coefficient. Further, the model parameters in the label attachment model can be fine-tuned as a whole, and the content to be processed including content and content images and its corresponding theoretical label information can be obtained as the fourth sample. The data source of the theoretical label information can be pseudo-label data or data accumulated by manual labeling, and then the title encoder, the first feature map alignment layer and the second feature map alignment layer are trained based on the fourth sample, and the training method is consistent with the method of training the title encoder, the first feature map alignment layer and the second feature map alignment layer with the third sample. At this point, the label attachment model already has the label attachment capability and can obtain multiple verification samples. The label attachment model is used to perform the attachment matching of the content to be processed in the verification samples and the corresponding verification label information, and to evaluate the accuracy of label matching. The accuracy of each label can be counted, and the label information that does not meet the accuracy standard can be screened out. The verification samples corresponding to the labels that do not meet the accuracy standard are used as the fifth samples. Based on the fifth sample training, the label orientation optimization layer in the label attachment model is trained. The label encoder, content encoder, first feature map alignment layer, and second feature map alignment layer in the label attachment model are frozen and not trained. Assume that the feature dimension is E, and the label orientation optimization layers M1, M2, and M3 are initialized to the unit matrix M of E*E. For the input label alignment vector TF i , the output label vector is TE i =M i *TF i The output label vector, content alignment vector and classification loss function can be used to correct the model parameters in the label attachment model, and the convergence of the classification loss function is used as the training target to obtain the label attachment model. For example, see Figure 8 , the label vector (TF1, TF2, TF3) can be used as the input of the label oriented optimization layer (M1, M2, M3), and the label optimization vector (TE1, TE2, TE3) can be output. The model parameters in the label oriented optimization layer can be corrected based on the content vector (CE) and the label optimization vector (TE1, TE2, TE3) and the classification loss function. When the classification loss function converges, the label oriented optimization layer is obtained. The classification loss function can be expressed as: L classification (p i ,q i )=∑ i p i1 log(q i )+p i0 log(1-q i ). i1 represents the probability that the fifth i-th sample is a positive sample, p i0 represents the probability that the fifth i-th sample is a negative sample, q i=sim(TE i , C.E. i ) represents the probability that the fifth sample of the i-th order is predicted as a positive sample, TE i is the label vector of theoretical label information, CE i is the content vector of the content to be processed. This completes a whole round of model training. However, since the label library is always changing dynamically, many new labels will be added and old labels will be removed. When old labels are removed, they can be directly disabled. However, when new labels are added, since the model has never seen these labels before, these new labels can be used as verification samples to determine whether to train the label attachment model again based on the actual accuracy and the preset accuracy threshold to improve performance and ensure accuracy.
[0158] In the prediction stage, the tag feature TE and the content feature CE can be directly input into the matching module to perform tag association. The association method is: calculate the similarity score between the tag and the content = sim (TE, CE). The sim function uses the cosine similarity used in training: The cosine similarity can be used as the matching degree between the tag and the content, and the tag with a matching degree higher than a preset matching degree threshold can be used as the target tag. The matching degrees can also be sorted from high to low, and the tags with a preset number of tags in the front are used as the target tags. In this case, the determined target tag is considered to match the input content.
[0159] The technical solution of the embodiment of the present invention is to obtain the information to be identified of the identification information to be determined; input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified; based on the label vector and the information vector, determine the matching degree between each label to be selected and the information to be identified; based on each matching degree, determine the target label corresponding to the information to be identified from the labels to be selected. The technical solution of the embodiment of the present invention solves the technical problems in the prior art of information labeling based on rules, statistics or deep learning models, which leads to low labeling efficiency, poor accuracy and high cost. It is realized by inputting the information to be identified and all the labels to be selected into a pre-trained label attachment model, determining the label vector of each label to be selected and the information vector of the information to be identified based on the label attachment model, and then calculating the matching degree between each label to be selected and the information to be identified based on the label vector and the information vector, so as to characterize the matching degree between the label to be selected and the information to be identified based on the matching degree, and then selecting the target label that matches the information to be identified from the labels to be selected based on each matching degree, so that the identification information annotated for the information to be identified is matched with it, thereby improving the efficiency and accuracy of information labeling and also achieving the technical effect of reducing the cost of information labeling.
[0160] On the basis of the above embodiments, a method for training a label attachment model is also provided, which can obtain a label attachment model through training samples, so that after the information to be identified and all the labels to be selected are input into the trained label attachment model, a target label adapted to the information to be identified is obtained, and its specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above embodiments are not repeated here.
[0161] In this embodiment, the training method of the label hanging model includes: obtaining multiple training samples; for each training sample, based on the content to be processed, the content title, the pre-trained label encoder and the content encoder in the training sample, determining the content vector to be aligned and the title vector to be aligned corresponding to the training sample; for each training sample, based on the content vector to be aligned, the title vector to be aligned, the first feature map alignment layer to be trained and the second feature map alignment layer to be trained of the training sample, determining the trained content encoder, title encoder, first feature map alignment layer and second feature map alignment layer; for each training sample, based on the content to be processed, the theoretical label information, the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer of the training sample, training a label hanging model to process the information to be identified based on the label hanging model to determine the target label.
[0162] In order to improve the accuracy of the label attachment model, as many and rich training samples as possible can be obtained, wherein the training samples include the content to be processed, the corresponding content title and the theoretical label information.
[0163] In this embodiment, the content to be processed in the training sample can be input into the pre-trained content encoder to obtain a content vector to be aligned corresponding to the training sample, and the content title can be input into the pre-trained label encoder to obtain a title vector to be aligned corresponding to the training sample. The training method of the content encoder and the label encoder can refer to the above embodiment. Further, the content vector to be aligned can be input into the second feature map alignment layer to be trained, and the title vector to be aligned can be input into the first feature map alignment layer to be trained. The model parameters in the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer are corrected, and the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer are obtained by training. The specific training method can refer to the implementation method of training the content encoder, title encoder, first feature map alignment layer and second feature map alignment layer based on the third sample in the above embodiment. Furthermore, the content to be processed of the training sample can be input into the content encoder, the content vector to be aligned output by the content encoder can be input into the second feature map alignment layer, the theoretical label information can be input into the title encoder, the title vector to be aligned output by the title encoder can be input into the second feature map alignment layer, and the label hanging model can be trained. The specific training method can refer to the implementation method of training the label hanging model based on the fourth sample in the above embodiment. At this time, the label hanging model obtained by training includes the trained content encoder, title encoder, first feature map alignment layer and second feature map alignment layer. In practical applications, the information to be identified and all the labels to be selected can be input into the label hanging model, and the target label that matches the information to be identified can be output.
[0164] The technical solution of the embodiment of the present invention processes the content title in the training sample based on the label encoder obtained by pre-training, and the content encoder processes the content to be processed to obtain the content to be aligned vector and the title to be aligned vector corresponding to the training sample. Then, based on the content to be aligned vector, the title to be aligned vector, the first feature map alignment layer to be trained, and the second feature map alignment layer to be trained of the training sample, the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer are trained. Furthermore, through the content to be processed of the training sample, the theoretical label information, the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer, the label attachment model is trained to improve the model precision and accuracy, so that the label attachment model outputs a target label that is compatible with the information to be identified, thereby improving the efficiency and accuracy of information annotation.
[0165] Fig. 9This is a schematic diagram of the structure of an identification information determination device provided by an embodiment of the present invention. The device includes: an information acquisition module 510, a vector determination module 520, a matching degree determination module 530 and a target tag determination module 540.
[0166] Among them, the information acquisition module 510 is used to obtain the information to be identified of the identification information to be determined; the vector determination module 520 is used to input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified; the matching degree determination module 530 is used to determine the matching degree between each label to be selected and the information to be identified based on the label vector and the information vector; the target label determination module 540 is used to determine the target label corresponding to the information to be identified from the labels to be selected based on each matching degree.
[0167] Based on the above device, optionally, the information to be identified includes at least one of text, video frame and image.
[0168] On the basis of the above device, the vector determination module 520 includes a vector determination unit and a vector alignment unit.
[0169] A vector determination unit is used to process the to-be-selected tags based on the tag encoder in the tag attachment model to obtain tag alignment vectors corresponding to each to-be-selected tag; and to process the to-be-identified information based on the content encoder in the tag attachment model to obtain content alignment vectors;
[0170] A vector alignment unit is used to process the label to-be-aligned vector based on a first feature mapping alignment layer corresponding to the label encoder to obtain a label vector; and to process the content to-be-aligned vector based on a second feature mapping alignment layer corresponding to the content encoder to obtain an information vector.
[0171] Based on the above device, the matching degree determination module 530 is specifically used to determine the cosine similarity between each label vector and the information vector to obtain the matching degree corresponding to each label to be selected.
[0172] On the basis of the above device, the target tag determination module 540 is specifically used to determine the target tag from the tags to be selected based on the matching degrees and the preset selection conditions.
[0173] On the basis of the above device, the device further includes a first model training module, and the first model training module includes: a sample determination unit, a label encoder pre-training unit and a content encoder pre-training unit.
[0174] A sample determination unit, configured to obtain a plurality of first samples and a plurality of second samples, wherein the first samples include theoretical labels and mask labels, and the second samples include content to be processed and corresponding mask content;
[0175] A label encoder pre-training unit, used for pre-training the label encoder in the label attachment model based on the first sample;
[0176] A content encoder pre-training unit is used to pre-train the content encoder in the label hanging model based on the second sample.
[0177] On the basis of the above device, the content encoder pre-training unit includes an output content determination subunit, a loss value determination subunit and a content encoder determination subunit.
[0178] an output content determination subunit, configured to input the mask content into the content encoder to obtain output content;
[0179] a loss value determination subunit, configured to determine a loss value based on the output content and the content to be processed corresponding to the mask content;
[0180] The content encoder determination subunit is used to modify the model parameters in the content encoder based on the loss value to obtain a pre-trained content encoder.
[0181] Based on the above device, the device also includes a second model training module, and the second model training module includes: a third sample determination unit, a vector to be aligned determination unit, an alignment vector determination unit, a label probability distribution determination unit, a parameter correction unit and a model training unit.
[0182] A third sample determining unit, configured to obtain a plurality of third samples, wherein the third samples include content to be processed and corresponding content titles;
[0183] A unit for determining a vector to be aligned is used to input the content to be processed in the plurality of third samples into a pre-trained content encoder to obtain a content vector to be aligned; and input a content title corresponding to the content to be processed into a pre-trained label encoder to obtain a title vector to be aligned;
[0184] an alignment vector determining unit, configured to process the title vector to be aligned based on the first feature mapping alignment layer to obtain a title alignment vector, and to process the content vector to be aligned based on the second feature mapping alignment layer to obtain a content alignment vector;
[0185] a label probability distribution determining unit, configured to determine a label probability distribution corresponding to each third sample based on the title alignment vector and the content alignment vector;
[0186] A parameter correction unit, configured to correct model parameters in the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer based on the label probability distribution and a preset contrast loss function;
[0187] A model training unit is used to take the convergence of the contrast loss function as a training target to obtain the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer.
[0188] On the basis of the above device, the device further includes a third model training module, and the third model training module includes: a fourth sample determination unit, a parameter adjustment unit and a label hanging model.
[0189] A fourth sample determination unit, used for inputting the to-be-processed content and the corresponding theoretical label information in the fourth sample into the label attachment model to obtain output label information corresponding to the to-be-processed content;
[0190] A parameter adjustment unit, used to correct the model parameters in the label attachment model based on the output label information, the theoretical label information and a preset contrast loss function;
[0191] The label attachment model determination unit is used to take the convergence of the contrast loss function as a training target to obtain the label attachment model.
[0192] On the basis of the above-mentioned device, the device also includes a fourth model training module, and the fourth model training module includes: a verification sample determination unit, an actual label information determination unit, an actual accuracy determination unit and a training determination unit.
[0193] A verification sample determination unit, used to obtain a plurality of verification samples, wherein the verification samples include content to be processed and corresponding verification label information;
[0194] An actual label information determination unit, used for inputting the to-be-processed content and the verification label information into the label attachment model to obtain corresponding actual label information;
[0195] An actual accuracy rate determination unit, used to determine the actual accuracy rate corresponding to each label information according to the verification label information of each verification sample and the corresponding actual label information;
[0196] A training determination unit is used to determine whether to train the label hanging model again based on the actual accuracy and a preset accuracy threshold.
[0197] On the basis of the above device, the device also includes a fifth model training module, and the fifth model training module includes: a fifth sample determination unit and an optimization layer training unit.
[0198] A fifth sample determination unit, configured to obtain a plurality of fifth samples if there is label information whose actual accuracy is lower than the preset accuracy threshold, wherein the fifth samples include the content to be processed and the corresponding theoretical label information;
[0199] An optimization layer training unit is used to train the label orientation optimization layer in the label hanging model based on the fifth sample under the condition of fixing the model parameters of the label encoder, content encoder, first feature map alignment layer and the second feature map alignment layer in the label hanging model to update the label hanging model.
[0200] The technical solution of the embodiment of the present invention is to obtain the information to be identified of the identification information to be determined; input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified; based on the label vector and the information vector, determine the matching degree between each label to be selected and the information to be identified; based on each matching degree, determine the target label corresponding to the information to be identified from the labels to be selected. The technical solution of the embodiment of the present invention solves the technical problems in the prior art of information labeling based on rules, statistics or deep learning models, which leads to low labeling efficiency, poor accuracy and high cost. It is realized by inputting the information to be identified and all the labels to be selected into a pre-trained label attachment model, determining the label vector of each label to be selected and the information vector of the information to be identified based on the label attachment model, and then calculating the matching degree between each label to be selected and the information to be identified based on the label vector and the information vector, so as to characterize the matching degree between the label to be selected and the information to be identified based on the matching degree, and then selecting the target label that matches the information to be identified from the labels to be selected based on each matching degree, so that the identification information annotated for the information to be identified is matched with it, thereby improving the efficiency and accuracy of information labeling and also achieving the technical effect of reducing the cost of information labeling.
[0201] The identification information determination device provided in the embodiment of the present invention can execute the identification information determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0202] On the basis of the above device, a training device for a label hanging model is also provided, which includes: a sample acquisition module, an alignment vector determination module, a sub-model determination module and a hanging model determination module.
[0203] In this embodiment, a sample acquisition module is used to acquire multiple training samples; wherein the training samples include content to be processed, corresponding content titles and theoretical label information; an alignment vector determination module is used to determine, for each training sample, the content to be aligned vector and the title to be aligned vector corresponding to the training sample based on the content to be processed, the content title, the pre-trained label encoder and the content encoder in the training sample; a sub-model determination module is used to determine, for each training sample, the trained content encoder, title encoder, first feature map alignment layer and second feature map alignment layer based on the content to be aligned vector, the title to be aligned vector, the first feature map alignment layer and the second feature map alignment layer of the training sample; a hanging model determination module is used to train the label hanging model for each training sample based on the content to be processed, the theoretical label information, the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer of the training sample, so as to process the information to be identified based on the label hanging model and determine the target label.
[0204] The technical solution of the embodiment of the present invention processes the content title in the training sample based on the label encoder obtained by pre-training, and the content encoder processes the content to be processed to obtain the content to be aligned vector and the title to be aligned vector corresponding to the training sample. Then, based on the content to be aligned vector, the title to be aligned vector, the first feature map alignment layer to be trained, and the second feature map alignment layer to be trained of the training sample, the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer are trained. Furthermore, through the content to be processed of the training sample, the theoretical label information, the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer, the label attachment model is continuously trained to improve the model precision and accuracy, so that the label attachment model outputs a target label that is compatible with the information to be identified, thereby improving the efficiency and accuracy of information annotation.
[0205] The training device for the label attachment model provided in the embodiment of the present invention can execute the training method for the label attachment model provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0206] It is worth noting that the various units and modules included in the above system are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.
[0207] Fig.10 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Fig.10 A block diagram of an exemplary electronic device 60 suitable for implementing exemplary embodiments of the present invention is shown. Fig.10 The electronic device 60 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0208] like Fig.10 As shown, the electronic device 60 is in the form of a general computing device. The components of the electronic device 60 may include but are not limited to: one or more processors or processing units 601, a system memory 602, and a bus 603 connecting different system components (including the system memory 602 and the processing unit 601).
[0209] Bus 603 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0210] The electronic device 60 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 60, including volatile and non-volatile media, removable and non-removable media.
[0211] The system memory 602 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 604 and / or cache memory 605. The electronic device 60 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 606 may be used to read and write non-removable, non-volatile magnetic media ( Fig.10 not shown, usually called a "hard drive"). Although Fig.10 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 603 via one or more data medium interfaces. Memory 602 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of various embodiments of the present invention.
[0212] A program / utility 608 having a set (at least one) of program modules 607 may be stored, for example, in the memory 602, such program modules 607 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 607 generally perform the functions and / or methods of the embodiments described herein.
[0213] The electronic device 60 may also communicate with one or more external devices 609 (e.g., keyboards, pointing devices, displays 810, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 60, and / or may communicate with any device that enables the electronic device 60 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 611. Furthermore, the electronic device 60 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 612. As shown, the network adapter 612 communicates with other modules of the electronic device 60 via a bus 603. It should be understood that although Fig.10 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 60, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0214] The processing unit 601 executes various functional applications and data processing by running the programs stored in the system memory 602, such as implementing the identification information determination method or the label attachment model training method provided in the embodiment of the present invention.
[0215] The embodiment of the present invention further provides a storage medium containing computer executable instructions, which are used to execute a method for determining identification information or a method for training a label attachment model when executed by a computer processor.
[0216] The identification information determination method includes:
[0217] Obtaining the information to be identified of the identification information to be determined;
[0218] Input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified;
[0219] Based on the label vector and the information vector, determining the matching degree between each to-be-selected label and the to-be-identified information;
[0220] Based on each matching degree, a target tag corresponding to the information to be identified is determined from the tags to be selected.
[0221] The training methods of the label attachment model include:
[0222] Acquire multiple training samples; wherein the training samples include content to be processed, corresponding content titles and theoretical label information;
[0223] For each training sample, based on the to-be-processed content, content title, pre-trained label encoder and content encoder in the training sample, determine a content vector to be aligned and a title vector to be aligned corresponding to the training sample;
[0224] For each training sample, based on the content vector to be aligned, the title vector to be aligned, the first feature map alignment layer to be trained, and the second feature map alignment layer to be trained of the training sample, determine the trained content encoder, title encoder, first feature map alignment layer, and second feature map alignment layer;
[0225] For each training sample, the label attachment model is trained based on the content to be processed of the training sample, theoretical label information, the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer, so as to process the information to be identified based on the label attachment model and determine the target label.
[0226] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0227] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0228] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0229] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0230] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for determining identification information, characterized in that: include: Obtaining information to be identified of identification information to be determined; Input the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified; Based on the label vector and the information vector, determining the matching degree between each to-be-selected label and the to-be-identified information; Based on each matching degree, a target tag corresponding to the information to be identified is determined from the tags to be selected.
2. The method according to claim 1, characterized in that The information to be identified includes at least one of text, video frame and image.
3. The method according to claim 1, characterized in that The step of inputting the information to be identified and all pre-set labels to be selected into a pre-trained label anchoring model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified includes: Processing the to-be-selected labels based on the label encoder in the label attachment model to obtain label alignment vectors corresponding to each to-be-selected label; and Processing the information to be identified based on the content encoder in the tag attachment model to obtain a content vector to be aligned; The label vector to be aligned is processed based on a first feature map alignment layer corresponding to the label encoder to obtain a label vector; and the content vector to be aligned is processed based on a second feature map alignment layer corresponding to the content encoder to obtain an information vector.
4. The method according to claim 1, characterized in that: The determining, based on the label vector and the information vector, the degree of matching between each to-be-selected label and the to-be-identified information includes: The cosine similarity between each label vector and the information vector is determined to obtain a matching degree corresponding to each label to be selected.
5. The method according to claim 1, characterized in that The step of determining a target tag corresponding to the information to be identified from the tags to be selected based on the matching degrees includes: Based on the matching degrees and the preset selection conditions, the target tag is determined from the tags to be selected.
6. The method according to claim 1, characterized in that Also includes: Acquire a plurality of first samples and a plurality of second samples, wherein the first samples include theoretical labels and mask labels, and the second samples include content to be processed and corresponding mask content; Pre-training a label encoder in the label attachment model based on the first sample; The content encoder in the label anchoring model is pre-trained based on the second sample.
7. The method according to claim 6, characterized in that The pre-training of the content encoder in the label anchoring model based on the second sample includes: Inputting the mask content into the content encoder to obtain output content; Determining a loss value based on the output content and the content to be processed corresponding to the mask content; Model parameters in the content encoder are modified based on the loss value to obtain a pre-trained content encoder.
8. The method according to claim 6, characterized in that Also includes: Acquire a plurality of third samples, wherein the third samples include content to be processed and corresponding content titles; Inputting the to-be-processed content in the plurality of third samples into a pre-trained content encoder to obtain a content vector to be aligned; and inputting a content title corresponding to the to-be-processed content into a pre-trained label encoder to obtain a title vector to be aligned; Processing the title vector to be aligned based on the first feature mapping alignment layer to obtain a title alignment vector, and processing the content vector to be aligned based on the second feature mapping alignment layer to obtain a content alignment vector; Determine a label probability distribution corresponding to each third sample based on the title alignment vector and the content alignment vector; Based on the label probability distribution and a preset contrast loss function, modifying model parameters in the content encoder, the title encoder, the first feature map alignment layer, and the second feature map alignment layer; The convergence of the contrast loss function is used as a training target to obtain the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer.
9. The method according to claim 8, characterized in that Also includes: Inputting the to-be-processed content and the corresponding theoretical label information in the fourth sample into the label attachment model to obtain output label information corresponding to the to-be-processed content; Based on the output label information, the theoretical label information and a preset contrast loss function, correcting the model parameters in the label attachment model; The convergence of the contrast loss function is used as a training goal to obtain the label attachment model.
10. The method according to claim 9, characterized in that Also includes: Acquire multiple verification samples, wherein the verification samples include content to be processed and corresponding verification label information; Input the content to be processed and the verification label information into the label attachment model to obtain corresponding actual label information; According to the verification label information of each verification sample and the corresponding actual label information, determine the actual accuracy rate corresponding to each label information; Based on the actual accuracy and a preset accuracy threshold, determine whether to train the label anchoring model again.
11. The method according to claim 10, characterized in that Also includes: If there is label information whose actual accuracy is lower than the preset accuracy threshold, a plurality of fifth samples are obtained, wherein the fifth samples include the content to be processed and the corresponding theoretical label information; Under the condition of fixing the model parameters of the label encoder, content encoder, first feature map alignment layer and the second feature map alignment layer in the label hanging model, the label orientation optimization layer in the label hanging model is trained based on the fifth sample to update the label hanging model.
12. A method for training a label-based model, characterized in that: include: Acquire multiple training samples; wherein the training samples include content to be processed, corresponding content titles and theoretical label information; For each training sample, based on the to-be-processed content, content title, pre-trained label encoder and content encoder in the training sample, determine a content vector to be aligned and a title vector to be aligned corresponding to the training sample; For each training sample, based on the content vector to be aligned, the title vector to be aligned, the first feature map alignment layer to be trained, and the second feature map alignment layer to be trained of the training sample, determine the trained content encoder, title encoder, first feature map alignment layer, and second feature map alignment layer; For each training sample, the label attachment model is trained based on the content to be processed of the training sample, theoretical label information, the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer, so as to process the information to be identified based on the label attachment model and determine the target label.
13. A device for determining identification information, characterized in that: include: An information acquisition module, used to acquire information to be identified of identification information to be determined; A vector determination module, used for inputting the information to be identified and all pre-set labels to be selected into a pre-trained label attachment model to obtain a label vector corresponding to each label to be selected and an information vector corresponding to the information to be identified; A matching degree determination module, used to determine the matching degree between each to-be-selected label and the to-be-identified information based on the label vector and the information vector; The target tag determination module is used to determine the target tag corresponding to the information to be identified from the tags to be selected based on the matching degrees.
14. A training device for a label-hanging model, characterized in that: include: A sample acquisition module, used to acquire a plurality of training samples; wherein the training samples include the content to be processed, the corresponding content title and theoretical label information; An alignment vector determination module is used to determine, for each training sample, a content vector to be aligned and a title vector to be aligned corresponding to the training sample based on the content to be processed, the content title, the pre-trained label encoder and the content encoder in the training sample; A sub-model determination module is used to determine, for each training sample, a content encoder, a title encoder, a first feature map alignment layer, and a second feature map alignment layer obtained by training based on the content vector to be aligned, the title vector to be aligned, the first feature map alignment layer to be trained, and the second feature map alignment layer to be trained of the training sample; The hanging model determination module is used to train the label hanging model for each training sample based on the content to be processed of the training sample, theoretical label information, the content encoder, the title encoder, the first feature map alignment layer and the second feature map alignment layer, so as to process the information to be identified based on the label hanging model and determine the target label.
15. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the identification information determination method as described in any one of claims 1 to 11 or the label hanging model training method as described in claim 12.
16. A storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the identification information determination method according to any one of claims 1 to 11 or the label attachment model training method according to claim 12.
Citation Information
Patent Citations
Model training method and device, computer equipment and storage medium
CN114612728A
Model training method applied to text recognition and text recognition method and device
CN114625874A
Cited By
Medical image segmentation method and device based on text driving and affinity learning
CN119672347A
