Classification model training method and device based on hierarchical labels, equipment and medium
Through the classification model training method based on the hierarchical label tree, the problem of failure to effectively consider the label hierarchical relationship in the existing technology is solved, and a more accurate classification task effect is achieved.
Patent Information
- Application Number
- CN202510155190.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-06-03
AI Technical Summary
When handling the classification task of hierarchical labels, the prior art fails to effectively consider the hierarchical relationship between labels, resulting in illogical between predicted labels, which may lead to classification errors.
The classification labels of the training samples are determined by obtaining the training samples and constructing the hierarchical label tree based on presets. The hierarchical tag tree includes multi-level classification tags, and the data classification range indicated by the multi-level classification tag is gradually decreasing. Based on the training sample and its corresponding classification labels, the classification model is trained, and the loss value is determined by calculating the shortest node path between the labels to optimize model training.
By enhancing the hierarchical representation between labels, training obtains a model that can perform classification more accurately, improving the accuracy of classification tasks.
Smart Images

Figure CN120086729A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular, to a classification model training method, device, equipment and medium based on hierarchical labels. Background Art
[0002] In the classification task of deep learning, there may be a hierarchical relationship between multiple labels of data. For example, biological classification is divided according to the hierarchical structure of kingdom, phylum, class, order, family, genus, and species. This hierarchical relationship makes the labels have an inherent logical connection, rather than just independent labels.
[0003] For the classification of hierarchical labels, there are mainly two methods: (1) Multi-label classification: Regarding the classification task of hierarchical labels as a multi-label classification problem, that is, each data has only one label. (2) Multi-classification: Regarding the classification task of hierarchical labels as a multi-classification problem, that is, each data can have multiple labels. However, both of these methods do not consider the hierarchical relationship between the labels, and the multi-label classification method may lead to illogical labels in the prediction, which may lead to classification errors. Summary of the Invention
[0004] Based on this, it is necessary to provide a classification model training method, device, equipment and medium based on hierarchical labels for the above technical problems to solve at least one of the problems existing in the above technical problems.
[0005] The present invention provides a classification model training method based on hierarchical labels, including:
[0006] Obtain a number of training samples;
[0007] Based on a preset hierarchical label tree constructed, determine the classification label of any one of the training samples; wherein, the hierarchical label tree includes multiple levels of classification labels, and the data classification ranges indicated by the multiple levels of classification labels decrease gradually;
[0008] Train a classification model based on each of the training samples and their corresponding classification labels.
[0009] Optionally, according to a classification model training method based on hierarchical labels provided by the present invention, the training of the classification model based on each of the training samples and their corresponding classification labels includes:
[0010] Input each of the training samples into the classification model respectively to obtain the classification result output by the classification model;
[0011] Determine a first loss value based on the classification result and classification label corresponding to any one of the training samples;
[0012] Determine a second loss value based on the hierarchical label tree, the classification result, and the classification label corresponding to the training sample;
[0013] Determine a total model loss value based on the first loss value and the second loss value, and train the classification model according to the total model loss value.
[0014] Optionally, according to a classification model training method based on hierarchical labels provided by the present invention, the determining of the second loss value based on the hierarchical label tree, the classification result, and the classification label corresponding to the training sample includes:
[0015] Determine the shortest node path between the classification result and the classification label in the hierarchical label tree;
[0016] Determine the second loss value based on the shortest node path.
[0017] Optionally, according to a classification model training method based on hierarchical labels provided by the present invention, the determining of the first loss value based on the classification result and the classification label corresponding to the training sample includes:
[0018] Calculate the first loss value based on the classification result and the classification label corresponding to the training sample by using a cross-entropy function.
[0019] Optionally, according to a classification model training method based on hierarchical labels provided by the present invention, the determining of the classification label of any one of the training samples based on a preset hierarchical label tree includes:
[0020] Determine the classification label of any one of the training samples based on the label corresponding to the leaf node in the hierarchical label tree.
[0021] Optionally, according to a classification model training method based on hierarchical labels provided by the present invention, the hierarchical label tree is generated based on the following steps:
[0022] Determine a preset label set, where the label set includes several classification labels;
[0023] Determine the hierarchical relationship between the classification labels based on the data classification range indicated by each classification label;
[0024] Construct the hierarchical label tree based on the hierarchical relationship between the classification labels.
[0025] Optionally, according to a classification model training method based on hierarchical labels provided by the present invention, after training the classification model based on each of the training samples and their corresponding classification labels, it further includes:
[0026] Obtain a sample to be classified;
[0027] Input the sample to be classified into the classification model for classification to obtain the target classification result corresponding to the sample to be classified.
[0028] The present invention also provides a classification model training device based on hierarchical labels, including:
[0029] An acquisition module, configured to acquire a plurality of training samples;
[0030] A determination module, configured to determine the classification label of any one of the training samples based on a preset hierarchical label tree; wherein, the hierarchical label tree includes multiple levels of classification labels, and the data classification ranges indicated by the multiple levels of classification labels decrease step by step;
[0031] A training module, configured to train a classification model based on each of the training samples and their corresponding classification labels.
[0032] The present invention also provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the computer-readable instructions, the above-mentioned classification model training method based on hierarchical labels is implemented.
[0033] The present invention also provides one or more readable storage media storing computer-readable instructions. When the computer-readable instructions are executed by a processor, the above-mentioned classification model training method based on hierarchical labels is implemented.
[0034] The above-mentioned classification model training method, device, equipment and medium based on hierarchical labels include: acquiring a plurality of training samples; determining the classification label of any one of the training samples based on a preset hierarchical label tree; wherein, the hierarchical label tree includes multiple levels of classification labels, and the data classification ranges indicated by the multiple levels of classification labels decrease step by step; training a classification model based on each of the training samples and their corresponding classification labels. By determining the classification labels of the training samples based on a preset hierarchical label tree, the present invention can enhance the hierarchical representation between labels, thereby training a classification model. Description of the Drawings
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0036] Figure 1 is a flowchart of a classification model training method based on hierarchical labels in an embodiment of the present invention;
[0037] Figure 2 It is a structural diagram of a hierarchical label tree provided by an embodiment of the present invention;
[0038] Figure 3 It is a schematic structural diagram of a classification model training device based on hierarchical labels in an embodiment of the present invention;
[0039] Figure 4 It is a schematic diagram of a computer device in an embodiment of the present invention. Detailed implementation manners
[0040] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0041] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms "a", "the", and "said" used in one or more embodiments of the present invention are also intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more related listed items.
[0042] In the classification tasks of deep learning, there may be a hierarchical relationship between multiple labels of data. For example, biological classification is carried out according to the hierarchical structure of kingdom, phylum, class, order, family, genus, and species. This hierarchical relationship makes the labels have an inherent logical connection, rather than just independent labels.
[0043] For the classification of hierarchical labels, there are mainly two methods: (1) Multi-label classification: Regarding the classification task of hierarchical labels as a multi-label classification problem, that is, each data has only one label. Example: A biological sample is classified as "mammal", rather than being classified as "mammal" and "primate" at the same time. (2) Multi-classification: Regarding the classification task of hierarchical labels as a multi-classification problem, that is, each data can have multiple labels. Example: An image of a biological sample can be classified as "mammal", "primate", and "human" at the same time.
[0044] However, neither of these two methods considers the hierarchical relationship between the labels, which may lead to classification errors. The multi-label classification method may result in illogical relationships between the predicted labels. For example, a biological sample is predicted to be "mammal" and "invertebrate" at the same time, which is biologically unreasonable.
[0045] In one embodiment, specifically, as Figure 1 shown, Figure 1 FIG. is a schematic flowchart of a method for training a classification model based on hierarchical labels in an embodiment of the present invention. The embodiment of the present invention provides a method for training a classification model based on hierarchical labels, including the following steps:
[0046] Step S11, obtain a plurality of training samples;
[0047] It should be noted that the classification task refers to determining the category to which the input data belongs through a model. The classification task can be binary classification (yes or no), or multi-classification (determining which specific category the input data belongs to among multiple categories). The output of the classification task is no longer a continuous value, but a discrete value, which is used to indicate which category the input data belongs to. The classification task is widely applied in reality, such as image recognition, speech recognition, etc. The training samples are sample data collected according to specific application scenarios.
[0048] Step S12, based on the hierarchically labeled tree constructed in advance, determine the classification label of any one of the training samples;
[0049] It should be noted that the hierarchically labeled tree includes multiple levels of classification labels, and the data classification ranges indicated by the multiple levels of classification labels decrease gradually.
[0050] Specifically, the label corresponding to the leaf node in the hierarchically labeled tree is determined as the classification label of any one of the training samples. In one embodiment, in order to enable the model to learn the hierarchical relationship between the labels, in the hierarchically labeled tree, the leaf node that matches the label manually determined for the training sample is found; then, based on a plurality of labels corresponding to the path from the root node to the leaf node in the hierarchically labeled tree, the classification label of the training sample is formed.
[0051] Step S13, train the classification model based on each of the training samples and their corresponding classification labels.
[0052] Specifically, each of the training samples is respectively input into the classification model to obtain the classification result corresponding to each of the training samples output by the classification model; further, based on the classification result and the classification label corresponding to any one of the training samples, a first loss value is determined. For example, the first loss value is calculated using the cross-entropy function; in order to learn the hierarchical relationship between different labels, in this embodiment, in the hierarchically labeled tree, the shortest node path between the classification result and the classification label is determined, and further, based on the shortest node path, the second loss value is determined. Further, based on the first loss value and the second loss value, the total model loss value is calculated, and then the total model loss value corresponding to each training sample is used to iteratively train the classification model.
[0053] An embodiment of the present invention adopts the above solution, including: obtaining a plurality of training samples; determining the classification label of any one of the training samples based on a hierarchically labeled tree constructed in advance, wherein the hierarchically labeled tree includes multiple levels of classification labels, and the data classification ranges indicated by the multiple levels of classification labels gradually decrease; training a classification model based on each of the training samples and its corresponding classification label. By determining the classification label of the training sample based on the hierarchically labeled tree constructed in advance, the present invention can enhance the hierarchical representation between labels, thereby training a classification model.
[0054] In an embodiment of the present invention, training the classification model based on each of the training samples and its corresponding classification label includes:
[0055] Inputting each of the training samples into the classification model respectively to obtain the classification result output by the classification model; determining a first loss value based on the classification result and the classification label corresponding to any one of the training samples; determining a second loss value based on the hierarchically labeled tree, the classification result, and the classification label corresponding to the training sample; determining a total model loss value based on the first loss value and the second loss value, and training the classification model according to the total model loss value.
[0056] Specifically, inputting each of the training samples into the classification model for classification respectively to obtain the classification result corresponding to each of the training samples output by the classification model. Further, a first loss value is calculated by using a cross-entropy function based on the classification result and the classification label corresponding to any one of the training samples. In addition, the shortest node path between the classification result and the classification label is determined in the hierarchically labeled tree; then, based on the shortest node path, the second loss value is determined. Further, based on the first loss value, the second loss value, and a preset weight coefficient of the second loss value, the total model loss value is calculated. The calculation formula of the total model loss value is as follows:
[0057] L = L old + λ * L distance
[0058] wherein, L represents the total model loss value, L old represents the first loss value, L distance represents the second loss value, and λ represents the weight coefficient. Further, according to the total model loss value, the classification model is trained until the classification model converges or the number of training times reaches a preset number of iterations.
[0059] Embodiments of the present invention adopt the above - mentioned solution, including: inputting each of the training samples into the classification model respectively to obtain the classification result output by the classification model; determining a first loss value based on the classification result and the classification label corresponding to any one of the training samples; determining a second loss value based on the hierarchical label tree, the classification result, and the classification label corresponding to the training sample; determining the total model loss value based on the first loss value and the second loss value, so as to train the classification model according to the total model loss value. It is realized that by calculating the node distance measure of the labels, the hierarchical representation between the labels can be enhanced, the distance under different systems can be increased, and the distance under the same system can be reduced, enabling the classification model to learn the hierarchical features between each label and improving the accuracy of the model in performing the classification task.
[0060] In an embodiment of the present invention, the hierarchical label tree is generated based on the following steps:
[0061] Determine a preset label set, where the label set includes several classification labels; determine the hierarchical relationship between the classification labels based on the data classification range indicated by each classification label; construct the hierarchical label tree based on the hierarchical relationship between the classification labels.
[0062] Specifically, determine a preset label set, where the label set includes several classification labels; determine the hierarchical relationship between the classification labels based on the data classification range indicated by each classification label; with reference to Figure 2 , Figure 2 is the structural diagram of the hierarchical label tree provided by an embodiment of the present invention. There is a hierarchical relationship between each label. Label A is the top - level label, indicating the largest data classification range. Labels B1, B2, and B3 are the sub - labels of label A, indicating a smaller data classification range than label A. Labels C1 and C2 are the sub - labels of label B1, and labels C3 and C4 are the sub - labels of label B2, indicating the smallest data classification range. Further, construct the hierarchical label tree based on the hierarchical relationship between the classification labels. It is realized that by constructing a well - defined label tree structure, the hierarchical relationship between different classification labels can be understood based on the label tree structure.
[0063] In an embodiment of the present invention, determining the second loss value based on the hierarchical label tree, the classification result, and the classification label corresponding to the training sample includes:
[0064] Determine the shortest node path between the classification result and the classification label in the hierarchical label tree; determine the second loss value based on the shortest node path.
[0065] Specifically, in the hierarchical label tree, determine the leaf nodes corresponding to the classification result and the classification label respectively, and then determine the shortest node path between the leaf nodes corresponding to the classification result and the classification label respectively. For example, referring to Figure 2 , Figure 2 the shortest node path from label C3 to label C4 is: C3->B3->C4, and the shortest node path is 2; the shortest node path from label C3 to label C2 is: C3->B3->A->B1->C1, and the shortest node path is 4. Further, based on the shortest node path, determine the second loss value. Optionally, directly use the shortest node path as the second loss value; in another embodiment, the shortest node paths corresponding to each training sample in the current batch can be summed to obtain the second loss value.
[0066] The embodiment of the present invention through the above solution includes: determining the shortest node path between the classification result and the classification label in the hierarchical label tree; and determining the second loss value based on the shortest node path. By calculating the node distance of the labels, the hierarchical representation between the labels can be enhanced. It can be understood that the distance between different systems is increased and the distance within the same system is reduced, thereby improving the classification effect of the model.
[0067] In an embodiment of the present invention, after training the classification model based on each of the training samples and their corresponding classification labels, it further includes:
[0068] Obtain a sample to be classified; input the sample to be classified into the classification model for classification to obtain the target classification result corresponding to the sample to be classified.
[0069] Specifically, obtain a sample to be classified, input the sample to be classified into the classification model for classification to obtain the target classification result corresponding to the sample to be classified. In one embodiment, the target classification result output by the model is a sequence of predicted labels with a hierarchical relationship. The classification label corresponding to the sample to be classified can be determined based on the sequence of predicted labels. Optionally, the classification label at the end of the sequence of predicted labels is determined as the classification label corresponding to the sample to be classified. For example, a predicted sample can be a picture with an unknown classification label. Input the picture into the above sequence model that has been trained for classification prediction, and the obtained sequence of predicted labels corresponding to the picture is "device->electronic product->mobile phone", and the classification label corresponding to the sample to be classified is mobile phone. In one embodiment, the target classification result output by the model is the classification label of the sample to be classified. For example, if the target classification result output by the model is mobile phone, the classification label corresponding to the sample to be classified is mobile phone.
[0070] An embodiment of the present invention adopts the above solution, including: obtaining a sample to be classified; inputting the sample to be classified into the classification model for classification to obtain the target classification result corresponding to the sample to be classified. The classification of the sample to be classified is realized by using the classification model, and the classification model learns the hierarchical association relationship between each label, which can improve the accuracy of model classification.
[0071] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0072] In one embodiment, a classification model training device based on hierarchical labels is provided, and the classification model training device based on hierarchical labels corresponds one-to-one with the classification model training method based on hierarchical labels in the above embodiment. As Figure 3 shown, Figure 3 FIG. 10 is a schematic structural diagram of a classification model training device based on hierarchical labels in an embodiment of the present invention. The classification model training device based on hierarchical labels includes:
[0073] An obtaining module 21, configured to obtain a plurality of training samples;
[0074] A determining module 22, configured to determine the classification label of any one of the training samples based on a hierarchically labeled tree constructed in advance; wherein, the hierarchically labeled tree includes multiple levels of classification labels, and the data classification ranges indicated by the multiple levels of classification labels gradually decrease;
[0075] A training module 23, configured to train a classification model based on each of the training samples and their corresponding classification labels.
[0076] The training module 23 is further configured to:
[0077] Input each of the training samples into the classification model respectively to obtain the classification result output by the classification model;
[0078] Determine a first loss value based on the classification result and the classification label corresponding to any one of the training samples;
[0079] Determine a second loss value based on the hierarchically labeled tree, the classification result, and the classification label corresponding to the training sample;
[0080] Determine the total loss value of the model based on the first loss value and the second loss value, and train the classification model according to the total loss value of the model.
[0081] The training module 23 is further configured to:
[0082] Determine the shortest node path between the classification result and the classification label in the hierarchical label tree;
[0083] Based on the shortest node path, determine the second loss value.
[0084] The training module 23 is further configured to:
[0085] Based on the classification result and the classification label corresponding to the training sample, calculate the first loss value by using the cross-entropy function.
[0086] The determination module 22 is further configured to:
[0087] Based on the labels corresponding to the leaf nodes in the hierarchical label tree, determine the classification label of any one of the training samples.
[0088] The hierarchical label tree is generated based on the following steps:
[0089] Determine a preset label set, where the label set includes several classification labels;
[0090] Based on the data classification range indicated by each classification label, determine the hierarchical relationship between the classification labels;
[0091] Based on the hierarchical relationship between the classification labels, construct the hierarchical label tree.
[0092] The classification model training device based on hierarchical labels further includes:
[0093] A to-be-classified sample acquisition module, configured to acquire a to-be-classified sample;
[0094] A classification module, configured to input the to-be-classified sample into the classification model for classification, and obtain the target classification result corresponding to the to-be-classified sample.
[0095] For the specific limitations on the classification model training device based on hierarchical labels, reference can be made to the limitations on the classification model training method based on hierarchical labels in the above text, which will not be elaborated here. Each module in the above classification model training device based on hierarchical labels can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0096] In one embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 4 shown Figure 4It is a schematic diagram of a computer device in an embodiment of the present invention. The computer device includes a processor, a memory, a network interface, and a database connected through a device bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium and an internal memory. The readable storage medium stores an operating device, computer-readable instructions, and a database. The internal memory provides an environment for the operation of the operating device and computer-readable instructions in the readable storage medium. The database of the computer device is used to store data involved in the classification model training method based on hierarchical tags. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, a classification model training method based on hierarchical tags is implemented. The method includes: obtaining a number of training samples; determining the classification label of any one of the training samples based on a preset hierarchical tag tree; where the hierarchical tag tree includes multiple levels of classification tags, and the data classification ranges indicated by the multiple levels of classification tags decrease step by step; training a classification model based on each of the training samples and their corresponding classification labels. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
[0097] In one embodiment, a computer device is provided. The computer device may be a terminal device, and its internal structure diagram may be as Figure 4 shown. The computer device includes a processor, a memory, and a network interface connected through a device bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium. The readable storage medium stores computer-readable instructions. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, a classification model training method based on hierarchical tags is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
[0098] In an embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the computer-readable instructions, the steps of the classification model training method based on hierarchical tags as described above are implemented. The method includes: obtaining a number of training samples; determining the classification label of any one of the training samples based on a preset hierarchical tag tree; where the hierarchical tag tree includes multiple levels of classification tags, and the data classification ranges indicated by the multiple levels of classification tags decrease step by step; training a classification model based on each of the training samples and their corresponding classification labels.
[0099] In one embodiment, a readable storage medium is provided. The readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the classification model training method based on hierarchical tags as described above. Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through computer-readable instructions. The computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer-readable instructions are executed, they can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0101] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or equivalently replace some of the technical features. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention and should all be included in the protection scope of the present invention.
Claims
1. A classification model training method based on hierarchical labels, characterized in that: include: Obtain several training samples; Determine the classification label of any of the training samples based on a preset hierarchical label tree; wherein the hierarchical label tree includes multiple levels of classification labels, and the data classification range indicated by the multiple levels of classification labels decreases level by level; Based on the training samples and their corresponding classification labels, a classification model is trained.
2. The classification model training method based on hierarchical labels according to claim 1, characterized in that: The step of training a classification model based on each of the training samples and their corresponding classification labels includes: Inputting each of the training samples into the classification model to obtain a classification result output by the classification model; Determine a first loss value based on the classification result and classification label corresponding to any one of the training samples; Determining a second loss value based on the hierarchical label tree, the classification result, and the classification label corresponding to the training sample; Based on the first loss value and the second loss value, a total model loss value is determined to train the classification model according to the total model loss value.
3. The classification model training method based on hierarchical labels according to claim 2 is characterized in that: The determining of the second loss value based on the hierarchical label tree, the classification result and the classification label corresponding to the training sample includes: Determining the shortest node path between the classification result and the classification label in the hierarchical label tree; Based on the shortest node path, the second loss value is determined.
4. The classification model training method based on hierarchical labels according to claim 2 is characterized in that: The determining a first loss value based on the classification result and the classification label corresponding to the training sample includes: Based on the classification result and the classification label corresponding to the training sample, the first loss value is calculated using a cross entropy function.
5. The classification model training method based on hierarchical labels according to claim 1, characterized in that: The step of determining the classification label of any of the training samples based on the preset hierarchical label tree comprises: Based on the labels corresponding to the leaf nodes in the hierarchical label tree, the classification label of any of the training samples is determined.
6. The classification model training method based on hierarchical labels according to claim 1, characterized in that: The hierarchical label tree is generated based on the following steps: Determine a preset tag set, wherein the tag set includes a plurality of classification tags; Determining the hierarchical relationship between the classification labels based on the data classification scope indicated by each of the classification labels; Based on the hierarchical relationship between the classification labels, the hierarchical label tree is constructed.
7. The classification model training method based on hierarchical labels according to claim 1, characterized in that: After training the classification model based on the training samples and their corresponding classification labels, the method further includes: Obtain samples to be classified; The sample to be classified is input into the classification model for classification to obtain the target classification result corresponding to the sample to be classified.
8. A classification model training device based on hierarchical labels, characterized in that: include: An acquisition module, used to acquire a number of training samples; A determination module, configured to determine a classification label of any of the training samples based on a preset hierarchical label tree; wherein the hierarchical label tree includes multiple levels of classification labels, and the data classification range indicated by the multiple levels of classification labels decreases level by level; The training module is used to train the classification model based on the training samples and their corresponding classification labels.
9. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executed on the processor, characterized in that: When the processor executes the computer-readable instructions, it implements the hierarchical label-based classification model training method as described in any one of claims 1 to 7.
10. A readable storage medium having computer readable instructions stored thereon, characterized in that: When the computer-readable instructions are executed by a processor, the hierarchical label-based classification model training method as described in any one of claims 1 to 7 is implemented.