Model training method and device, readable medium and program product

By integrating the text data in the video content with the label information related to the business scenario and training the target prediction model, the problem of insufficient risk assessment accuracy in the risk prediction of traditional OCR technology in video content is solved, and more efficient and accurate risk prediction is achieved.

CN119919853APending Publication Date: 2025-05-02SHANGHAI HODE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411997114.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

Traditional optical character recognition (OCR) technology only conducts risk assessments for the identified text information in video content risk prediction, resulting in the accuracy of risk prediction.

Method used

By obtaining the text data and label data of the target sample image, the multi-headed attention mechanism of the target prediction model is used to fuse the text data and label information, and text representation information fused with the label information is generated, and the target prediction model is trained based on the business training data to output the risk prediction results.

Benefits of technology

The risk prediction capability of the target prediction model in different business scenarios has been improved, and the accuracy and efficiency of risk prediction have been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919853A_ABST
    Figure CN119919853A_ABST
Patent Text Reader

Abstract

The invention provides a model training method, a method and device for processing data, electronic equipment, a computer readable medium and a computer program product. The method comprises the steps of obtaining text data and label data of a target sample image, wherein the label data comprises label information corresponding to different business scenes; performing fusion processing on the text data and the label information through a multi-head attention mechanism of the target prediction model to obtain corresponding text representation information fused with the label information; and training the target prediction model based on the business training data. According to the method, the target prediction model outputs different risk prediction results based on different combinations of the text data and the labels, so that the risk prediction capability of the model in a specific business scene is improved, and the risk prediction accuracy and efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a model training method, device, electronic device, computer-readable medium and computer program product. Background Art

[0002] In the scenario of risk prediction of video content, optical character recognition (OCR) technology is used to extract text information in the video and compare it with the preset keyword library in the content management system to ensure the suitability of the content. However, traditional OCR solutions usually only perform risk assessment on the recognized text information, and the accuracy of risk prediction needs to be improved. Summary of the invention

[0003] Multiple aspects of the present application provide a model training method, apparatus, electronic device, computer-readable medium, and computer program product.

[0004] In one aspect of the present application, a model training method is provided, wherein the method comprises:

[0005] Acquire text data and label data of a target sample image, wherein the label data includes label information corresponding to different business scenarios;

[0006] The text data and label information are fused through the multi-head attention mechanism of the target prediction model to obtain the corresponding text representation information fused with the label information;

[0007] The target prediction model is trained based on business training data, wherein the business training data includes text representation information of multiple target sample images fused with label information and risk prediction results for different business scenarios, which are used for target prediction model learning and outputting risk prediction results.

[0008] In one aspect of the present application, a model training device is provided, wherein the device comprises:

[0009] Device for acquiring target text data and label data, wherein the label data includes label information corresponding to different business scenarios;

[0010] A device for fusing text data and label information through a multi-head attention mechanism to obtain corresponding text representation information fused with label information;

[0011] A device for training a target prediction model based on business training data, wherein the business training data includes text representation information of multiple target sample images fused with label information and risk prediction results for different business scenarios, and is used for target prediction model learning and outputting risk prediction results.

[0012] Another aspect of the present application is an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of an embodiment of the present application.

[0013] In another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the method of the embodiment of the present application.

[0014] Another aspect of the present application provides a computer program product, including a computer program, which implements the method of the embodiment of the present application when executed by a processor.

[0015] In the solution provided in the embodiment of the present application, by fusing text data and the number of labels corresponding to different business scenario data, and training the target prediction model based on the fused label information, the target prediction model is implemented based on different combinations of text data and labels, and outputs different risk prediction results, thereby improving the risk prediction ability of the model in specific business scenarios and improving the accuracy and efficiency of risk prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0017] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0018] Figure 1 A schematic diagram of a process of a model training method according to an embodiment of the present application is shown;

[0019] Figure 2 A flow chart of a method for processing data according to an embodiment of the present application is shown.

[0020] Figure 3 A schematic diagram of an exemplary model structure according to an embodiment of the present application is shown;

[0021] Figure 4 A schematic diagram of the structure of a model training device according to an embodiment of the present application is shown;

[0022] Figure 5A schematic diagram of the structure of a device for processing data according to an embodiment of the present application is shown;

[0023] Figure 6 A schematic diagram of the structure of a device suitable for implementing the solution in the embodiment of the present application is shown.

[0024] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0026] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPU), input / output interface, network interface and memory.

[0027] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0028] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer program instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0029] Figure 1 A flow chart of a model training method according to an embodiment of the present application is shown. The method at least includes step S101, step S102 and step S103.

[0030] In actual scenarios, the execution subject of the method can be a network device, or an application running on a network device, wherein the network device includes but is not limited to a network host, a single network server, a plurality of network server sets, or a collection of computers based on cloud computing, and can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, wherein cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computers.

[0031] The concepts involved in the embodiments of the present application are explained below.

[0032] Multi-head attention mechanism: The original input sequence is processed by multiple groups of self-attention processes; then the results of each group of self-attention are concatenated and a linear transformation is performed to obtain the final output result.

[0033] BERT model: BERT (Bidirectional Encoder Representations from Transformers) is a bidirectional encoding representation method based on the Transformer unit. The Transformer unit is an encoding unit based on the self-attention mechanism.

[0034] According to the method of the embodiment of the present application, the text data and the number of labels corresponding to different business scenario data are fused, and the target prediction model is trained based on the fused label information, so that the target prediction model outputs different risk prediction results based on different combinations of text data and labels. For example, scenarios with higher risks may include sensitive words appearing in game IDs, subtitles being tampered with in video works, or sensitive information appearing in chat texts. Through the combination of different text data and labels in the method of the embodiment of the present application, different risk scores can be output for the above three scenarios.

[0035] In some embodiments, the target prediction model of the embodiments of the present application is a BERT-based model.

[0036] Reference Figure 1 In step S101, text data and label data of a target sample image are obtained, and the label data includes label information corresponding to different business scenarios.

[0037] The target sample images may include various types of images involving texts with inappropriate content, such as video frames and the like.

[0038] Optionally, the method collects target sample images containing inappropriate content and annotates them to indicate corresponding risk levels.

[0039] The text data is the text content contained in the target sample image. The method can identify the text content contained in the target sample image by OCR (Optical Character Recognition) technology or other methods for identifying image text.

[0040] The business scenario refers to a specific situation or environment related to business processes, operations or decisions in a specific business field or industry. Each business scenario corresponds to a different tag or tag combination. That is, for different business scenarios, risk prediction can be performed based on specific one or more tag information.

[0041] According to one embodiment, the label data includes label text data, label discrete data and / or label digital data. The label text data includes text associated with the label, and the text content can provide descriptive, indicative or classification information. The label discrete data includes a series of data with discrete features, which are countable, mutually exclusive, and are usually used to represent classification attributes. The label digital data includes label data in various numerical forms.

[0042] The following describes the label text data, label discrete data, and label digital data of this embodiment in conjunction with the scenario of video risk prediction. In the scenario of video risk prediction, the business scenario may include live broadcast, video publishing, etc. The label data includes but is not limited to at least any of the following:

[0043] 1) Label text data: including but not limited to video partitions, video titles, video tags, or relevant information about the video uploader;

[0044] 2) Label discrete data: including but not limited to the position of text in the video frame, the video start location or screen status, etc.;

[0045] 3) Label digital data: including but not limited to broadcast time, number of fans or OCR text confidence, etc. The OCR text confidence reflects the credibility of the recognition result and can be used as an indicator of the possibility of the recognition text being correct.

[0046] It should be noted that the data such as text data and label data involved in the embodiments of the present application are obtained with the consent or permission of the relevant objects. In addition, the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0047] Optionally, the method preprocesses the target text data and the label data. Specifically, the text data is cleaned to remove irrelevant information, such as stop words, punctuation marks, etc. The label data is encoded to make it consistent with the format of the text data.

[0048] In step S102, the text data and label information are fused through the multi-head attention mechanism of the target prediction model to obtain corresponding text representation information fused with the label information.

[0049] According to one embodiment, step S102 includes steps S1021 to S1023.

[0050] In step S1021, word embedding is performed to obtain text feature representation corresponding to the text data.

[0051] Among them, text can be converted into vector representation through word embedding technologies such as Word2Vec and GloVe.

[0052] In step S1022, by performing tag embedding, a tag feature representation corresponding to the tag information is obtained.

[0053] Among them, label embedding is the process of mapping discrete category labels to continuous vector space. Through label embedding, each label is converted into a vector of fixed dimension. This vector can be used as part of the model input and participate in model training and prediction together with text features.

[0054] If the label data includes label text data, label discrete data and / or label digital data, the step S1022 further includes:

[0055] For labeled text data, a fixed-length vector representation is obtained by embedding the text content as the corresponding label feature representation.

[0056] For label discrete data, the discrete features corresponding to the label discrete data are converted into continuous vector representations as the corresponding label feature representations. Optionally, the discrete features can be converted into continuous vector representations through one-hot encoding or embedding layer.

[0057] For the label digital data, the corresponding label feature representation is obtained based on the value of the label digital data. Specifically, the value of the label digital data can be directly used as the label feature representation corresponding to the label, or the value of the label digital data can be normalized and the normalized value can be used as the corresponding label feature representation.

[0058] Optionally, the method fuses the label feature representations corresponding to the label text data, label discrete data and / or label digital data. Specifically, the label feature representations corresponding to the label text data, label discrete data and / or label digital data can be fused by feature concatenation, feature summation or weighted summation, and the fused label feature representations are used as the label feature representations corresponding to the label data.

[0059] In step S1023, the text feature representation and the label feature representation are input into the target prediction model, and fused through a multi-head attention mechanism to obtain text representation information fused with label information.

[0060] Continue to refer to Figure 1 To illustrate, in step S103, the target prediction model is trained based on the business training data.

[0061] The business training data includes text representation information of multiple target sample images integrated with label information and risk prediction results for different business scenarios, which are used for target prediction model learning and outputting risk prediction results.

[0062] Optionally, the risk prediction result includes a determination result indicating whether a risk criterion is met.

[0063] Optionally, the risk prediction result includes a risk score, which reflects the model's assessment of the risk level of the input data.

[0064] Specifically, step S103 includes steps S1031 to S1033.

[0065] In step S1031, business training data is constructed, wherein the business training data includes text representation information of multiple target sample images fused with label information and risk prediction results for different business scenarios.

[0066] It should be noted that the risk prediction result of the same text representation information integrated with label information in one business scenario may be the same as or different from that in another business scenario.

[0067] In step S1032, the target prediction model obtains a predicted risk result based on the input target sample image.

[0068] In step S1033, the target prediction model is continuously updated according to the difference between the predicted risk result and the actual risk prediction result of the sample image until the difference meets the predetermined requirement. Specifically, the method performs multiple iterations of training, calculates the loss between the predicted risk result obtained in each iteration and the actual risk prediction result of the sample, and updates the model parameters based on the calculated loss.

[0069] According to one embodiment, the target prediction model is a BERT model. The method of this embodiment obtains text feature representation and label feature representation through the embedding layer of the BERT model, and fuses the input text feature representation and label feature representation through a multi-head attention layer in the BERT model to obtain text representation information that integrates label information.

[0070] Optionally, the BERT model also includes a multi-layer perceptron (MLP). The method of this embodiment processes the text representation information output by the multi-head attention layer through the multi-layer perceptron.

[0071] According to one embodiment, the method further includes step S104.

[0072] In step S104, during the training process, the weight distribution of the multi-head attention mechanism in the target prediction model is adjusted through a gating mechanism or an adaptive pooling technology.

[0073] The gating mechanism is a method for controlling the flow of information, which allows the model to selectively activate or inhibit certain features or modalities in different contexts. Since the gating mechanism directly affects the model's attention to different features, this mechanism can be seen as a way to implicitly adjust weights.

[0074] Specifically, the multi-head attention weights of the target prediction model are adjusted by introducing a gating signal. The gating signal can be a scalar value or a vector value, which determines the activation degree of each feature or modality. For features that require more attention, the gating mechanism can increase the weights of related features to achieve attention to these features. For features that are irrelevant to the current or other features that do not need attention, the gating mechanism can suppress the influence of these features by reducing the weights of these features.

[0075] Optionally, the method is based on a sigmoid function, a softmax function or other neural network structures to adjust the multi-head attention weights through a gating mechanism.

[0076] Among them, the adaptive pooling technology allows the model to dynamically adjust the size of the pooling window according to the input features. Specifically, adaptive pooling can more flexibly capture key information in the data by dynamically adjusting the size of the pooling window according to the input features. This adjustment can be based on the current learning state of the model or on specific features of the input data. By changing the size of the pooling window, adaptive pooling is actually also adjusting the weights of different features, where a larger pooling window may reduce the weight of local features, while a smaller pooling window may increase the weight of local features.

[0077] According to one embodiment, the method can combine the gating mechanism and adaptive pooling technology to adjust the multi-head attention weights of the target prediction model. Through the gating mechanism, the model can selectively focus on or ignore specific features, while adaptive pooling can dynamically adjust the size of the pooling window according to the importance of these features. This approach enables the target prediction model to better handle complex and changeable data structures, thereby achieving more refined adjustment of weights and improving the accuracy and efficiency of risk prediction.

[0078] According to the method of the embodiment of the present application, by fusing text data and the number of labels corresponding to different business scenario data, and training the target prediction model based on the fused label information, the target prediction model is implemented based on different combinations of text data and labels, and outputs different risk prediction results, thereby improving the risk prediction ability of the model in specific business scenarios, and improving the accuracy and efficiency of risk prediction.

[0079] Figure 2 A flow chart of a method for processing data according to an embodiment of the present application is shown. Figure 2 The steps shown include step S201 to step S203.

[0080] Reference Figure 2 In step S201, text data corresponding to the data to be processed is obtained.

[0081] According to one embodiment, the data to be processed includes but is not limited to videos containing text for which risk prediction is required, and the method obtains corresponding text data by performing OCR detection on the data to be processed.

[0082] In step S202, label information corresponding to the business scenario of the data to be processed is obtained.

[0083] The tag information and the acquisition process have been described in the above steps S101 to S103 and will not be repeated here.

[0084] In step S203, the trained target prediction model is used to output corresponding risk prediction results based on the text data and label information.

[0085] The trained target model is obtained by training the above steps S101 to S103 based on the data set corresponding to the task.

[0086] According to the method of this embodiment, by fusing text data and the number of labels corresponding to different business scenario data, and training the target prediction model based on the fused label information, the target prediction model is implemented based on different combinations of text data and labels, and outputs different risk prediction results, thereby improving the risk prediction ability of the model in specific business scenarios, and improving the accuracy and efficiency of risk prediction.

[0087] Refer to the following Figure 3 The exemplary model structure shown is used to illustrate the method of the embodiment of the present application.

[0088] Reference Figure 3 The model in this example is a risk classification model based on the BERT model or a risk classification model similar to the BERT model (expressed as a Bert like model). This model implements different risk prediction results based on different combinations of text data and labels. The data to be processed in this example is a video containing text on a video website.

[0089] Refer to the following Figure 3 The structure shown introduces this example:

[0090] Feature input: Feature input consists of two parts, one is the features corresponding to the text data, and the other is the features corresponding to the label data. The words in the text data can be represented as W1, W2, W3, W4, etc. Each word is first input into the BERT model of this example, and each word is converted into a word embedding through the embedding layer of the BERT model. These embeddings capture the semantic information of the word. In addition, the labels contained in the label data are converted into label embeddings. These labels represent certain attributes or classification information of the document, such as the partition, title, and label of the video.

[0091] Multi-head attention: Tag embeddings are input into the multi-head attention mechanism together with word embeddings, allowing the model to consider both text content and related tag information. The model uses a multi-head attention mechanism to focus on the importance of different features at the same time, which helps the model be more flexible in dealing with complex and changing business scenarios. This mechanism can process multiple attention heads in parallel, with each head learning different aspects of the input.

[0092] Document representation: After being processed by the multi-head attention mechanism, the representation of each word is aggregated (e.g., by taking the average) to form a document-level representation. This document representation combines the information of all words in the document and the relevant label information.

[0093] Next, the document representation is fed into a multi-layer perceptron (MLP), a feed-forward neural network, which is used to further process the document representation and generate the final output.

[0094] Output: The output layer may be used for classification tasks, such as determining whether the content of a document is appropriate. The model calculates a risk score based on the extracted features, which represents the model's assessment of the risk level of the input content.

[0095] When the model of this example is applied to the actual video content risk prediction task, the model will receive the video content and extract features corresponding to the text data and label data. Among them, the text data includes the text in the video, and the label data includes the video partition, video title, video label, up master information, the position of the text in the video, the broadcast location, screen status, broadcast time, number of fans, and OCR text confidence, etc. The model processes the input features corresponding to the text data and label data through the multi-head attention mechanism, and based on the multi-head attention weights obtained by training, determines whether the video content meets the risk standards and outputs the corresponding risk score.

[0096] Figure 4 A schematic diagram of the structure of a model training device according to an embodiment of the present application is shown. The device includes: a device for acquiring target text data and label data, wherein the label data includes label information corresponding to different business scenarios (hereinafter referred to as "data acquisition device 101"), a device for fusing text data and label information through a multi-head attention mechanism to obtain corresponding text representation information fused with label information (hereinafter referred to as "fusion processing device 102"), and a device for training a target prediction model based on business training data (hereinafter referred to as "model training device 103").

[0097] Reference Figure 4 The data acquisition device 101 acquires text data and label data of the target sample image, and the label data includes label information corresponding to different business scenarios.

[0098] The target sample images may include various types of images involving texts with inappropriate content, such as video frames and the like.

[0099] Optionally, the data acquisition device 101 collects target sample images containing inappropriate content and annotates them to indicate corresponding risk levels.

[0100] The text data is the text content contained in the target sample image. The method can identify the text content contained in the target sample image by OCR (Optical Character Recognition) technology or other methods for identifying image text.

[0101] The business scenario refers to a specific situation or environment related to business processes, operations or decisions in a specific business field or industry. Each business scenario corresponds to a different tag or tag combination. That is, for different business scenarios, risk prediction can be performed based on specific one or more tag information.

[0102] According to one embodiment, the label data includes label text data, label discrete data and / or label digital data. The label text data includes text associated with the label, and the text content can provide descriptive, indicative or classification information. The label discrete data includes a series of data with discrete features, which are countable, mutually exclusive, and are usually used to represent classification attributes. The label digital data includes label data in various numerical forms.

[0103] The following describes the label text data, label discrete data, and label digital data of this embodiment in conjunction with the scenario of video risk prediction. In the scenario of video violation prediction, the business scenario may include live broadcast, video publishing, etc. The label data includes but is not limited to at least any of the following:

[0104] 1) Label text data: including but not limited to video partitions, video titles, video tags, or relevant information about the video uploader;

[0105] 2) Label discrete data: including but not limited to the position of text in the video frame, the video start location or screen status, etc.;

[0106] 3) Label digital data: including but not limited to broadcast time, number of fans or OCR text confidence, etc. The OCR text confidence reflects the credibility of the recognition result and can be used as an indicator of the possibility of the recognition text being correct.

[0107] It should be noted that the data such as text data and label data involved in the embodiments of the present application are obtained with the consent or permission of the relevant objects. In addition, the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0108] Optionally, the device preprocesses the target text data and the label data. Specifically, the text data is cleaned to remove irrelevant information, such as stop words, punctuation marks, etc. The label data is encoded to make it consistent with the format of the text data.

[0109] The fusion processing device 102 fuses the text data and label information through a multi-head attention mechanism to obtain corresponding text representation information that incorporates the label information.

[0110] According to one embodiment, the fusion processing device 102 includes a word embedding device, a tag embedding device and a feature fusion device.

[0111] The word embedding device obtains the corresponding text feature representation of the text data by performing word embedding.

[0112] Among them, text can be converted into vector representation through word embedding technologies such as Word2Vec and GloVe.

[0113] The tag embedding device obtains the tag feature representation corresponding to the tag information by performing tag embedding.

[0114] Among them, label embedding is the process of mapping discrete category labels to continuous vector space. Through label embedding, each label is converted into a vector of fixed dimension. This vector can be used as part of the model input and participate in model training and prediction together with text features.

[0115] If the label data includes label text data, label discrete data and / or label digital data, the label embedding device is further used for:

[0116] For labeled text data, a fixed-length vector representation is obtained by embedding the text content as the corresponding label feature representation.

[0117] For label discrete data, the discrete features corresponding to the label discrete data are converted into continuous vector representations as the corresponding label feature representations. Optionally, the discrete features can be converted into continuous vector representations through one-hot encoding or embedding layer.

[0118] For the label digital data, the corresponding label feature representation is obtained based on the value of the label digital data. Specifically, the value of the label digital data can be directly used as the label feature representation corresponding to the label, or the value of the label digital data can be normalized and the normalized value can be used as the corresponding label feature representation.

[0119] Optionally, the label embedding device fuses the label feature representations corresponding to the label text data, label discrete data and / or label digital data. Specifically, the label feature representations corresponding to the label text data, label discrete data and / or label digital data can be fused by feature concatenation, feature summation or weighted summation, and the fused label feature representations are used as the label feature representations corresponding to the label data.

[0120] The feature fusion device inputs the text feature representation and the label feature representation into the target prediction model, performs fusion processing through a multi-head attention mechanism, and obtains text representation information that integrates the label information.

[0121] Continue to refer to Figure 4 To explain, the model training device 103 trains the target prediction model based on the business training data.

[0122] The business training data includes text representation information of multiple target sample images integrated with label information and risk prediction results for different business scenarios, which are used for target prediction model learning and outputting risk prediction results.

[0123] Optionally, the risk prediction result includes a determination result indicating whether a risk criterion is met.

[0124] Optionally, the risk prediction result includes a risk score, which reflects the model's assessment of the risk level of the input data.

[0125] Specifically, the model training device 103 is used to:

[0126] Construct business training data. The business training data includes text representation information of multiple target sample images integrated with label information and risk prediction results for different business scenarios. It should be noted that the risk prediction results of the same text representation information integrated with label information in one business scenario may be the same as or different from those in another business scenario.

[0127] Next, the target prediction model is used to obtain a predicted risk result based on the input target sample image.

[0128] Next, according to the difference between the predicted risk result and the actual risk prediction result of the sample image, the target prediction model is continuously updated until the difference meets the predetermined requirement. Specifically, the model training device 103 performs multiple iterations of training, calculates the loss between the predicted risk result obtained in each iteration and the actual risk prediction result of the sample, and updates the model parameters based on the calculated loss.

[0129] According to one embodiment, the target prediction model is a BERT model. The device of this embodiment obtains text feature representation and label feature representation through the embedding layer of the BERT model, and fuses the input text feature representation and label feature representation through a multi-head attention layer in the BERT model to obtain text representation information that integrates label information.

[0130] Optionally, the BERT model also includes a multi-layer perceptron (MLP), and the device of this embodiment processes the text representation information output by the multi-head attention layer through the multi-layer perceptron.

[0131] According to one embodiment, the device further comprises a weight adjustment device.

[0132] During the training process, the weight adjustment device adjusts the weight distribution of the multi-head attention mechanism in the target prediction model through a gating mechanism or an adaptive pooling technology.

[0133] The gating mechanism is a method for controlling the flow of information, which allows the model to selectively activate or inhibit certain features or modalities in different contexts. Since the gating mechanism directly affects the model's attention to different features, this mechanism can be seen as a way to implicitly adjust weights.

[0134] Specifically, the multi-head attention weights of the target prediction model are adjusted by introducing a gating signal. The gating signal can be a scalar value or a vector value, which determines the activation degree of each feature or modality. For features that require more attention, the gating mechanism can increase the weights of related features to achieve attention to these features. For features that are irrelevant to the current or other features that do not need attention, the gating mechanism can suppress the influence of these features by reducing the weights of these features.

[0135] Optionally, the weight adjustment device adjusts the multi-head attention weights through a gating mechanism based on a sigmoid function, a softmax function or other neural network structures.

[0136] Among them, the adaptive pooling technology allows the model to dynamically adjust the size of the pooling window according to the input features. Specifically, adaptive pooling can more flexibly capture key information in the data by dynamically adjusting the size of the pooling window according to the input features. This adjustment can be based on the current learning state of the model or on specific features of the input data. By changing the size of the pooling window, adaptive pooling is actually also adjusting the weights of different features, where a larger pooling window may reduce the weight of local features, while a smaller pooling window may increase the weight of local features.

[0137] According to one embodiment, the weight adjustment device can adjust the multi-head attention weights of the target prediction model in combination with the gating mechanism and the adaptive pooling technology. Through the gating mechanism, the model can selectively focus on or ignore specific features, while the adaptive pooling can dynamically adjust the size of the pooling window according to the importance of these features. This approach enables the target prediction model to better handle complex and changeable data structures, thereby achieving more refined adjustment of weights and improving the accuracy and efficiency of risk prediction.

[0138] According to the device of the embodiment of the present application, by fusing text data and the number of labels corresponding to different business scenario data, and training the target prediction model based on the fused label information, the target prediction model is implemented based on different combinations of text data and labels, and outputs different risk prediction results, thereby improving the risk prediction ability of the model in specific business scenarios and improving the accuracy and efficiency of risk prediction.

[0139] Figure 5 A schematic structural diagram of a device for processing data according to an embodiment of the present application is shown.

[0140] The device includes: a device for obtaining text data corresponding to the data to be processed (hereinafter referred to as "text obtaining device 201"), a device for obtaining label information corresponding to the business scenario of the data to be processed (hereinafter referred to as "label obtaining device 202"), and a device for using a trained target prediction model to output corresponding risk prediction results based on the text data and label information (hereinafter referred to as "risk prediction device 203").

[0141] The text acquisition means 201 acquires text data corresponding to the data to be processed.

[0142] According to one embodiment, the data to be processed includes but is not limited to videos containing text that need to be risk assessed, and the text acquisition device 201 obtains corresponding text data by performing OCR detection on the data to be processed.

[0143] The label acquisition means 202 acquires label information corresponding to the business scenario of the data to be processed.

[0144] The tag information and the acquisition process have been described in the above steps S101 to S103 and will not be repeated here.

[0145] In step S203, the trained target prediction model is used to output corresponding risk prediction results based on the text data and label information.

[0146] The trained target model is obtained by training the above steps S101 to S103 based on the data set corresponding to the task.

[0147] According to the device of this embodiment, by fusing text data and the number of labels corresponding to different business scenario data, and training the target prediction model based on the fused label information, the target prediction model is implemented based on different combinations of text data and labels, and outputs different risk prediction results, thereby improving the risk prediction ability of the model in specific business scenarios and improving the accuracy and efficiency of risk prediction.

[0148] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the method corresponding to the electronic device may be the method in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.

[0149] The electronic device may be a user device, or a device formed by integrating a user device and a network device through a network, or may be an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.

[0150] Figure 6 The structure of a device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown, and the device 1200 includes a central processing unit (CPU, Central Processing Unit) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM, Read Only Memory) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM, Random Access Memory) 1203. In RAM1203, various programs and data required for system operation are also stored. CPU 1201, ROM 1202 and RAM 1203 are connected to each other through bus 1204. Input / output (I / O, Input / Output) interface 1205 is also connected to bus 1204.

[0151] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker, etc.; a storage section 1208 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet.

[0152] In particular, the methods and / or embodiments in the embodiments of the present application may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 1201, the above functions defined in the method of the present application are executed.

[0153] Another embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application described above.

[0154] Specifically, the present embodiment may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. 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 thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device, or device.

[0155] Computer readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a 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.

[0156] 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.

[0157] Computer program code for performing the operations of the present application 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 a separate 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 through 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).

[0158] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0159] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0160] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0161] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0162] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0163] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0164] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

[0165] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in a device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

Claims

1. A model training method, wherein: The method comprises: Acquire text data and label data of a target sample image, wherein the label data includes label information corresponding to different business scenarios; The text data and label information are fused through the multi-head attention mechanism of the target prediction model to obtain the corresponding text representation information fused with the label information; The target prediction model is trained based on business training data, wherein the business training data includes text representation information of multiple target sample images fused with label information and risk prediction results for different business scenarios, which are used for target prediction model learning and outputting risk prediction results.

2. The method according to claim 1, wherein: The text data and label information are fused through the multi-head attention mechanism of the target prediction model to obtain the corresponding text representation information fused with the label information, including: By performing word embedding, the corresponding text feature representation of the text data is obtained; By embedding labels, the label feature representation corresponding to the label information is obtained; The text feature representation and label feature representation are input into the target prediction model, and fused through a multi-head attention mechanism to obtain text representation information fused with label information.

3. The method according to claim 2, wherein: The label data includes label text data, label discrete data and / or label digital data, and the label feature representation corresponding to the label information obtained by label embedding includes: For label text data, a fixed-length vector representation is obtained by embedding the text content as the corresponding label feature representation; For label discrete data, the discrete features corresponding to the label discrete data are converted into continuous vector representations as the corresponding label feature representations; For the labeled digital data, the corresponding label feature representation is obtained based on the numerical value of the labeled digital data.

4. The method according to claim 3, wherein: The method further comprises: The label feature representations corresponding to the label text data, the label discrete data and / or the label digital data are fused.

5. The method according to claim 1, wherein: The training target prediction model based on the business training data includes: Constructing business training data, wherein the business training data includes text representation information of multiple target sample images fused with label information and risk prediction results for different business scenarios; Obtaining the predicted risk result obtained by the target prediction model based on the input target sample image; According to the difference between the predicted risk result and the actual risk prediction result of the sample image, the target prediction model is continuously updated until the difference meets the predetermined requirement.

6. The method according to claim 1 or 2, wherein: The target prediction model is a BERT model, and the method further includes: The text feature representation and label feature representation are obtained through the embedding layer of the BERT model; In the BERT model, the input text feature representation and label feature representation are fused through a multi-head attention layer to obtain text representation information that incorporates label information.

7. The method according to any one of claims 1 to 6, wherein: The method further comprises: Obtain text data corresponding to the data to be processed; Obtain label information corresponding to the business scenario of the data to be processed; Use the trained target prediction model to output corresponding risk prediction results based on the text data and label information.

8. A model training device, wherein: The device comprises: A device for acquiring text data and label data of a target sample image, wherein the label data includes label information corresponding to different business scenarios; A device for fusing text data and label information through a multi-head attention mechanism of a target prediction model to obtain corresponding text representation information fused with label information; A device for training a target prediction model based on business training data, wherein the business training data includes text representation information of multiple target sample images fused with label information and risk prediction results for different business scenarios, and is used for target prediction model learning and outputting risk prediction results.

9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

10. A computer readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 7.

11. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.