Label generation model training method, label generation method and related equipment
By constructing a time-based loss function and weights in the label generation model, the model training process is optimized, solving the problem of label recognition accuracy of machine learning models when data distribution changes, and realizing a label generation method that efficiently utilizes historical data.
Patent Information
- Application Number
- CN202210957721.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-08-10
AI Technical Summary
Existing machine learning models struggle to effectively reflect the data distribution characteristics of content changes over time when generating labels, leading to a decrease in label recognition accuracy. Furthermore, existing methods, such as periodic iterative updates or pre-training fine-tuning, suffer from problems such as large data volumes, high costs, or cumbersome processes.
By constructing a loss function, setting weights based on the generation time of training samples, and optimizing the model using gradient descent, the model performance is improved by utilizing historical and new data, thus achieving sample-level weighted loss.
It improves the label recognition accuracy of the label generation model in data distribution update scenarios, makes full use of historical data, simplifies the model update process, and reduces costs.
Smart Images

Figure CN115358304B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a training method of a label generation model, a label generation method and related equipment. BACKGROUND
[0002] Generating a corresponding label for content can enable a user to determine the approximate classification of the content based on the label, thereby helping the user to select the content. In the related art, one implementation of generating a label for content is to use a machine learning model to generate a label based on content.
[0003] However, the inventors of the present disclosure find that the machine learning model used in the related art generally has poor label generation effect. SUMMARY
[0004] The present disclosure provides a training method of a label generation model, a label generation method and related equipment to solve or partially solve the above problems.
[0005] In a first aspect, the present disclosure provides a training method of a label generation model, comprising:
[0006] obtaining a plurality of training samples, wherein the training samples comprise a generation time;
[0007] constructing a loss function according to a plurality of generation times corresponding to the plurality of training samples; and
[0008] training an initial model to obtain the label generation model according to the plurality of training samples and in combination with the loss function.
[0009] In a second aspect, the present disclosure provides a label generation method, comprising:
[0010] obtaining target data; and
[0011] inputting the target data into a label generation model trained by the method of the first aspect to obtain a label of the target data.
[0012] In a third aspect, the present disclosure provides a training device of a label generation model, comprising:
[0013] an obtaining module configured to obtain a plurality of training samples, wherein the training samples comprise a generation time;
[0014] a constructing module configured to construct a loss function according to a plurality of generation times corresponding to the plurality of training samples; and
[0015] a training module configured to train an initial model to obtain the label generation model according to the plurality of training samples and in combination with the loss function.
[0016] A fourth aspect of this disclosure provides an apparatus for generating tags, comprising:
[0017] The acquisition module is configured to: acquire target data; and
[0018] The generation module is configured to input the target data into the label generation model trained using the method described in the first aspect, and obtain the label of the target data.
[0019] A fifth aspect of this disclosure provides a computer device including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, the programs including instructions for performing the method according to the first or second aspect.
[0020] A sixth aspect of this disclosure provides a non-volatile computer-readable storage medium comprising a computer program that, when executed by one or more processors, causes the processors to perform the method described in the first or second aspect.
[0021] A seventh aspect of this disclosure provides a computer program product including computer program instructions that, when executed on a computer, cause the computer to perform the method described in the first or second aspect.
[0022] The label generation model training method, label generation method, and related equipment disclosed herein improve the accuracy of sample label recognition by performing loss weighting at the sample granularity during the model training process and making full use of historical data while considering data distribution updates. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this disclosure or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A schematic diagram of an exemplary system provided by an embodiment of this disclosure is shown.
[0025] Figure 2A A flowchart illustrating an exemplary method provided by an embodiment of this disclosure is shown.
[0026] Figure 2B A flowchart illustrating an exemplary method according to an embodiment of this disclosure is shown.
[0027] Figure 3 A schematic diagram of an example model training procedure is shown.
[0028] Figure 4 A schematic diagram of another example method provided by an embodiment of the present disclosure is shown.
[0029] Figure 5 A schematic diagram of a hardware structure of an example computer device provided by an embodiment of the present disclosure is shown.
[0030] Figure 6 A schematic diagram of an example apparatus provided by an embodiment of the present disclosure is shown.
[0031] Figure 7 A schematic diagram of another example apparatus provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0032] In order to make the objects, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below with reference to specific embodiments and drawings.
[0033] It should be noted that, unless otherwise defined, technical terms or scientific terms used in the embodiments of the present disclosure should be understood as their common meanings to those skilled in the art to which the present disclosure pertains. The terms “first”, “second” and similar terms used in the embodiments of the present disclosure do not represent any order, quantity or importance, but are only used to distinguish different components. The terms “include” or “contain” and similar terms mean that the elements or objects before the terms encompass the elements or objects listed after the terms and their equivalents, without excluding other elements or objects. The terms “connect” or “connected” and similar terms do not mean physical or mechanical connection, but can include electrical connection, whether direct or indirect. The terms “upper”, “lower”, “left”, “right” and the like only represent relative positional relationships, and when the absolute positions of the described objects are changed, the relative positional relationships can also be changed accordingly.
[0034] With the continuous development of Internet technology, content production platforms are emerging and upgrading. Due to the endless content in various content production platforms, users are dazzled when selecting content. In order to facilitate users to understand the classification of content when selecting content, one way is to generate corresponding tags based on content. In this way, users can identify tags to preliminarily determine whether the content is the content they want to view.
[0035] In the related art, a content production platform is a multimedia data production platform. The multimedia data can be, for example, video, audio, etc. Among them, the shooting method, shooting style, shooting content, etc. of the video can have relatively large changes over time. Therefore, the mathematical distribution of the video content will also have relatively large changes. In the scene of video content tag identification, once the tag generation model is trained, it is difficult to reflect this time-varying information in the model, which will have a relatively large negative impact on the accuracy of identification.
[0036] In the industrial scene, the model effect of the current data distribution is the most concerned information, and the model effect under the historical data distribution is relatively unimportant. Therefore, this problem can be abstracted as optimizing the current test effect under a time sequence training data stream.
[0037] In the related art, one solution is to use new data to periodically update the model iteratively, so that the model adapts to the new data distribution. This method helps the model quickly adapt to the new data distribution by periodically retraining the model on newly labeled training data, ensuring the model effect.
[0038] However, this method requires retraining the model, so the amount of data required for the new data distribution is often large and the cost is high. Moreover, such a method only uses new data to update the model and cannot make good use of historical data, which will forget the information of the historical data distribution.
[0039] Another method is to use historical data to pre-train the model, and then use new data to fine-tune.
[0040] As described above, if the model is periodically trained from scratch, it is naturally more suitable for the current distribution, but the amount of data required is often large. Therefore, another approach is to use the model of the previous period as the pre-training model and fine-tune it with updated data.
[0041] However, this approach requires a relatively complex process and is sensitive to parameters, relying on a large amount of experience and parameter tuning. Moreover, since the historical data is only applied to the new model in the form of pre-training weights, there is room for improvement in the effect.
[0042] In view of this, it is desirable to find a simple and effective method to help the model efficiently use new data and historical data in a scenario where the data distribution changes over time, and to improve the performance of the model in the current data distribution.
[0043] Figure 1 A structural schematic diagram of an example system 100 provided by an embodiment of the present disclosure is shown.
[0044] As Figure 1As shown, the system 100 can include at least one terminal device (e.g., terminal devices 102, 104), a server 106, and a database server 108. The terminal devices 102 and 104 and the server 106 and the database server 108 can include a medium, e.g., a network 110, that provides a communication link therebetween. The network 110 can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0045] The users 112 can use the terminal devices 102 and 104 to interact with the server 106 through the network 110 to receive or send messages, etc. The terminal devices 102 and 104 can have various applications (APPs) installed thereon, such as model training applications, label generation applications, video applications, social applications, payment applications, web browsers, and instant messaging tools, etc.
[0046] The terminal devices 102 and 104 herein can be hardware or software. When the terminal devices 102 and 104 are hardware, they can be various electronic devices with display screens, including but not limited to smartphones, tablet computers, e-book readers, MP3 players, laptops, and desktop computers, etc. When the terminal devices 102 and 104 are software, they can be installed in the above-listed electronic devices. They can be implemented as multiple software or software modules (e.g., to provide distributed services) or as a single software or software module. No specific limitation is made herein.
[0047] When the terminal devices 102 and 104 are hardware, they can also have video capture devices installed thereon. The video capture devices can be various devices that can capture videos, such as cameras, sensors, etc. The users 112 can use the video capture devices on the terminal devices 102 and 104 to capture videos.
[0048] The server 106 can be a server that provides various services, such as a background server that supports various applications displayed on the terminal devices 102 and 104. The background server can train an initial model using samples in a sample set sent by the terminal devices 102 and 104, and can send the training result (e.g., a generated label generation model) to the terminal devices 102 and 104. In this way, the users can apply the generated label generation model to generate labels (Tags).
[0049] The database server 108 can also be a database server that provides various services. For example, a sample set can be stored in the database server. The sample set includes a large number of samples. The samples can include multimedia data, such as video, audio, etc. In this way, the user 112 can also select a training sample from the sample set stored in the database server 108 through the terminal devices 102 and 104. It can be understood that the database server 108 can not be provided in the system 100 in the case that the server 106 can implement the related functions of the database server 108.
[0050] The server 106 and the database server 108 herein can be hardware or software. When they are hardware, they can be implemented as a distributed server cluster composed of multiple servers or as a single server. When they are software, they can be implemented as multiple software or software modules (for example, used to provide distributed services) or as a single software or software module. No specific limitation is made herein.
[0051] It should be noted that the method for generating a label or the method for training a label generation model provided in the embodiments of the present application is generally executed by the server 106. Correspondingly, the device for generating a label or the device for training a label generation model is generally also provided in the server 106.
[0052] It should be understood that Figure 1 The number of terminal devices, networks, database servers and servers in the system 100 is merely illustrative. According to the implementation needs, there can be any number of terminals, networks, database servers and servers.
[0053] The embodiments of the present disclosure provide a method for training a label generation model, which can solve or partially solve the above problems.
[0054] Figure 2A A flowchart of an exemplary method 200 provided by the embodiments of the present disclosure is shown. The method 200 can be implemented by the server 106 of the system 100. Figure 1 As shown in Figure 2A The method 200 can further include the following steps.
[0055] In step 202, a plurality of training samples can be obtained. The training samples include a generation time.
[0056] Figure 3 A schematic diagram of an exemplary model training flow 300 according to the embodiments of the present disclosure is shown.
[0057] As shown in Figure 3 Before training the model, a training sample set S can be prepared. Each training sample in the set S can be denoted as s iThe training sample set S can include all sample data prior to the current time point, such as all video data prior to the current time point. It is understood that, to improve model training efficiency, the number of training samples can be appropriately reduced; for example, sample data generated within a predetermined time period (e.g., three months, six months, one year, etc.) from the current time point can be selected as training samples.
[0058] In some embodiments, such as Figure 3 As shown, training sample 302 may include its generation time 3022. This generation time 3022 characterizes the time when the training sample 302 was produced. For example, the generation time 3022 could be the time when user 112 captured a video using terminal device 102 or 104, or the time when the video was uploaded to server 106. Thus, when training a model using training sample 302 with generation time 3022, the trained model can reflect the time-based distribution characteristics of the samples, thereby improving the model's performance on data distribution.
[0059] In some embodiments, the training sample 302 is labeled with a tag 3024. The tag 3024 can reflect the approximate classification of the training sample 302. The tags used for labeling can be a variety of pre-defined tags, such as food exploration, lifestyle vlog, etc. In some embodiments, the tag 3024 can be labeled by the user 112 using terminal device 102 or 104.
[0060] In step 204, an initial model 304 can be constructed.
[0061] In some embodiments, the initial model 304 can be a machine learning model. Since the label generation model 306 ultimately trained by the initial model 304 needs to generate labels for the input data, the initial model 304 can be a classification model, such as a neural network model, decision tree, support vector machine, Bayesian classifier, etc.
[0062] Since the model needs to be optimized based on the loss function when training the model, a loss function 308 can also be constructed in step 206.
[0063] In order for the trained label generation model 306 to reflect the time-based distribution characteristics of the samples, in some embodiments, the loss function can be constructed based on the multiple generation times corresponding to the multiple training samples.
[0064] As an optional embodiment, the plurality of weights corresponding to the plurality of training samples can be determined according to a plurality of generation times of the plurality of training samples, and then the loss function is constructed according to the plurality of weights. In this way, the weights in the loss function are set by using the generation times of the training samples, so that when the model is optimized based on the loss function, the model trained can reflect the time-based distribution characteristics of the samples, and the performance of the model is improved.
[0065] In some embodiments, the loss function is in the form of:
[0066]
[0067] It can be seen that the loss function L includes a plurality of sub-functions loss i corresponding to the plurality of training samples s i , and the loss function L is obtained by multiplying a plurality of weights Weight i corresponding to the plurality of sub-functions loss i and further summing (∑).
[0068] Wherein, the weight Weight i may be a function F related to the generation time of the training sample, in the form of:
[0069] Weight i = F(t i )
[0070] Wherein, the function F(t i ) is related to the generation time of the training sample, and when constructing the function F, as long as it can reflect its relationship with the generation time of the training sample, any function can be used to design in actual implementation.
[0071] Generally, the closer the generation time of the training sample to the current time (for example, the test time), the more significant its influence on the model. Therefore, as an optional embodiment, the relationship between the plurality of weights and the plurality of generation times of the training samples can be a linear relationship.
[0072] Optionally, the linear relationship is in the form of:
[0073]
[0074] Wherein, t i is the generation time of the training sample s i , t testThe average of the generation time of the test samples in the test set is tested. As an optional embodiment, for the convenience of calculation, the aforementioned time can adopt the time stamp carried by the sample. The time stamp generally refers to the total number of seconds from 00:00:00 on January 1, 1970 (Greenwich Mean Time) to now (08:00:00 on January 1, 1970, Beijing Time).
[0075] It can be understood that the weight value corresponding to a single training sample can be different according to different selection of test samples in the test set. However, when t i is less than t test , the farther the training sample is from t test , the smaller the weight will be, and accordingly, the smaller the contribution to the model will be. Therefore, the aforementioned linear relationship can be used to set the weight in the loss function, so that the model obtained by training can reflect the time-based distribution characteristics of the samples. Accordingly, the selection of test samples can be adjusted in the process of training the model to ensure the performance of the model. In order to make as many training samples as possible meet the standard that the farther the generation time is from the current time, the smaller the contribution to the model will be, sample data with generation time close to the current time can be selected as test samples.
[0076] In some embodiments, the weight can be related to the elimination period of the training sample. In this way, the linear relationship can be expressed as the following formula:
[0077]
[0078] Wherein, the elimination period of the training sample is denoted as T expel , when t i is less than or equal to T expel , F(t i ) = 0.
[0079] It can be seen that the elimination period T expel is used to eliminate some relatively old data, so that such data no longer contributes to the loss function, so that when optimizing the model, data close to the current time can be used to complete the optimization of the model, which can better represent the contribution of new data to the model, so that the model finally obtained by training can better match the characteristics of recent data.
[0080] In some scenarios, the data closer to the current time has more significant contribution to the model, in order to reflect such characteristics, as an optional embodiment, the relationship between the plurality of weights and the generation time of the plurality of training samples can be a variable decay relationship.
[0081] Optionally, the variable decay relationship is as follows:
[0082]
[0083] where t i is the generation time of the training sample s i , and t test is the average value of the generation time of the test samples in the test set. As an optional embodiment, for the convenience of calculation, the aforementioned time can adopt the time stamp carried by the sample. The time stamp generally refers to the total number of seconds from 00:00:00 on January 1, 1970, Greenwich Mean Time (08:00:00 on January 1, 1970, Beijing Time) to the present.
[0084] It can be understood that the weight value corresponding to a single training sample can be different according to different selection of the test samples in the test set. However, when t i is less than t test , the farther the training sample is from t test , the more the weight will be significantly reduced, and accordingly, the contribution to the model will also be significantly reduced. Therefore, by adopting the aforementioned variable-speed decay relationship to set the weight in the loss function, the model obtained by training can reflect the variable-speed decay distribution characteristics of the samples based on time. Accordingly, the selection of the test samples can be adjusted in the process of training the model to ensure the performance of the model. In order to make as many training samples as possible meet the standard that the farther the distance from the current time, the smaller the contribution to the model, sample data with a generation time close to the current time can be selected as test samples.
[0085] It should be noted that in addition to the variable-speed decay relationship given by the aforementioned formula, there are actually many functions that can reflect such a variable-speed decay relationship, for example, an exponential function. Therefore, other types of functions that reflect the variable-speed decay relationship also belong to the protection scope of the present disclosure.
[0086] In some embodiments, the weight can be related to the elimination period of the training sample. In this way, the variable-speed decay relationship can be expressed as the following formula:
[0087]
[0088] where the elimination period of the training sample is denoted as T expel , when t i is less than or equal to T expel , F(t i ) = 0.
[0089] It can be seen that the elimination period T expelThis is used to discard some relatively old data so that it no longer contributes to the loss function. This allows the model to be optimized using data that is more recent in time, which can better represent the contribution of newer data to the model. As a result, the model trained in this way can better match the characteristics of recent data.
[0090] In some embodiments, the weights can also be determined by utilizing the performance of historical models on the test set.
[0091] Figure 2B A flowchart illustrating an exemplary method 206 according to an embodiment of this disclosure is shown. Figure 2B The step 206, which determines the weights corresponding to the multiple training samples based on their generation time, may further include the following steps.
[0092] In step 2062, the first label generation model and the second label generation model corresponding to the first time node and the second time node are determined.
[0093] Assume time node t i-1 and t i The corresponding models are M j-1 and M j Among them, model M j-1 At time node t i-1 Using time node t i-1 The model M is trained using previously generated data as training samples. j At time node t i Using time node t i The model was trained using previously produced data as training samples.
[0094] It should be noted that when selecting time nodes, you do not have to choose adjacent time nodes, but can choose any two time nodes. The corresponding model must be the model corresponding to the selected time nodes.
[0095] In step 2064, the first accuracy of the first label generation model and the second accuracy of the second label generation model are determined.
[0096] For example, test samples from the test set can be used as probes to derive model M through testing. j-1 and M j The accuracy rates were P j-1 and P j .
[0097] The accuracy can be calculated as follows: after each test sample is input into the model, a predicted label is obtained by the model. If the predicted label is consistent with the true label of the test sample, the correct number is incremented by one, otherwise the error number is incremented by one. The foregoing steps are repeated until all test samples in the test set are tested, the total correct number and the total error number are obtained, and then the total correct number is divided by the total number of test samples in the test set to obtain the accuracy.
[0098] The selection of test samples in the test set is not limited. In some embodiments, in order to make the model better reflect the characteristics of recent data, data close to the current time node can be selected as test samples.
[0099] In step 2066, according to the first accuracy and the second accuracy, the first time node and the second time node, a preset function is fitted to obtain a target function.
[0100] The preset function can be any function. In some embodiments, the preset function can be a linear function or a variable speed decay function, such as any embodiment of the function F(t i ) described above. In this way, the preset function is used to fit two points (t j-1 , P j-1 ) and (t j , P j ), so as to obtain the target function.
[0101] In step 2068, according to the target function, the generation time of the training sample is combined to determine the plurality of weights corresponding to the plurality of training samples.
[0102] In this way, after the target function is fitted, the generation time t i of each training sample is input into the target function, and the weight corresponding to each training sample can be obtained.
[0103] In some embodiments, more time nodes can be further selected, and then two time nodes close in time order are selected as a group to be fitted according to the foregoing manner to obtain a plurality of target functions, so as to use the selected time nodes as the end points of the function, and finally express the target function as a piecewise function, so as to better reflect the characteristics of the data distribution according to time.
[0104] In step 208, the initial model can be trained according to the plurality of training samples and the loss function to obtain the label generation model.
[0105] As an optional embodiment, the gradient descent method can be used to optimize the model using the loss function L described above, so as to obtain the label generation model 306.
[0106] It can be understood that there are many ways to optimize the model, in addition to the gradient descent method, momentum method (Momentum), RMSprop (Root Mean Square prop) method, Adam method, AdamW method, etc.
[0107] From the above embodiments, it can be seen that the training method of the label generation model provided by the embodiments of the present disclosure can fully utilize historical data by weighting the loss of sample granularity during model training and considering data distribution updating, thereby improving the accuracy of sample label recognition.
[0108] It should be noted that the method of the embodiments of the present disclosure can be executed by a single device, such as a computer or a server, etc. The method of the present embodiment can also be applied to a distributed scenario, and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only execute one or more steps in the method of the embodiments of the present disclosure, and the multiple devices will interact with each other to complete the method.
[0109] It should be noted that some embodiments of the present disclosure have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than the order described above and still achieve desirable results. In addition, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve the desired results. In some implementations, multitasking and parallel processing can be advantageous.
[0110] The embodiments of the present disclosure also provide a method for generating labels, and the accuracy of the generated labels is high.
[0111] Figure 4 A flowchart of an exemplary method 400 provided by the embodiments of the present disclosure is shown. The method 400 can be implemented by the server 106 of the system 100. Figure 1 As shown in FIG. 1, the method 400 can further include the following steps. Figure 4
[0112] In step 402, target data can be obtained, for example, any multimedia data (video, audio, etc.).
[0113] In step 404, the target data can be input into a label generation model to obtain the label of the target data.
[0114] The label generation model is trained according to the training samples containing the generation time and the loss function constructed according to the generation time.
[0115] The label generation method provided in this disclosure uses a label generation model that performs loss weighting at the sample granularity during model training and makes full use of historical data while considering data distribution updates, thereby improving the accuracy of sample label recognition.
[0116] In some embodiments, the tag generation model can be trained using any embodiment or arrangement and combination of the aforementioned tag generation model training method 200, and can have the technical effects of the corresponding embodiments, which will not be elaborated here.
[0117] This disclosure also provides a computer device for implementing the methods 200, 300 or 400 described above. Figure 5 A schematic diagram of the hardware structure of an exemplary computer device 500 provided in an embodiment of this disclosure is shown. The computer device 500 can be used to implement... Figure 1 Terminal devices 102 and 104 can also be used to implement Figure 1 Server 106. In some scenarios, this computer device 500 can also be used to implement... Figure 1 Database server 108.
[0118] like Figure 5 As shown, the computer device 500 may include: a processor 502, a memory 504, a network module 506, a peripheral interface 508, and a bus 510. The processor 502, memory 504, network module 506, and peripheral interface 508 are interconnected within the computer device 500 via the bus 510.
[0119] Processor 502 may be a central processing unit (CPU), image processor, neural network processor (NPU), microcontroller (MCU), programmable logic device, digital signal processor (DSP), application-specific integrated circuit (ASIC), or one or more integrated circuits. Processor 502 can be used to perform functions related to the techniques described in this disclosure. In some embodiments, processor 502 may also include multiple processors integrated as a single logic component. For example, such as... Figure 5 As shown, processor 502 may include multiple processors 502a, 502b and 502c.
[0120] Memory 504 can be configured to store data (e.g., instructions, computer code, etc.). Figure 5As shown, the data stored by the memory 504 can include program instructions (e.g., program instructions for implementing the method 200, 300, or 400 of the embodiments of the present disclosure) and data to be processed (e.g., the memory can store configuration files of other modules, etc.). The processor 502 can also access the program instructions and data stored by the memory 504, and execute the program instructions to operate on the data to be processed. The memory 504 can include volatile storage or non-volatile storage. In some embodiments, the memory 504 can include random access memory (RAM), read only memory (ROM), optical disk, magnetic disk, hard disk, solid state disk (SSD), flash memory, memory stick, etc.
[0121] The network interface 506 can be configured to provide communication with other external devices to the computer device 500 via a network. The network can be any wired or wireless network capable of transmitting and receiving data. For example, the network can be a wired network, a local wireless network (e.g., Bluetooth, WiFi, near field communication (NFC), etc.), a cellular network, the Internet, or a combination thereof. It can be understood that the type of network is not limited to the specific examples described above.
[0122] The peripheral interface 508 can be configured to connect the computer device 500 with one or more peripheral devices to achieve information input and output. For example, the peripheral devices can include input devices such as a keyboard, a mouse, a touchpad, a touch screen, a microphone, various sensors, etc., and output devices such as a display, a speaker, a vibrator, an indicator light, etc.
[0123] The bus 510 can be configured to transmit information between various components (e.g., the processor 502, the memory 504, the network interface 506, and the peripheral interface 508) of the computer device 500, such as an internal bus (e.g., a processor-memory bus), an external bus (a USB port, a PCI-E bus), etc.
[0124] It should be noted that although the architecture of the computer device 500 described above only shows the processor 502, the memory 504, the network interface 506, the peripheral interface 508, and the bus 510, in the specific implementation process, the architecture of the computer device 500 can also include other components necessary for normal operation. In addition, those skilled in the art can understand that the architecture of the computer device 500 described above can also only include components necessary for implementing the embodiments of the present disclosure, and does not necessarily include all the components shown in the figure.
[0125] The embodiments of the present disclosure also provide a training device of a label generation model. Figure 6 A schematic diagram of an example device 600 provided by the embodiments of the present disclosure is shown. As shown in the figure, the device 600 can include a processor 602, a memory 604, a network interface 606, and a peripheral interface 608. Figure 6As shown, the apparatus 600 can be configured to implement the method 200 or 300, and can further include the following modules.
[0126] The obtaining module 602 is configured to obtain a plurality of training samples, the training samples including generation time.
[0127] The constructing module 604 is configured to construct a loss function according to a plurality of generation times corresponding to the plurality of training samples, and
[0128] The training module 606 is configured to train an initial model to obtain the label generation model according to the plurality of training samples and the loss function.
[0129] In some embodiments, the constructing module 604 is configured to determine a plurality of weights corresponding to the plurality of training samples according to a plurality of generation times corresponding to the plurality of training samples, and construct the loss function according to the plurality of weights.
[0130] In some embodiments, the loss function includes a plurality of sub-functions corresponding to the plurality of training samples, and the loss function is obtained by multiplying the plurality of weights with the plurality of sub-functions corresponding thereto.
[0131] In some embodiments, a relationship between the plurality of weights and the generation times of the plurality of training samples is a linear relationship or a variable speed decay relationship.
[0132] In some embodiments, the constructing module 604 is configured to determine a first label generation model and a second label generation model corresponding to a first time node and a second time node, determine a first accuracy of the first label generation model and a second accuracy of the second label generation model, fit according to a preset function to obtain a target function according to the first accuracy and the second accuracy, the first time node and the second time node, and determine a plurality of weights corresponding to the plurality of training samples according to the target function and the generation time of the training samples.
[0133] In some embodiments, the weights are related to the elimination period of the training samples.
[0134] In some embodiments, the training samples are multimedia data, and the multimedia data is labeled with a label.
[0135] For the convenience of description, the above apparatus is described in various modules according to functions. Of course, the functions of each module can be implemented in one or more software and / or hardware when implementing the present disclosure.
[0136] The apparatus of the above embodiments is used to implement the corresponding method 200 or 300 in any of the preceding embodiments, and has the beneficial effects of the corresponding method embodiments, which are not repeated here.
[0137] The disclosure embodiments also provide an apparatus for generating a label. Figure 7 A schematic diagram of an exemplary apparatus 700 provided by the disclosure embodiments is shown. The source code includes first code for pre-parsing a layout file, as shown in Figure 7 The apparatus 700 can be used to implement the method 400, and can further include the following modules.
[0138] The acquisition module 702 is configured to acquire target data; and
[0139] The generation module 704 is configured to input the target data into a label generation model to obtain a label of the target data.
[0140] The label generation model is trained according to training samples containing generation times and a loss function constructed according to the generation times.
[0141] In some embodiments, the label generation model is trained in the following manner:
[0142] A plurality of training samples are acquired, and the training samples include generation times;
[0143] A loss function is constructed according to a plurality of generation times corresponding to the plurality of training samples; and
[0144] An initial model is trained to obtain the label generation model according to the plurality of training samples and the loss function.
[0145] In some embodiments, constructing a loss function according to a plurality of generation times corresponding to the plurality of training samples includes:
[0146] A plurality of weights corresponding to the plurality of training samples are determined according to a plurality of generation times corresponding to the plurality of training samples; and
[0147] The loss function is constructed according to the plurality of weights.
[0148] In some embodiments, the loss function includes a plurality of sub-functions corresponding to the plurality of training samples, and the loss function is obtained by multiplying the plurality of weights and the plurality of sub-functions corresponding thereto.
[0149] In some embodiments, the relationship between the plurality of weights and the generation times of the plurality of training samples is a linear relationship or a variable speed decay relationship.
[0150] In some embodiments, the plurality of weights corresponding to the plurality of training samples are determined according to time of generation of the plurality of training samples, comprising:
[0151] determining first and second label generation models corresponding to the first and second time nodes;
[0152] determining first and second accuracies of the first and second label generation models;
[0153] fitting according to the first and second accuracies, the first and second time nodes, and a preset function to obtain a target function; and
[0154] determining the plurality of weights corresponding to the plurality of training samples according to the target function and the time of generation of the training samples.
[0155] In some embodiments, the weights are related to a discard period of the training samples.
[0156] In some embodiments, the training samples are multimedia data, and the multimedia data are labeled with labels.
[0157] For the convenience of description, the above device is described in various modules according to functions. Of course, the functions of each module can be implemented in one or more software and / or hardware when implementing the present disclosure.
[0158] The device of the above embodiments is used to implement the corresponding method 400 in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described here.
[0159] Based on the same inventive concept, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method 200, 300 or 400 of any of the above embodiments.
[0160] The computer readable medium of the above embodiments includes permanent and non-permanent, removable and non-removable media, which can be implemented by any method or technology to store information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0161] The storage medium of the above embodiments stores computer instructions for causing the computer to perform the method 200, 300 or 400 as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which are not repeated here.
[0162] Based on the same inventive concept, the disclosure also provides a computer program product corresponding to the method 200, 300 or 400 of any of the above embodiments, which includes a computer program. In some embodiments, the computer program is executable by one or more processors to cause the processor to perform the method 200, 300 or 400. The processor performing the corresponding step can belong to the corresponding execution subject corresponding to each step in each embodiment of the method 200, 300 or 400.
[0163] The computer program product of the above embodiments is used to cause the processor to perform the method 200, 300 or 400 as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which are not repeated here.
[0164] Those skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure (including claims) is limited to these examples; under the idea of the disclosure, the above embodiments or technical features between different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes of different aspects of the embodiments of the disclosure as described above. In order to be brief, they are not provided in detail.
[0165] Additionally, to simplify the description and discussion, and so as not to obscure the embodiments of the disclosure with details that are well known to those skilled in the art, some conventional attributes of integrated circuit (IC) chips and other components can or can not be shown in the drawings or discussed below. Furthermore, devices can be shown in block diagram form in order to avoid obscuring the embodiments of the disclosure, and this also acknowledges the fact that the details in regard to how such block devices are implemented are highly dependent on the platform within which an embodiment of the disclosure is being implemented (i.e., such details should be completely evident to those skilled in the art). Where specific details are set forth in order to describe an illustrative embodiment of the disclosure, it will be apparent to one skilled in the art that the embodiment of the disclosure can be practiced without, or with variations of, these specific details. Thus, the description is to be considered as illustrative and not restrictive, and the scope of the disclosure is to be determined not with the assistance of the foregoing description alone.
[0166] While the disclosure has been described in connection with specific embodiments thereof, many alternatives, modifications and variations will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) can use the embodiments discussed.
[0167] Embodiments of the disclosure are intended to cover all such alternatives, modifications and variations as falling within the scope of the appended claims. Accordingly, any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the disclosure should be included in the protection scope of the disclosure.
Claims
1. A method for training a label generation model, comprising: obtaining a plurality of training samples, the training samples comprising generation times; the training samples being multimedia data, the multimedia data being labeled with labels; constructing a loss function according to the plurality of generation times corresponding to the plurality of training samples; and training an initial model to obtain the label generation model according to the plurality of training samples and in combination with the loss function. The loss function is constructed according to the plurality of generation times corresponding to the plurality of training samples, comprising: determining a plurality of weights corresponding to the plurality of training samples according to the plurality of generation times corresponding to the plurality of training samples; and constructing the loss function according to the plurality of weights. The loss function comprises a plurality of sub-functions corresponding to the plurality of training samples, and the loss function is obtained by multiplying the plurality of weights and the plurality of sub-functions corresponding thereto.
2. The method of claim 1, wherein, The relationship between the plurality of weights and the generation times of the plurality of training samples is a linear relationship or a variable speed decay relationship.
3. The method of claim 1, wherein, The plurality of weights corresponding to the plurality of training samples are determined according to the generation times of the plurality of training samples, comprising:
4. The method of claim 1, wherein, determining a first label generation model and a second label generation model corresponding to a first time node and a second time node; determining a first accuracy of the first label generation model and a second accuracy of the second label generation model; fitting a target function according to the first accuracy and the second accuracy, the first time node and the second time node according to a preset function; and determining the plurality of weights corresponding to the plurality of training samples according to the target function and in combination with the generation times of the training samples. The weights are related to the elimination period of the training samples.
5. The method of any one of claims 1-4, wherein, 6.A method for generating labels, comprising: obtaining target data; and inputting the target data into a label generation model trained according to any one of claims 1-5 to obtain labels of the target data. 7.A device for training a label generation model, comprising: an obtaining module configured to obtain a plurality of training samples, the training samples comprising generation times; the training samples being multimedia data, the multimedia data being labeled with labels; a constructing module configured to construct a loss function according to the plurality of generation times corresponding to the plurality of training samples; and a training module configured to train an initial model to obtain the label generation model according to the plurality of training samples and in combination with the loss function. The loss function is constructed according to the plurality of generation times corresponding to the plurality of training samples, comprising: determining a plurality of weights corresponding to the plurality of training samples according to the plurality of generation times corresponding to the plurality of training samples; and constructing the loss function according to the plurality of weights. 8.A device for generating labels, comprising: an obtaining module configured to obtain target data; and a generating module configured to input the target data into a label generation model trained according to any one of claims 1-5 to obtain labels of the target data. 9. A computer device comprising one or more processors, memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, the programs including instructions for performing any of the methods of claims 1-5 or the method of claim 8.
10. A non-transitory computer-readable storage medium containing a computer program which, when executed by one or more processors, causes the processors to perform any of the methods of claims 1-5 or the method of claim 8.
11. A computer program product comprising computer program instructions which, when run on a computer, cause the computer to perform any of the methods of claims 1-5 or the method of claim 8.
Citation Information
Patent Citations
Continuous learning neural network system using rolling window
US20200097817A1
Label generating techniques and apparatus
US5974230A