Content classification method, device, electronic device and storage medium
By using feature extraction of text description information and hierarchical category probability prediction in the content classification method, the problem of failing to effectively utilize label constraint relationships in the prior art is solved, and the accuracy of content hierarchical classification is improved.
Patent Information
- Application Number
- CN202110837092.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-23
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-07-23
AI Technical Summary
The prior art fails to effectively utilize the upper and lower-level constraint relationships of labels in content-level classification, resulting in low classification accuracy.
By obtaining text description information of content to be classified, feature extraction and prediction of the first level category probability, determining the first category based on the probability, and using the first category probability and text feature information to predict the second level category probability, and then determining the classification information of the content to be classified.
The accuracy of content-level classification is improved, and the classification effect is enhanced by utilizing the relationship between superior and subordinate categories.
Smart Images

Figure CN113821634B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a content classification method, device, electronic device and storage medium. Background Art
[0002] With the development of computer technology, multimedia applications are becoming more and more widespread, and various content information (such as videos, images, articles, etc.) is also growing rapidly. In order to facilitate users to quickly obtain the content they want to watch from the massive amount of content, content display platforms usually classify the large amount of content on the platform. Content classification plays a very important role in realizing content management and interest recommendation. In addition, content classification technology is widely used in fields such as retrieval and human-computer interaction.
[0003] Hierarchical classification is an important task in the field of content classification. Its main feature is that category labels have a hierarchical relationship, and the upper label is the parent of the lower label.
[0004] In current related technologies, hierarchical classification is usually regarded as several basic multi-classification tasks, the category system is flattened, and the classification model directly predicts the secondary category of the content information, and then the predicted secondary category results are used to trace back to the primary category. For example, the secondary category predicted by the classification model is "mobile phone". Based on the secondary category "mobile phone", it can be traced back to determine that the primary category of the content information is "technology". This does not make good use of the upper and lower constraints of the labels, resulting in low classification accuracy. Summary of the invention
[0005] The embodiments of the present application provide a content classification method, device, electronic device and storage medium, which can improve the accuracy of content hierarchical classification.
[0006] The present application provides a content classification method, including:
[0007] Acquire text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain text feature information corresponding to the text description information;
[0008] Predicting, based on the text feature information, a probability that the text description information belongs to a first category of a preset category in a first level category;
[0009] Based on the first category probability, determining a first category of the text description information in the first level category from preset categories of the first level category;
[0010] Predicting, based on the first category probability and the text feature information, a probability that the text description information belongs to a second category of a preset category in a second level category, where the second level category and the first level category have different category levels;
[0011] Based on the second category probability, determining a second category of the text description information in the second level category from preset categories of the second level category;
[0012] According to the first category and the second category, classification information of the content to be classified is determined.
[0013] Accordingly, an embodiment of the present application provides a content classification device, including:
[0014] An extraction unit, used to obtain text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain text feature information corresponding to the text description information;
[0015] A first prediction unit, configured to predict, based on the text feature information, a probability that the text description information belongs to a first category of a preset category in a first level category;
[0016] A first determining unit, configured to determine, based on the first category probability, a first category of the text description information in the first hierarchical category from preset categories of the first hierarchical category;
[0017] A second prediction unit is used to predict the probability that the text description information belongs to a second category of a preset category in a second level category according to the first category probability and the text feature information, wherein the second level category and the first level category have different category levels;
[0018] A second determining unit, configured to determine, based on the second category probability, a second category of the text description information in the second level category from preset categories of the second level category;
[0019] The third determining unit is configured to determine classification information of the content to be classified according to the first category and the second category.
[0020] Optionally, in some embodiments of the present application, the second prediction unit may include a first fusion subunit and a first prediction subunit, as follows:
[0021] The first fusion subunit is used to fuse the category information corresponding to the preset category in the first level category with the first category probability to obtain the category feature information of the preset category in the first level category;
[0022] The first prediction subunit is used to predict the second category probability that the text description information belongs to a preset category in the second level category according to the category feature information and the text feature information.
[0023] Optionally, in some embodiments of the present application, the first fusion subunit can be specifically used to select a reference category from preset categories of the first-level categories based on the first category probability; fuse the category information corresponding to the reference category and the first category probability corresponding to the reference category to obtain category feature information of the reference category in the first-level categories.
[0024] Optionally, in some embodiments of the present application, the first prediction subunit can be specifically used to fuse the category feature information and the text feature information to obtain fused feature information; perform convolution processing on the fused feature information in multiple dimensions to obtain convolution feature information in multiple dimensions; and predict the probability of the text description information belonging to a second category preset in a second-level category based on the convolution feature information in each dimension.
[0025] Optionally, in some embodiments of the present application, the step of “predicting the probability that the text description information belongs to a second category of a preset category in the second level category according to the convolution feature information in each dimension” may include:
[0026] The convolution feature information in each dimension is fused to obtain multi-dimensional fusion information;
[0027] The probability of the text description information belonging to a second category preset in a second level category is predicted according to the multi-dimensional fusion information.
[0028] Optionally, in some embodiments of the present application, the second prediction unit may include a selection subunit, a second fusion subunit, and a second prediction subunit, as follows:
[0029] The selection subunit is used to select a reference category from preset categories of the first level categories based on the first category probability;
[0030] A second fusion subunit is used to fuse the category information corresponding to the reference category with the text feature information to obtain fused feature information of the text description information;
[0031] The second prediction subunit is used to predict the probability of the text description information belonging to a second category preset in the second level category according to the fused feature information.
[0032] Optionally, in some embodiments of the present application, the extraction unit may be specifically configured to perform feature extraction on the text description information through a classification model to obtain text feature information corresponding to the text description information.
[0033] Optionally, in some embodiments of the present application, the content classification device may further include a training unit, and the training unit is used to train the classification model; specifically as follows:
[0034] The training unit is used to obtain training data, which includes sample text description information, expected first category probability that the sample text description information belongs to a preset category in a first-level category, and expected second category probability that the sample text description information belongs to a preset category in a second-level category; feature extraction is performed on the sample text description information through a preset classification model to obtain text feature information corresponding to the sample text description information; based on the text feature information, the actual first category probability that the sample text description information belongs to the preset category in the first-level category is predicted; based on the actual first category probability and the text feature information, the actual second category probability that the sample text description information belongs to the preset category in the second-level category is predicted; based on the actual first category probability and the expected first category probability of the sample text description information, the parameters of the preset classification model are adjusted to obtain a trained classification model.
[0035] Optionally, in some embodiments of the present application, the step of “adjusting parameters of a preset classification model based on the actual first category probability and the expected first category probability, and the actual second category probability and the expected second category probability of the sample text description information” may include:
[0036] Calculating a first category loss value of the sample text description information based on an actual first category probability and an expected first category probability of the sample text description information;
[0037] Calculating a second category loss value of the sample text description information based on an actual second category probability and an expected second category probability of the sample text description information;
[0038] Adjust parameters of a preset classification model according to the first category loss value and the second category loss value.
[0039] Optionally, in some embodiments of the present application, the step of “adjusting parameters of a preset classification model according to the first category loss value and the second category loss value” may include:
[0040] Determining a target first category of the sample text description information in the first level category and a target second category of the sample text description information in the second level category according to the expected first category probability and the expected second category probability of the sample text description information;
[0041] Performing a difference operation on an actual second category probability that the sample text description information belongs to the target second category and an actual first category probability that the sample text description information belongs to the target first category to obtain a structural loss value of the sample text description information;
[0042] Adjust parameters of a preset classification model according to the first category loss value, the second category loss value and the structural loss value.
[0043] An electronic device provided in an embodiment of the present application includes a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the steps in the content classification method provided in the embodiment of the present application.
[0044] In addition, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the steps in the content classification method provided in the embodiment of the present application are implemented.
[0045] The embodiment of the present application provides a content classification method, device, electronic device and storage medium, which can obtain text description information corresponding to the content to be classified, and extract features from the text description information to obtain text feature information corresponding to the text description information; predict the probability of the first category of the text description information belonging to a preset category in the first level category based on the text feature information; determine the first category of the text description information in the first level category from the preset categories of the first level category based on the first category probability; predict the probability of the second category of the text description information belonging to a preset category in the second level category based on the first category probability and the text feature information, and the second level category and the first level category have different category levels; determine the second category of the text description information in the second level category from the preset categories of the second level category based on the second category probability; determine the classification information of the content to be classified based on the first category and the second category. The present application can predict the second category of the text description information in the second level category based on the prediction result of the first level category, which can improve the accuracy of content level classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1a is a scenario diagram of a content classification method provided in an embodiment of the present application;
[0048] Figure 1b is a flow chart of a content classification method provided by an embodiment of the present application;
[0049] Figure 1c is an illustration of a content classification method provided in an embodiment of the present application;
[0050] Figure 1d is another illustration of the content classification method provided by an embodiment of the present application;
[0051] Figure 1e It is a model architecture diagram of the content classification method provided in the embodiment of the present application;
[0052] Figure 2 is another flow chart of the content classification method provided by an embodiment of the present application;
[0053] Figure 3 is a structural diagram of a content classification device provided in an embodiment of the present application;
[0054] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only 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 those skilled in the art without creative work are within the scope of protection of this application.
[0056] The embodiment of the present application provides a content classification method, device, electronic device and storage medium. The content classification device can be integrated in an electronic device, which can be a terminal or a server.
[0057] It is understandable that the content classification method of this embodiment can be executed on a terminal, can be executed on a server, or can be executed by both a terminal and a server. The above examples should not be construed as limiting the present application.
[0058] like Figure 1a As shown, a terminal and a server jointly perform a content classification method as an example. The content classification system provided in the embodiment of the present application includes a terminal 10 and a server 11, etc. The terminal 10 and the server 11 are connected via a network, such as a wired or wireless network connection, etc., wherein the content classification device can be integrated in the server.
[0059] Among them, the server 11 can be used to: obtain the text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain the text feature information corresponding to the text description information; predict the probability of the first category of the text description information belonging to the preset category in the first level category according to the text feature information; determine the first category of the text description information in the first level category from the preset category of the first level category based on the first category probability; predict the probability of the second category of the text description information belonging to the preset category in the second level category according to the first category probability and the text feature information, and the second level category and the first level category have different category levels; determine the second category of the text description information in the second level category from the preset category of the second level category based on the second category probability; determine the classification information of the content to be classified according to the first category and the second category. Among them, the server 11 can be a single server, or a server cluster or cloud server composed of multiple servers. In the content classification method or device disclosed in the present application, multiple servers can be composed of a blockchain, and the server is a node on the blockchain.
[0060] The terminal 10 may receive the classification information of the content to be classified sent by the server 11, and process the content to be classified based on the classification information, such as recommending the content to be classified. The terminal 10 may include a mobile phone, a smart TV, a tablet computer, a laptop computer, or a personal computer (PC). A client may also be set on the terminal 10, and the client may be an application client or a browser client.
[0061] The step of content classification by the server 11 may also be executed by the terminal 10 .
[0062] The content classification method provided in the embodiment of the present application relates to natural language processing in the field of artificial intelligence. The embodiment of the present application can improve the accuracy of content level classification.
[0063] Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science. It attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level technology and software-level technology. Among them, artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.
[0064] Among them, natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0065] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0066] This embodiment will be described from the perspective of a content classification device. The content classification device may be integrated into an electronic device, which may be a server or a terminal.
[0067] The content classification method of the embodiment of the present application can be applied to various content classification scenarios. For example, a video platform needs to classify millions of videos in multiple levels. The content classification method provided by this embodiment can quickly classify the titles of massive videos by subject, determine the first category in the first level category and the second category in the second level category, and improve the accuracy of content level classification.
[0068] like Figure 1b As shown, the specific process of the content classification method can be as follows:
[0069] 101. Obtain text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain text feature information corresponding to the text description information.
[0070] In this embodiment, the content to be classified is specifically content that needs to be classified hierarchically (or hierarchically classified), which may include video, image, audio, text, etc., which is not limited in this embodiment. The text description information corresponding to the content to be classified is text information describing the content to be classified.
[0071] Specifically, if the content to be classified is a video, its text description information may include a video title, a video text summary, and a video subtitle, etc.; if the content to be classified is an audio, its text description information may be text introduction information of the audio.
[0072] Hierarchical multi-label classification is an important task in the field of natural language processing or computer vision (CV) multi-classification. Its main feature is that the category labels have a hierarchical relationship. The upper label is the parent of the lower label, and the lower the level, the finer the granularity. Specifically, hierarchical classification is a hierarchical classification method that subdivides from the broader upper class to the lower class.
[0073] In a specific scenario, for the content to be classified, two levels of categories can be mainly constructed, namely, primary categories and secondary categories. The primary category (also the first-level category) is the parent of the secondary category (also the second-level category), that is, the secondary category is the subordinate category of the primary category. It should be noted that the number of categories in the primary category is usually less than the number of categories in the secondary category. For example, the primary category can include 44 categories, including coarse-grained thematic categories such as sports, games, and entertainment. The secondary category can include 305 fine-grained categories, among which a primary category can be subdivided into categories under multiple secondary categories.
[0074] refer to Figure 1c As shown, the content to be classified is a video, and its text description information can specifically be a video title, such as "Game character A is hopeless, the economy is suppressed, and he can't get up at all. The mobile phone is given to you to play." By performing hierarchical classification of the video titles through the content classification method provided in this application, it can be determined that the first-level category of the content to be classified is a game. Combined with the predicted first-level category, the second-level category of the content to be classified is determined. Specifically, the second-level category can be a mobile game, a terminal game, a small game, etc.
[0075] Generally speaking, the higher the level of the category system, the coarser the granularity, and the more data required for model training, so the classification difficulty will be simpler and a higher classification accuracy can often be obtained. This embodiment takes advantage of this and uses the high-accuracy upper-level classification prediction results as prior knowledge for the lower-level classification, thereby enhancing the classification effect.
[0076] In this embodiment, feature extraction is performed on the text description information, which may specifically be a convolution operation and a pooling operation on the text description information.
[0077] Optionally, the text description information can be feature extracted by a neural network. The neural network can be a convolutional neural network (CNN), a residual network (ResNet), a long short-term memory network (LSTM), etc. However, it should be understood that the neural network of this embodiment is not limited to the types listed above.
[0078] Among them, LSTM is a time recurrent neural network, that is, a type of recurrent neural network (RNN). LSTM is more suitable for extracting semantic features from time series data, and is often used to extract semantic features from contextual information in natural language processing tasks. LSTM can selectively forget part of the historical data and add part of the current input data through three gate structures (input gate, forget gate, output gate), and finally integrate it into the current state and generate the output state.
[0079] In some embodiments, the neural network may also use an attention mechanism (Attention), which is not limited in this embodiment.
[0080] 102. Predict, based on the text feature information, a probability that the text description information belongs to a first category of a preset category in a first level category.
[0081] The first-level category is a coarse-grained category, which belongs to the first category level. The first-level category may include at least one preset category belonging to the first category level.
[0082] The first category probability that the text description information belongs to each preset category in the first level category can be predicted by a classifier. The classifier can be a support vector machine (SVM), a recurrent neural network, a fully connected deep neural network (DNN), etc., which is not limited in this embodiment.
[0083] 103. Determine a first category of the text description information in the first level of categories from preset categories of the first level of categories based on the first category probability.
[0084] In some embodiments, a preset category with the highest first category probability in the first level categories may be determined as the first category of the text description information in the first level categories.
[0085] In some other embodiments, a preset category in the first level category whose first category probability is greater than a preset value may be determined as the first category of the text description information in the first level category. The preset value may be set according to actual conditions.
[0086] 104. Predict, based on the first category probability and the text feature information, a second category probability that the text description information belongs to a preset category in a second level category, wherein the second level category and the first level category have different category levels.
[0087] Compared with the first-level categories, the second-level categories are fine-grained categories, which may include at least one preset category belonging to the second category level. The second category level and the first category level have different category levels. Specifically, the second category level is a lower level of the first category level, that is, the second-level category is a lower level of the first-level category, that is, the first-level category is the parent of the second-level category.
[0088] In a specific embodiment, the preset categories in the first-level categories may include education, technology, medical care, games, etc., and the preset categories in the second-level categories may include mobile games, PC games, chips, etc., among which mobile games and PC games can be regarded as subcategories of the first-level category - games, and chips can be regarded as subcategories of the first-level category - technology.
[0089] Optionally, in this embodiment, the step of “predicting the probability of the text description information belonging to a second category of a preset category in the second level category according to the first category probability and the text feature information” may include:
[0090] fusing the category information corresponding to the preset category in the first level of categories with the first category probability to obtain category feature information of the preset category in the first level of categories;
[0091] The second category probability that the text description information belongs to a preset category in the second level category is predicted according to the category feature information and the text feature information.
[0092] There are many ways to merge the category information and the first category probability, which are not limited in this embodiment. For example, the fusion method may be multiplication.
[0093] The category feature information and the text feature information may be fused to obtain fused feature information, and the probability of the text description information belonging to the second category of the preset category in the second level category is predicted based on the fused feature information.
[0094] Specifically, the category information corresponding to the preset category in the first level category may be the word vector corresponding to the preset category. For example, if technology is a preset category in the first level category, the category information corresponding to the preset category may be the word vector corresponding to technology.
[0095] Optionally, the word vector can be obtained by training with general corpus, and the training method can adopt a word to vector (word2vec, word to vector) model and the like.
[0096] word2vec is an NLP (Nature Language Processing) tool. Its feature is that it can convert words into vectors to represent them, so that it can quantitatively measure the relationship between words and explore the connections between words.
[0097] Optionally, the step of “merging the category information corresponding to the preset category in the first-level category with the first category probability to obtain category feature information of the preset category in the first-level category” may include:
[0098] For each preset category in the first-level category, the category information corresponding to the preset category and the first category probability corresponding to the preset category are merged to obtain the category sub-feature information of the preset category;
[0099] The category sub-feature information of each preset category in the first-level category is merged to obtain category feature information.
[0100] The fusion method of the category sub-feature information may specifically be splicing, etc., and the category sub-feature information of each preset category in the first-level category is spliced to obtain the category feature information.
[0101] Optionally, in this embodiment, the step of “merging the category information corresponding to the preset category in the first-level category with the first category probability to obtain the category feature information of the preset category in the first-level category” may include:
[0102] selecting a reference category from preset categories of the first level categories according to the first category probability;
[0103] The category information corresponding to the reference category and the first category probability corresponding to the reference category are fused to obtain category feature information of the reference category in the first level category.
[0104] In some embodiments, each preset category in the first-level category can be sorted based on the first-category probability. Specifically, each preset category can be sorted from large to small according to the size of the first category probability corresponding to each preset category in the first-level category to obtain the sorted preset categories; the first k preset categories in the sorted preset categories are determined as reference categories, and k can be set according to actual conditions.
[0105] In some other embodiments, a preset category in the first level category whose first category probability is greater than a preset value may be selected as a reference category, wherein the preset value may be set according to actual conditions.
[0106] Optionally, in this embodiment, the step of “predicting the probability of the text description information belonging to a second category of a preset category in a second-level category according to the category feature information and the text feature information” may include:
[0107] Fusing the category feature information and the text feature information to obtain fused feature information;
[0108] Performing convolution processing on the fused feature information in multiple dimensions to obtain convolution feature information in multiple dimensions;
[0109] According to the convolution feature information in each dimension, the probability that the text description information belongs to a second category of a preset category in the second level category is predicted.
[0110] There are many ways to merge the category feature information and the text feature information, for example, the fusion method may be splicing processing, etc. Specifically, the text feature information may be spliced after the category feature information, or the category feature information may be spliced after the text feature information.
[0111] The category feature information is determined based on the predicted probability of the first category, that is, the category feature information includes the prediction results in the first-level category.
[0112] In this embodiment, the step of “performing convolution processing on the fused feature information in multiple dimensions to obtain convolution feature information in multiple dimensions” may specifically include:
[0113] The fused feature information is convolved using a plurality of convolution kernels of different scales to obtain convolution feature information in multiple dimensions.
[0114] For example, a convolution kernel with a scale of x-gram (x=1, 2, 3, 4...) can be used to perform convolution processing on the fused feature information to obtain convolution feature information in multiple dimensions.
[0115] Optionally, in this embodiment, the step of “predicting the probability of the text description information belonging to a second category preset in the second level category according to the convolution feature information in each dimension” may include:
[0116] The convolution feature information in each dimension is fused to obtain multi-dimensional fusion information;
[0117] The probability of the text description information belonging to a second category preset in a second level category is predicted according to the multi-dimensional fusion information.
[0118] In some embodiments, the convolution feature information in each dimension may be pooled to obtain pooled convolution feature information in each dimension, and then the pooled convolution feature information in each dimension may be fused to obtain multi-dimensional fusion information.
[0119] There are many ways of pooling, such as maximum pooling (Max-pooling, MaximumPooling), average pooling (Avg-pooling, Average Pooling) and generalized mean pooling (GEM-pooling, Generalized-mean Pooling).
[0120] Fusion refers to feature fusion. Low-level features have higher resolution and contain more detailed information, but they have more noise and lower semantics; high-level features have stronger semantic information, but their resolution is low and more details are lost. Fusion of convolutional feature information of different dimensions can improve the representation ability of features.
[0121] The convolution feature information in each dimension is fused, which may specifically include concatenating the convolution feature information in each dimension or performing weighted operations on the convolution feature information in each dimension, and this embodiment does not impose any limitation on this.
[0122] Optionally, in this embodiment, the step of “predicting the probability of the text description information belonging to a second category of a preset category in the second level category according to the first category probability and the text feature information” may include:
[0123] Based on the first category probability, selecting a reference category from preset categories of the first level categories;
[0124] Fusing the category information corresponding to the reference category and the text feature information to obtain fused feature information of the text description information;
[0125] The probability of the text description information belonging to a second category preset in a second level category is predicted based on the fused feature information.
[0126] The category information corresponding to the reference category may specifically be a word vector corresponding to the reference category. Specifically, only the category information corresponding to the reference category and the text feature information may be fused, such as concatenated, to obtain fused feature information of the text description information.
[0127] In some embodiments, each preset category in the first-level category can be sorted based on the first-category probability. Specifically, each preset category can be sorted from large to small according to the size of the first category probability corresponding to each preset category in the first-level category to obtain the sorted preset categories; the first k preset categories in the sorted preset categories are determined as reference categories, and k can be set according to actual conditions.
[0128] In some other embodiments, a preset category in the first level category whose first category probability is greater than a preset value may be selected as a reference category, wherein the preset value may be set according to actual conditions.
[0129] In this embodiment, the probability of the second category that the text description information belongs to the preset category in the second level category can be predicted by a classifier. The classifier can be a support vector machine (SVM), a recurrent neural network, a fully connected deep neural network (DNN), etc., which is not limited in this embodiment.
[0130] 105. Determine a second category of the text description information in the second level of categories from preset categories of the second level of categories based on the second category probability.
[0131] In some embodiments, the preset category with the highest second category probability in the second level categories may be determined as the second category of the text description information in the second level categories.
[0132] In some other embodiments, the preset category in the second level category whose second category probability is greater than a preset value may be determined as the second category of the text description information in the second level category. The preset value may be set according to actual conditions.
[0133] 106. Determine classification information of the content to be classified according to the first category and the second category.
[0134] Among them, optionally, the predicted first category in the first level category and the second category in the second level category of the text description information can be used as the category of the content to be classified in the first level category and the category of the content to be classified in the second level category, thereby obtaining classification information of the content to be classified.
[0135] Optionally, in this embodiment, the step of “extracting features from the text description information to obtain text feature information corresponding to the text description information” may include:
[0136] The text description information is subjected to feature extraction through a classification model to obtain text feature information corresponding to the text description information.
[0137] The classification model may be used to classify the text description information in a hierarchical manner, specifically, to determine a first category of the text description information in a first hierarchical category and a second category of the text description information in a second hierarchical category.
[0138] The classification model may be a neural network, specifically, a convolutional neural network, a residual network, a long short-term memory network, etc. It is understandable that the classification model of this embodiment is not limited to the types listed above.
[0139] It should be noted that the classification model can be trained by other equipment and then provided to the content classification device, or the content classification device can also train the model itself.
[0140] If the content classification device performs training by itself, before the step of "extracting features from the text description information through a classification model to obtain text feature information corresponding to the text description information", the content classification method may further include:
[0141] Acquire training data, the training data including sample text description information, an expected first category probability that the sample text description information belongs to a preset category in the first level category, and an expected second category probability that the sample text description information belongs to a preset category in the second level category;
[0142] By using a preset classification model, feature extraction is performed on the sample text description information to obtain text feature information corresponding to the sample text description information;
[0143] Predicting, based on the text feature information, an actual first category probability that the sample text description information belongs to a preset category in the first level category;
[0144] Predicting, based on the actual first category probability and the text feature information, an actual second category probability that the sample text description information belongs to a preset category in the second level category;
[0145] Based on the actual first category probability and the expected first category probability, and the actual second category probability and the expected second category probability of the sample text description information, the parameters of the preset classification model are adjusted to obtain a trained classification model.
[0146] The sample text description information includes two levels of label data, which are: the expected first category probability that the sample text description information belongs to a preset category in the first level category, and the expected second category probability that the sample text description information belongs to a preset category in the second level category.
[0147] Specifically, Figure 1d As shown, the sample text description information is specifically a video title, and its two-level label data are respectively its target first category in the first-level category (i.e., the first-level category) and its target second category in the second-level category (i.e., the second-level category). It can be understood that the sample text description information belonging to the target first category in the first-level category can be regarded as: the expected first category probability of the sample text description information belonging to the target first category in the first-level category is 1, and the expected first category probability of the sample text description information belonging to the non-target first category is 0; the same is true for the second-level category, which will not be repeated here.
[0148] Optionally, in this embodiment, the step of “adjusting parameters of a preset classification model based on the actual first category probability and the expected first category probability, and the actual second category probability and the expected second category probability of the sample text description information” may include:
[0149] Calculating a first category loss value of the sample text description information based on an actual first category probability and an expected first category probability of the sample text description information;
[0150] Calculating a second category loss value of the sample text description information based on an actual second category probability and an expected second category probability of the sample text description information;
[0151] Adjust parameters of a preset classification model according to the first category loss value and the second category loss value.
[0152] The first category loss value and the second category loss value of the sample text description information may be calculated by a loss function, and the loss function may be a cross entropy loss function, etc., which is not limited in this embodiment.
[0153] Specifically, the calculation method of the first category loss value can be shown in formula (1), and the calculation method of the second category loss value can be shown in formula (2):
[0154]
[0155] Among them, losscls1 represents the first category loss value, n is the number of preset categories in the first level category, a i represents the actual first category probability that the predicted sample text description information belongs to the i-th preset category in the first level category, y i Indicates the expected first category probability (specifically, it can be 0 or 1) that the sample text description information belongs to the i-th preset category in the first-level category.
[0156] Among them, loss cls2 represents the second category loss value, m is the number of preset categories in the second level category, a j represents the actual second category probability that the predicted sample text description information belongs to the jth preset category in the second level category, y j Indicates the expected second category probability (specifically, it can be 0 or 1) that the sample text description information belongs to the jth preset category in the second level category.
[0157] Optionally, in this embodiment, the step of “adjusting parameters of a preset classification model according to the first category loss value and the second category loss value” may include:
[0158] Determining a target first category of the sample text description information in the first level category and a target second category of the sample text description information in the second level category according to the expected first category probability and the expected second category probability of the sample text description information;
[0159] Performing a difference operation on an actual second category probability that the sample text description information belongs to the target second category and an actual first category probability that the sample text description information belongs to the target first category to obtain a structural loss value of the sample text description information;
[0160] Adjust parameters of a preset classification model according to the first category loss value, the second category loss value and the structural loss value.
[0161] Among them, the preset category with the highest probability of being the first category in the first-level categories can be used as the target first category, and the preset category with the highest probability of being the second category in the second-level categories can be used as the target second category.
[0162] The target second category may be regarded as the correct category of the sample text description information in the second level category, and the target first category may be regarded as the correct category of the sample text description information in the first level category.
[0163] In this embodiment, the training process of the classification model can use the back propagation algorithm to adjust the parameters of the preset classification model based on the first category loss value, the second category loss value and the structural loss value, and optimize the parameters of the preset classification model so that the first category loss value, the second category loss value and the structural loss value meet the preset loss condition, and obtain a trained classification model. The preset loss condition can be set according to actual conditions. Specifically, the preset loss condition can be: the sum of the first category loss value, the second category loss value and the structural loss value is less than the preset loss value, and the preset loss value can be set according to actual conditions.
[0164] The purpose of increasing the structural loss value is to ensure the consistency of the two-level classification results. Assuming that the classification of the coarse-grained upper-level categories (i.e., the first-level categories) is always easier than the classification of the fine-grained lower-level categories (i.e., the second-level categories), that is, the prediction difficulty of the fine-grained categories should be greater, the structural loss value is increased to ensure that the classification result of the first-level category (specifically, the probability of the first category) should always be greater than the classification result of the corresponding second-level category (i.e., the probability of the second category), where the second-level category corresponding to the first-level category is the second-level category subordinate to the first-level category.
[0165] In some embodiments, the calculation method of the structural loss value can refer to formula (3):
[0166]
[0167] Among them, loss h represents the structural loss value, n represents the number of preset categories in the first level category, λ is the preset adjustment parameter, and the max function is a function used to find the maximum element of a vector or matrix, or the maximum value of several specified values. represents the actual first category probability that the predicted sample text description information belongs to the i-th preset category in the first level category, l2 score Indicates the actual second category probability that the predicted sample text description information belongs to a target category in the second-level category, where the target category is a preset category in the second-level category belonging to the i-th preset category in the first-level category.
[0168] Among them, formula (3) introduces the difference between the first-level and second-level classification results to constrain the consistency of the multi-level category classification results, and effectively utilizes the upper and lower level constraint relationship of the category system, that is, using the upper-level category label to constrain the prediction of the lower-level category.
[0169] In this embodiment, the step of “adjusting the parameters of the preset classification model according to the first category loss value, the second category loss value and the structural loss value” may include:
[0170] The first category loss value, the second category loss value and the structural loss value are combined to obtain a total loss value;
[0171] According to the total loss value, adjust the parameters of the preset classification model.
[0172] There are many ways to fuse the three loss values, which are not limited in this embodiment. For example, the fusion method may be weighted fusion.
[0173] In some embodiments, the total loss value may be calculated by referring to formula (4):
[0174] loss = λ1loss cls1 +λ2loss cls2 +λ3loss h (4)
[0175] Among them, loss represents the total loss value, and λ1, λ2, and λ3 represent the harmonized hyperparameters of the three loss values respectively.
[0176] The content classification method of the present application can be applied to a variety of classification scenarios. For example, it can be used in business scenarios where document categories need to be extracted, such as content classification in search, product title classification in e-commerce systems, etc.
[0177] In a specific embodiment, if Figure 1e As shown, it is a model architecture diagram of a classification model, and the classification model may include an upper-level category classification module and a lower-level category classification module.
[0178] Among them, the text description information of the content to be classified can specifically be a video title. For example, if the video title is "Jump and we will teach you how to get 600 points", the encoder in the upper-level category classification module can extract the text feature information of the text description information, and the classifier in the upper-level category classification module can predict the probability of the text description information belonging to the first category of a preset category in the first-level category based on the text feature information, and then determine the first category of the text description information in the first-level category based on the first category probability; then, the first category probability of the preset category in the first-level category predicted by the upper-level category classification module and the corresponding category information can be fused to obtain the category feature information of the preset category in the first-level category, and the category feature information and the text feature information extracted by the encoder can be input into the lower-level category classification module.
[0179] The lower-level category classification module can fuse the text feature information and the category feature information to obtain fused feature information, and then perform convolution processing on the fused feature information through multiple convolution kernels of different scales to obtain convolution feature information in multiple dimensions; then, perform pooling processing on the convolution feature information in multiple dimensions, and then fuse the convolution feature information after pooling processing in multiple dimensions to obtain multi-dimensional fusion information; finally, according to the multi-dimensional fusion information, predict the probability that the text description information belongs to the second category of the preset category in the second-level category, thereby determining the second category of the text description information in the second-level category based on the second category probability.
[0180] Among them, for the training process of the classification model, the first category loss value corresponding to the upper category classification module and the second category loss value corresponding to the lower category classification module can be obtained. According to the first category loss value, the second category loss value and the structural loss value, the parameters of the classification model are adjusted. For details, please refer to the description of the above embodiment, which will not be repeated here.
[0181] As can be seen from the above, this embodiment can obtain the text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain the text feature information corresponding to the text description information; based on the text feature information, predict the probability that the text description information belongs to the first category of the preset category in the first level category; based on the first category probability, determine the first category of the text description information in the first level category from the preset category of the first level category; based on the first category probability and the text feature information, predict the probability that the text description information belongs to the second category of the preset category in the second level category, and the category level of the second level category and the first level category is different; based on the second category probability, determine the second category of the text description information in the second level category from the preset category of the second level category; according to the first category and the second category, determine the classification information of the content to be classified. This application can predict the second category of the text description information in the second level category based on the prediction result of the first level category, which can improve the accuracy of content level classification.
[0182] According to the method described in the previous embodiment, the following will be further described in detail by taking the example of the content classification device being specifically integrated in the server.
[0183] The present application embodiment provides a content classification method, such as Figure 2 As shown, the specific process of the content classification method can be as follows:
[0184] 201. The server obtains text description information corresponding to the content to be classified, and performs feature extraction on the text description information to obtain text feature information corresponding to the text description information.
[0185] In this embodiment, the content to be classified is specifically content that needs to be classified hierarchically (or hierarchically classified), which may include video, image, audio, text, etc., which is not limited in this embodiment. The text description information corresponding to the content to be classified is text information describing the content to be classified.
[0186] Hierarchical multi-label classification is an important task in the field of natural language processing or computer vision (CV) multi-classification. Its main feature is that the category labels have a hierarchical relationship. The upper label is the parent of the lower label, and the lower the level, the finer the granularity. Specifically, hierarchical classification is a hierarchical classification method that subdivides from the broader upper class to the lower class.
[0187] Generally speaking, the higher the level of the category system, the coarser the granularity, and the more data required for model training, so the classification difficulty will be simpler and a higher classification accuracy can often be obtained. This embodiment takes advantage of this and uses the high-accuracy upper-level classification prediction results as prior knowledge for the lower-level classification, thereby enhancing the classification effect.
[0188] 202. The server predicts, based on the text feature information, a probability that the text description information belongs to a first category of a preset category in a first-level category.
[0189] The first-level category is a coarse-grained category, which belongs to the first category level. The first-level category may include at least one preset category belonging to the first category level.
[0190] 203. The server determines, based on the first category probability, a first category of the text description information in the first level of categories from preset categories in the first level of categories.
[0191] In some embodiments, a preset category with the highest first category probability in the first level categories may be determined as the first category of the text description information in the first level categories.
[0192] In some other embodiments, a preset category in the first level category whose first category probability is greater than a preset value may be determined as the first category of the text description information in the first level category. The preset value may be set according to actual conditions.
[0193] 204. The server fuses the category information corresponding to the preset category in the first level of categories with the first category probability to obtain category feature information of the preset category in the first level of categories.
[0194] There are many ways to merge the category information and the first category probability, which are not limited in this embodiment. For example, the fusion method may be multiplication.
[0195] Specifically, the category information corresponding to the preset category in the first-level category may be the word vector corresponding to the preset category.
[0196] Optionally, in this embodiment, the step of “merging the category information corresponding to the preset category in the first-level category with the first category probability to obtain the category feature information of the preset category in the first-level category” may include:
[0197] selecting a reference category from preset categories of the first level categories according to the first category probability;
[0198] The category information corresponding to the reference category and the first category probability corresponding to the reference category are fused to obtain category feature information of the reference category in the first level category.
[0199] 205. The server merges the category feature information and the text feature information to obtain merged feature information.
[0200] There are many ways to merge the category feature information and the text feature information, for example, the fusion method may be splicing processing, etc. Specifically, the text feature information may be spliced after the category feature information, or the category feature information may be spliced after the text feature information.
[0201] 206. The server performs convolution processing on the fused feature information in multiple dimensions to obtain convolution feature information in multiple dimensions.
[0202] In this embodiment, the step of “performing convolution processing on the fused feature information in multiple dimensions to obtain convolution feature information in multiple dimensions” may specifically include:
[0203] The fused feature information is convolved using a plurality of convolution kernels of different scales to obtain convolution feature information in multiple dimensions.
[0204] 207. The server predicts the probability that the text description information belongs to a second category of a preset category in a second-level category based on the convolution feature information in each dimension, and the second-level category and the first-level category have different category levels.
[0205] Compared with the first-level categories, the second-level categories are fine-grained categories, which may include at least one preset category belonging to the second category level. The second category level and the first category level have different category levels. Specifically, the second category level is a lower level of the first category level, that is, the second-level category is a lower level of the first-level category, that is, the first-level category is the parent of the second-level category.
[0206] Optionally, in this embodiment, the step of “predicting the probability of the text description information belonging to a second category preset in the second level category according to the convolution feature information in each dimension” may include:
[0207] The convolution feature information in each dimension is fused to obtain multi-dimensional fusion information;
[0208] The probability of the text description information belonging to a second category preset in a second level category is predicted according to the multi-dimensional fusion information.
[0209] 208. The server determines, based on the second category probability, a second category of the text description information in the second level of categories from preset categories in the second level of categories.
[0210] In some embodiments, the preset category with the highest second category probability in the second level categories may be determined as the second category of the text description information in the second level categories.
[0211] In some other embodiments, the preset category in the second level category whose second category probability is greater than a preset value may be determined as the second category of the text description information in the second level category. The preset value may be set according to actual conditions.
[0212] 209. The server determines classification information of the content to be classified according to the first category and the second category.
[0213] As can be seen from the above, the present embodiment can obtain text description information corresponding to the content to be classified through the server, and perform feature extraction on the text description information to obtain text feature information corresponding to the text description information; based on the text feature information, predict the probability that the text description information belongs to the first category of a preset category in the first-level category; based on the first category probability, determine the first category of the text description information in the first-level category from the preset categories in the first-level category; fuse the category information corresponding to the preset category in the first-level category and the first category probability to obtain the category feature information of the preset category in the first-level category; The category feature information and the text feature information are fused to obtain fused feature information; the fused feature information is convolved in multiple dimensions to obtain convolution feature information in multiple dimensions; based on the convolution feature information in each dimension, the probability that the text description information belongs to a second category of a preset category in a second-level category is predicted, and the second-level category and the first-level category have different category levels; based on the second category probability, the second category of the text description information in the second-level category is determined from the preset categories of the second-level category; based on the first category and the second category, the classification information of the content to be classified is determined. The present application can predict the second category of the text description information in the second-level category based on the prediction result of the first-level category, which can improve the accuracy of content level classification.
[0214] In order to better implement the above method, the present application embodiment also provides a content classification device, such as Figure 3 As shown, the content classification device may include an extraction unit 301, a first prediction unit 302, a first determination unit 303, a second prediction unit 304, a second determination unit 305 and a third determination unit 306, as follows:
[0215] (1) Extraction unit 301;
[0216] The extraction unit 301 is used to obtain text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain text feature information corresponding to the text description information.
[0217] Optionally, in some embodiments of the present application, the extraction unit 301 may be specifically configured to perform feature extraction on the text description information through a classification model to obtain text feature information corresponding to the text description information.
[0218] (2) a first prediction unit 302;
[0219] The first prediction unit 302 is used to predict the first category probability that the text description information belongs to a preset category in the first level category according to the text feature information.
[0220] (3) a first determining unit 303;
[0221] The first determining unit 303 is configured to determine, based on the first category probability, a first category of the text description information in the first level of categories from preset categories of the first level of categories.
[0222] (4) a second prediction unit 304;
[0223] The second prediction unit 304 is used to predict the probability of the text description information belonging to a second category of a preset category in a second level category according to the first category probability and the text feature information, wherein the second level category and the first level category have different category levels.
[0224] Optionally, in some embodiments of the present application, the second prediction unit may include a first fusion subunit and a first prediction subunit, as follows:
[0225] The first fusion subunit is used to fuse the category information corresponding to the preset category in the first level category with the first category probability to obtain the category feature information of the preset category in the first level category;
[0226] The first prediction subunit is used to predict the second category probability that the text description information belongs to a preset category in the second level category according to the category feature information and the text feature information.
[0227] Optionally, in some embodiments of the present application, the first fusion subunit can be specifically used to select a reference category from preset categories of the first-level categories based on the first category probability; fuse the category information corresponding to the reference category and the first category probability corresponding to the reference category to obtain category feature information of the reference category in the first-level categories.
[0228] Optionally, in some embodiments of the present application, the first prediction subunit can be specifically used to fuse the category feature information and the text feature information to obtain fused feature information; perform convolution processing on the fused feature information in multiple dimensions to obtain convolution feature information in multiple dimensions; and predict the probability of the text description information belonging to a second category preset in a second-level category based on the convolution feature information in each dimension.
[0229] Optionally, in some embodiments of the present application, the step of “predicting the probability that the text description information belongs to a second category of a preset category in the second level category according to the convolution feature information in each dimension” may include:
[0230] The convolution feature information in each dimension is fused to obtain multi-dimensional fusion information;
[0231] The probability of the text description information belonging to a second category preset in a second level category is predicted according to the multi-dimensional fusion information.
[0232] Optionally, in some embodiments of the present application, the second prediction unit may include a selection subunit, a second fusion subunit, and a second prediction subunit, as follows:
[0233] The selection subunit is used to select a reference category from preset categories of the first level categories based on the first category probability;
[0234] A second fusion subunit is used to fuse the category information corresponding to the reference category with the text feature information to obtain fused feature information of the text description information;
[0235] The second prediction subunit is used to predict the probability of the text description information belonging to a second category preset in the second level category according to the fused feature information.
[0236] (5) a second determining unit 305;
[0237] The second determining unit 305 is configured to determine, based on the second category probability, a second category of the text description information in the second level of categories from preset categories in the second level of categories.
[0238] (6) a third determining unit 306;
[0239] The third determining unit 306 is configured to determine classification information of the content to be classified according to the first category and the second category.
[0240] Optionally, in some embodiments of the present application, the content classification device may further include a training unit, and the training unit is used to train the classification model; specifically as follows:
[0241] The training unit is used to obtain training data, which includes sample text description information, expected first category probability that the sample text description information belongs to a preset category in a first-level category, and expected second category probability that the sample text description information belongs to a preset category in a second-level category; feature extraction is performed on the sample text description information through a preset classification model to obtain text feature information corresponding to the sample text description information; based on the text feature information, the actual first category probability that the sample text description information belongs to the preset category in the first-level category is predicted; based on the actual first category probability and the text feature information, the actual second category probability that the sample text description information belongs to the preset category in the second-level category is predicted; based on the actual first category probability and the expected first category probability of the sample text description information, the parameters of the preset classification model are adjusted to obtain a trained classification model.
[0242] Optionally, in some embodiments of the present application, the step of “adjusting parameters of a preset classification model based on the actual first category probability and the expected first category probability, and the actual second category probability and the expected second category probability of the sample text description information” may include:
[0243] Calculating a first category loss value of the sample text description information based on an actual first category probability and an expected first category probability of the sample text description information;
[0244] Calculating a second category loss value of the sample text description information based on an actual second category probability and an expected second category probability of the sample text description information;
[0245] Adjust parameters of a preset classification model according to the first category loss value and the second category loss value.
[0246] Optionally, in some embodiments of the present application, the step of “adjusting parameters of a preset classification model according to the first category loss value and the second category loss value” may include:
[0247] Determining a target first category of the sample text description information in the first level category and a target second category of the sample text description information in the second level category according to the expected first category probability and the expected second category probability of the sample text description information;
[0248] Performing a difference operation on an actual second category probability that the sample text description information belongs to the target second category and an actual first category probability that the sample text description information belongs to the target first category to obtain a structural loss value of the sample text description information;
[0249] Adjust parameters of a preset classification model according to the first category loss value, the second category loss value and the structural loss value.
[0250] As can be seen from the above, in this embodiment, the text description information corresponding to the content to be classified can be obtained by the extraction unit 301, and the feature extraction of the text description information can be performed to obtain the text feature information corresponding to the text description information; the first prediction unit 302 predicts the probability of the text description information belonging to the first category preset in the first level category based on the text feature information; the first determination unit 303 determines the first category of the text description information in the first level category from the preset categories of the first level category based on the first category probability; the second prediction unit 304 predicts the probability of the text description information belonging to the second category preset in the second level category based on the first category probability and the text feature information, and the second level category and the first level category have different category levels; the second determination unit 305 determines the second category of the text description information in the second level category from the preset categories of the second level category based on the second category probability; the third determination unit 306 determines the classification information of the content to be classified based on the first category and the second category. The present application can predict the second category of the text description information in the second level category based on the prediction result of the first level category, which can improve the accuracy of content level classification.
[0251] The present application also provides an electronic device, such as Figure 4 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present application, and the electronic device may be a terminal or a server, etc. Specifically:
[0252] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0253] The processor 401 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the electronic device and processes data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0254] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0255] The electronic device also includes a power supply 403 for supplying power to each component. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 403 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
[0256] The electronic device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0257] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:
[0258] Acquire text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain text feature information corresponding to the text description information; predict the probability of the text description information belonging to a first category preset in a first-level category based on the text feature information; determine the first category of the text description information in the first-level category from the preset categories of the first-level category based on the first category probability; predict the probability of the text description information belonging to a second category preset in a second-level category based on the first category probability and the text feature information, the second-level category and the first-level category have different category levels; determine the second category of the text description information in the second-level category from the preset categories of the second-level category based on the second category probability; determine the classification information of the content to be classified based on the first category and the second category.
[0259] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0260] As can be seen from the above, this embodiment can obtain the text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain the text feature information corresponding to the text description information; based on the text feature information, predict the probability that the text description information belongs to the first category of the preset category in the first level category; based on the first category probability, determine the first category of the text description information in the first level category from the preset category of the first level category; based on the first category probability and the text feature information, predict the probability that the text description information belongs to the second category of the preset category in the second level category, and the category level of the second level category and the first level category is different; based on the second category probability, determine the second category of the text description information in the second level category from the preset category of the second level category; according to the first category and the second category, determine the classification information of the content to be classified. This application can predict the second category of the text description information in the second level category based on the prediction result of the first level category, which can improve the accuracy of content level classification.
[0261] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0262] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any content classification method provided in the embodiment of the present application. For example, the instructions can execute the following steps:
[0263] Acquire text description information corresponding to the content to be classified, and perform feature extraction on the text description information to obtain text feature information corresponding to the text description information; predict the probability of the text description information belonging to a first category preset in a first-level category based on the text feature information; determine the first category of the text description information in the first-level category from the preset categories of the first-level category based on the first category probability; predict the probability of the text description information belonging to a second category preset in a second-level category based on the first category probability and the text feature information, the second-level category and the first-level category have different category levels; determine the second category of the text description information in the second-level category from the preset categories of the second-level category based on the second category probability; determine the classification information of the content to be classified based on the first category and the second category.
[0264] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0265] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0266] Since the instructions stored in the computer-readable storage medium can execute the steps in any content classification method provided in the embodiments of the present application, the beneficial effects that can be achieved by any content classification method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0267] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the above-mentioned content classification aspects.
[0268] The above is a detailed introduction to a content classification method, device, electronic device and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A content classification method, characterized in that: include: Obtain text description information and a classification model corresponding to the content to be classified, wherein the classification model includes an upper-level category classification module and a lower-level category classification module, and the classification model is trained based on a first category loss value, a second category loss value, and a structural loss value, wherein the first category loss value represents the classification performance of the upper-level category classification module on the content, the second category loss value represents the classification performance of the lower-level category classification module on the content, and the structural loss value is used to constrain the consistency of the classification results of the upper-level category classification module and the lower-level category classification module; By means of the upper-level category classification module, feature extraction is performed on the text description information to obtain text feature information corresponding to the text description information; Predicting, by the upper category classification module, the probability that the text description information belongs to a first category of a preset category in the first level category according to the text feature information; Based on the first category probability, determining a first category of the text description information in the first level category from preset categories of the first level category; Predicting, based on the first category probability and the text feature information, a probability that the text description information belongs to a second category of a preset category in a second level category, where the second level category and the first level category have different category levels; Based on the second category probability, determining a second category of the text description information in the second level category from preset categories of the second level category; Determining classification information of the content to be classified according to the first category and the second category; The step of predicting the probability of the text description information belonging to a second category of a preset category in a second level category according to the first category probability and the text feature information includes: According to the magnitude of the first category probabilities corresponding to the preset categories in the first-level categories, the preset categories in the first-level categories are sorted to obtain sorted preset categories, and the first k preset categories in the sorted preset categories are determined as reference categories; By means of the upper-level category classification module, for each reference category in the first-level category, the category information corresponding to the reference category and the first category probability corresponding to the reference category are fused to obtain category sub-feature information of the reference category; the category sub-feature information of each reference category in the first-level category is fused to obtain category feature information, and the category information corresponding to the reference category is the word vector corresponding to the reference category; By means of the lower-level category classification module, according to the category feature information and the text feature information, predicting the probability that the text description information belongs to a second category of a preset category in the second-level category; Among them, the calculation formula for the first category loss value is: loss cls1 is the loss value of the first category, n is the number of preset categories in the first level category, a i is the actual first category probability that the predicted sample text description information belongs to the i-th preset category in the first level category, y i is the expected first category probability that the sample text description information belongs to the i-th preset category in the first level category; Among them, the calculation formula for the second category loss value is: loss cls2 is the loss value of the second category, m is the number of preset categories in the second level category, a j is the actual second category probability that the predicted sample text description information belongs to the jth preset category in the second level category, y j is the expected second category probability that the sample text description information belongs to the jth preset category in the second level category; Among them, the calculation formula of the structural loss value is: loss h is the structural loss value, n is the number of preset categories in the first level category, λ is the preset adjustment parameter, max() is the function used to find the maximum value, is the actual first category probability that the predicted sample text description information belongs to the i-th preset category in the first level category, l2 score is the predicted actual second category probability that the sample text description information belongs to a target category in the second-level category, where the target category is a preset category in the second-level category belonging to the i-th preset category in the first-level category.
2. The method according to claim 1, characterized in that The predicting, based on the category feature information and the text feature information, the probability that the text description information belongs to a second category of a preset category in a second level category includes: Fusing the category feature information and the text feature information to obtain fused feature information; Performing convolution processing on the fused feature information in multiple dimensions to obtain convolution feature information in multiple dimensions; According to the convolution feature information in each dimension, the probability that the text description information belongs to a second category of a preset category in the second level category is predicted.
3. The method according to claim 2, characterized in that The predicting, based on the convolution feature information in each dimension, the probability that the text description information belongs to a second category of a preset category in the second level category includes: The convolution feature information in each dimension is fused to obtain multi-dimensional fusion information; The probability of the text description information belonging to a second category preset in a second level category is predicted according to the multi-dimensional fusion information.
4. The method according to claim 1, characterized in that: The predicting, based on the first category probability and the text feature information, the probability that the text description information belongs to a second category of a preset category in the second level category further includes: Based on the first category probability, selecting a reference category from preset categories of the first level categories; Fusing the category information corresponding to the reference category and the text feature information to obtain fused feature information of the text description information; The probability of the text description information belonging to a second category preset in a second level category is predicted based on the fused feature information.
5. The method according to claim 1, characterized in that Before obtaining the text description information and classification model corresponding to the content to be classified, the method further includes: Acquire training data, the training data including sample text description information, an expected first category probability that the sample text description information belongs to a preset category in the first level category, and an expected second category probability that the sample text description information belongs to a preset category in the second level category; By using a preset classification model, feature extraction is performed on the sample text description information to obtain text feature information corresponding to the sample text description information; Predicting, based on the text feature information, an actual first category probability that the sample text description information belongs to a preset category in the first level category; Predicting, based on the actual first category probability and the text feature information, an actual second category probability that the sample text description information belongs to a preset category in the second level category; Based on the actual first category probability and the expected first category probability, and the actual second category probability and the expected second category probability of the sample text description information, the parameters of the preset classification model are adjusted to obtain a trained classification model.
6. The method according to claim 5, characterized in that The adjusting the parameters of the preset classification model based on the actual first category probability and the expected first category probability, and the actual second category probability and the expected second category probability of the sample text description information includes: Calculating a first category loss value of the sample text description information based on an actual first category probability and an expected first category probability of the sample text description information; Calculating a second category loss value of the sample text description information based on an actual second category probability and an expected second category probability of the sample text description information; Adjust parameters of a preset classification model according to the first category loss value and the second category loss value.
7. The method according to claim 6, characterized in that The adjusting the parameters of the preset classification model according to the first category loss value and the second category loss value includes: Determining a target first category of the sample text description information in the first level category and a target second category of the sample text description information in the second level category according to the expected first category probability and the expected second category probability of the sample text description information; Performing a difference operation on an actual second category probability that the sample text description information belongs to the target second category and an actual first category probability that the sample text description information belongs to the target first category to obtain a structural loss value of the sample text description information; Adjust parameters of a preset classification model according to the first category loss value, the second category loss value and the structural loss value.
8. A content classification device, characterized in that: include: An extraction unit is used to obtain text description information and a classification model corresponding to the content to be classified, wherein the classification model includes an upper-level category classification module and a lower-level category classification module, and the classification model is trained based on a first category loss value, a second category loss value, and a structural loss value, wherein the first category loss value represents the classification performance of the upper-level category classification module on the content, and the second category loss value represents the classification performance of the lower-level category classification module on the content, and the structural loss value is used to constrain the consistency of the classification results of the upper-level category classification module and the lower-level category classification module; and feature extraction is performed on the text description information through the upper-level category classification module to obtain text feature information corresponding to the text description information; Among them, the calculation formula for the first category loss value is: loss cls1 is the loss value of the first category, n is the number of preset categories in the first level category, a i is the actual first category probability that the predicted sample text description information belongs to the i-th preset category in the first level category, y i is the expected first category probability that the sample text description information belongs to the i-th preset category in the first level category; the calculation formula of the second category loss value is: loss cls2 is the loss value of the second category, m is the number of preset categories in the second level category, a j is the actual second category probability that the predicted sample text description information belongs to the jth preset category in the second level category, y j is the expected second category probability that the sample text description information belongs to the jth preset category in the second level category; the calculation formula of the structural loss value is: loss h is the structural loss value, n is the number of preset categories in the first level category, λ is the preset adjustment parameter, max() is the function used to find the maximum value, is the actual first category probability that the predicted sample text description information belongs to the i-th preset category in the first level category, l2 score is the predicted actual second category probability that the sample text description information belongs to a target category in the second-level category, where the target category is a preset category in the second-level category belonging to the i-th preset category in the first-level category; A first prediction unit, configured to predict, by means of the upper category classification module, a probability that the text description information belongs to a first category of a preset category in a first level category according to the text feature information; A first determining unit, configured to determine, based on the first category probability, a first category of the text description information in the first hierarchical category from preset categories of the first hierarchical category; A second prediction unit is used to predict the probability of the text description information belonging to a second category of a preset category in a second-level category based on the first category probability and the text feature information, wherein the second-level category and the first-level category have different category levels, wherein the prediction of the probability of the text description information belonging to the second category of a preset category in the second-level category based on the first category probability and the text feature information includes: sorting each preset category in the first-level category according to the size of the first category probability corresponding to each preset category in the first-level category to obtain sorted preset categories, and sorting the first k preset categories in the sorted preset categories. The category is determined as a reference category; through the upper-level category classification module, for each reference category in the first-level category, the category information corresponding to the reference category and the first category probability corresponding to the reference category are merged to obtain the category sub-feature information of the reference category; the category sub-feature information of each reference category in the first-level category is merged to obtain category feature information, and the category information corresponding to the reference category is the word vector corresponding to the reference category; through the lower-level category classification module, according to the category feature information and the text feature information, the second category probability that the text description information belongs to the preset category in the second-level category is predicted; A second determining unit, configured to determine, based on the second category probability, a second category of the text description information in the second level category from preset categories of the second level category; The third determining unit is configured to determine classification information of the content to be classified according to the first category and the second category.
9. An electronic device, characterized in that: It comprises a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to execute the operations in the content classification method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the content classification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Content classification method and device, computer equipment and storage medium
CN110737801A
System of text classification model and training method thereof
CN111309919A