Method for training network model, video recommendation method and device, and electronic equipment

By training a network model using duration tags that calculate user viewing time and average viewing time, the problem of low accuracy in existing video recommendation methods is solved, resulting in more accurate video recommendations and increased revenue for operators.

CN116320635BActive Publication Date: 2026-01-20BEIJING IQIYI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310170457.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-27
Publication Date
2026-01-20
Estimated Expiration
2043-02-27

AI Technical Summary

Technical Problem

Existing video recommendation methods fail to accurately reflect users' true preferences, resulting in low recommendation accuracy and an inability to adapt to changes in user preferences in a timely manner.

Method used

By obtaining the user viewing time and average viewing time of sample videos, a duration label is calculated and input into the network model for training until the loss is less than a threshold, resulting in a trained network model that can be used for video recommendation.

Benefits of technology

It improves the accuracy of video recommendations, enabling them to reflect users' true preferences in a timely manner, and increases the operator's revenue by prioritizing the recommendation of longer videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320635B_ABST
    Figure CN116320635B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a network model training method and video recommendation method and device and electronic equipment, which are applied to the information technology field, attribute information of a sample video is acquired, a duration label of the sample video is calculated according to the first user viewing duration and the first average viewing duration, the attribute information of the sample video is input into a to-be-trained network model to calculate a predicted viewing duration of the sample video, and a current loss of the to-be-trained network model is calculated according to the predicted viewing duration and the duration label, the parameters of the to-be-trained network model are adjusted according to the current loss to continue training until preset loop storage is met or the current loss is less than a preset loss threshold, and a trained network model is obtained. It can be seen that the application can avoid the problem of low accuracy when video recommendation is performed by using features that cannot accurately reflect the real preferences of users, and the accuracy of video recommendation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of information technology, in particular to a network model training method and a video recommendation method and device, and an electronic device. BACKGROUND

[0002] At present, with the rapid development of network technology, watching video broadcasting has become one of the main entertainment ways of people. In order to improve user experience and attract users, the current video application often recommends videos according to user preferences.

[0003] However, in the current identification and recommendation of user preferences, the historical browsing records, content popularity, user identification and other features of the user are often used as the basis for recommendation, and the video content is recalled and recommended accordingly. However, these features often cannot accurately reflect the real preferences of the user.

[0004] For example, although the historical browsing records can reflect which videos the user has browsed, they cannot reflect the degree of preference of the user for different videos. In addition, with the passage of time, the user's preference for video types may change, and the existing recommendation method cannot identify in a timely manner, resulting in low accuracy of video recommendation. SUMMARY

[0005] The purpose of the embodiments of the present application is to provide a network model training method and a video recommendation method, device and electronic device to improve the accuracy of video recommendation. The specific technical solutions are as follows:

[0006] In the first aspect of the present application, a network model training method is first provided, which comprises:

[0007] Obtaining attribute information of a sample video, wherein the attribute information comprises a plurality of first user viewing durations and a first average viewing duration of the sample video, and the first average viewing duration is an average duration calculated according to the plurality of first user viewing durations;

[0008] Calculating a duration label of the sample video according to the plurality of first user viewing durations and the first average viewing duration;

[0009] Inputting the attribute information of the sample video into a to-be-trained network model to calculate a predicted viewing duration of the sample video, and calculating a current loss of the to-be-trained network model according to the predicted viewing duration and the duration label, adjusting the parameters of the to-be-trained network model according to the current loss to continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, and obtaining a trained network model.

[0010] In a possible implementation, the calculating the length label of the sample video according to the plurality of first user viewing durations and the first average viewing duration comprises:

[0011] identifying a time duration interval corresponding to each first user viewing duration in a plurality of preset time duration intervals; determining a time duration characteristic value corresponding to the identified corresponding time duration interval according to a preset correspondence between the time duration interval and the time duration characteristic value, to obtain a plurality of first viewing qualities of the sample video, wherein the first viewing quality is used to represent the length of the first user viewing duration;

[0012] calculating a ratio of the plurality of first viewing qualities and the first average viewing duration to obtain a first ratio;

[0013] calculating the length label of the sample video according to the first ratio.

[0014] In a possible implementation, the obtaining attribute information of the sample video comprises:

[0015] obtaining a second average user viewing duration of a plurality of sample videos of the same episode in a plurality of historical time intervals and a second viewing quality of each sample video;

[0016] the calculating the length label of the sample video according to the plurality of first user viewing durations and the first average viewing duration comprises:

[0017] for any historical time interval, calculating a second ratio of the second viewing quality of each sample video in the episode and the second average user viewing duration of the episode;

[0018] calculating the length label of each sample video in the episode corresponding to the historical time interval according to the second ratio.

[0019] In a possible implementation, after the calculating the length label of each sample video in the episode corresponding to the historical time interval according to the second ratio, the method further comprises:

[0020] comparing the calculated length label with a first preset label value, and when the first preset label value is greater than the calculated length label, modifying the calculated length label to the first preset label value.

[0021] In a possible implementation, the calculating the length label of the sample video according to the first ratio comprises:

[0022] calculating the length label of the sample video according to the first ratio through a preset formula:

[0023] T = max (1, 2.3 * log (a))

[0024] calculate the time length label of the sample video, wherein a represents the first ratio, and T represents the time length label of the sample video.

[0025] In a possible implementation, the calculating the time length label of the sample video according to the plurality of first user viewing time lengths and the first average viewing time length comprises:

[0026] setting the time length label of the sample video with the user viewing time length less than the preset threshold as a second preset label value.

[0027] In a second aspect of the embodiment of the present application, a video recommendation method is further provided, and the method comprises:

[0028] obtaining attribute information of a plurality of videos to be recommended;

[0029] inputting the attribute information of the plurality of videos to be recommended into a pre-trained network model to obtain a preset viewing time length of each video to be recommended, wherein the pre-trained network model is a network model trained by the training method of the network model.

[0030] selecting the first N videos to be recommended corresponding to the longest preset viewing time length from the plurality of videos to be recommended and recommending the first N videos to a user.

[0031] In a third aspect of the embodiment of the present application, a network model training device is further provided, and the device comprises:

[0032] an attribute obtaining module configured to obtain attribute information of a sample video, wherein the attribute information comprises a plurality of first user viewing time lengths and a first average viewing time length of the sample video, and the first average viewing time length is an average time length calculated according to the plurality of first user viewing time lengths;

[0033] a label calculating module configured to calculate a time length label of the sample video according to the plurality of first user viewing time lengths and the first average viewing time length;

[0034] a model training module configured to input the attribute information of the sample video into a network model to be trained to calculate a predicted viewing time length of the sample video, and calculate a current loss of the network model to be trained according to the predicted viewing time length and the time length label, and adjust parameters of the network model to be trained according to the current loss to continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, so as to obtain a pre-trained network model.

[0035] In a possible implementation, the label calculating module comprises:

[0036] The quality obtaining submodule is configured to identify a time length interval corresponding to the first user viewing time length in a plurality of preset time length intervals; and determine a time length characteristic value corresponding to the identified time length interval according to a preset corresponding relationship between the preset time length interval and the time length characteristic value, to obtain a plurality of first viewing qualities of the sample video, wherein the first viewing quality is used to represent the length of the first user viewing time length.

[0037] The first ratio calculating submodule is configured to calculate a ratio of the plurality of first viewing qualities and the first average viewing time length, to obtain a first ratio.

[0038] The time length label calculating submodule is configured to calculate a time length label of the sample video according to the first ratio.

[0039] In a possible implementation, the attribute obtaining module is specifically configured to obtain a second average user viewing time length of a plurality of sample videos of the same episode in a plurality of historical time intervals and a second viewing quality of each sample video.

[0040] The label calculating module comprises:

[0041] The second ratio calculating submodule is configured to calculate, for any historical time interval, a ratio of the second viewing quality of each sample video in the episode and the second average user viewing time length of the episode, to obtain a second ratio.

[0042] The interval label calculating submodule is configured to calculate a time length label of each sample video in the episode corresponding to the historical time interval according to the second ratio.

[0043] In a possible implementation, the device further comprises:

[0044] The label modifying module is configured to compare the calculated time length label with a first preset label value, and modify the calculated time length label to the first preset label value when the first preset label value is greater than the calculated time length label.

[0045] In a possible implementation, the time length label calculating submodule is specifically configured to calculate the time length label of the sample video according to the first ratio through a preset formula:

[0046] T = max (1, 2.3 * log (a))

[0047] wherein a represents the first ratio, and T represents the time length label of the sample video.

[0048] In a possible implementation, the label calculating module is specifically configured to set the time length label of a sample video with a user viewing time length less than a preset threshold to a second preset label value.

[0049] In a fourth aspect of the embodiments of the present application, a video recommendation device is further provided, and the device comprises:

[0050] an information acquisition module, configured to acquire attribute information of a plurality of videos to be recommended;

[0051] a time length calculation module, configured to input the attribute information of the plurality of videos to be recommended into a pre-trained network model to obtain a preset viewing time length of each video to be recommended, wherein the pre-trained network model is a network model trained by the training method of the network model;

[0052] a video selection module, configured to select the first N videos to be recommended with the longest preset viewing time length from the plurality of videos to be recommended for recommendation to a user.

[0053] In another aspect of the embodiments of the present application, an electronic device is further provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus.

[0054] the memory, configured to store a computer program;

[0055] the processor, configured to execute the program stored on the memory to implement the training method of any of the network models.

[0056] In another aspect of the embodiments of the present application, an electronic device is further provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus.

[0057] the memory, configured to store a computer program;

[0058] the processor, configured to execute the program stored on the memory to implement any of the video recommendation methods.

[0059] In another aspect of the embodiments of the present application, a computer readable storage medium is further provided, characterized in that the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the training method of any of the network models.

[0060] In another aspect of the embodiments of the present application, a computer readable storage medium is further provided, characterized in that the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement any of the video recommendation methods.

[0061] In still another aspect of the embodiments of the present application, a computer program product containing instructions is further provided, which, when executed on a computer, causes the computer to execute the training method of any of the network models.

[0062] In yet another aspect of the present application, there is also provided a computer program product comprising instructions which, when executed on a computer, cause the computer to perform any of the above video recommendation methods.

[0063] The training method of the network model and the video recommendation method, device and electronic equipment provided by the embodiments of the present application obtain attribute information of a sample video, wherein the attribute information comprises a plurality of first user viewing durations of the sample video and a first average viewing duration, and the first average viewing duration is an average duration calculated according to the plurality of first user viewing durations; a duration label of the sample video is calculated according to the plurality of first user viewing durations and the first average viewing duration; the attribute information of the sample video is input into a network model to be trained to calculate a predicted viewing duration of the sample video, and a current loss of the network model to be trained is calculated according to the predicted viewing duration and the duration label; the parameters of the network model to be trained are adjusted according to the current loss to continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, and a trained network model is obtained. It can be seen that, by the scheme of the embodiments of the present application, the user viewing duration corresponding to a sample video and the average viewing duration of the user are obtained, and then the sample label is calculated according to the user viewing duration and the average viewing duration of the user, so that the trained network model is obtained by training the model with the calculated label as the target, and therefore when the video recommendation of the user's preference is performed according to the trained network model, the video recommendation can be performed according to the duration of the video and the predicted user viewing duration, thereby avoiding the problem of low accuracy when the video recommendation is performed only by the features such as the historical browsing record of the user, the content heat, and the user identifier, which cannot accurately reflect the real preference of the user, and improving the accuracy of the video recommendation. BRIEF DESCRIPTION OF DRAWINGS

[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows.

[0065] Figure 1 FIG. 1 is a first flowchart of the training method of the network model in the embodiments of the present application;

[0066] Figure 2 FIG. 2 is a first flowchart of the calculation of the duration label in the embodiments of the present application;

[0067] Figure 3 FIG. 3 is a second flowchart of the training method of the network model in the embodiments of the present application;

[0068] Figure 4 FIG. 4 is a third flowchart of the training method of the network model in the embodiments of the present application.

[0069] Figure 5 A flowchart of a video recommendation method in an embodiment of the present application;

[0070] Figure 6 A structural diagram of a network model training device in an embodiment of the present application;

[0071] Figure 7 A structural diagram of a video recommendation device in an embodiment of the present application;

[0072] Figure 8 A structural diagram of an electronic device in an embodiment of the present application;

[0073] Figure 9 A structural diagram of another electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0074] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

[0075] In a first aspect of the present application, a network model training method is provided first, as shown in Figure 1 The method comprises the following steps:

[0076] In step S11, attribute information of a sample video is obtained.

[0077] The attribute information comprises a plurality of first user viewing durations of the sample video and a first average viewing duration, and the first average viewing duration is an average duration calculated according to the plurality of first user viewing durations. The plurality of first user viewing durations of the sample video can refer to the viewing durations of one or more specified users watching the sample video. For example, when the model trained by the network model training method of the present application is used to recommend videos to the user, the viewing durations of the user for the sample video can be identified only by the historical browsing records of the user. The average viewing duration can refer to the average viewing duration of the first user watching the sample video and the associated videos of the sample video. For example, when the sample video is a video corresponding to an episode of a TV series, the average viewing duration can be the average of the durations of the first user watching each episode of the TV series. In actual use, the model trained by the network model training method of the present application can be used to recommend videos to a plurality of users. When the first user represents a plurality of users, the historical browsing records of a large number of users can be obtained to identify the viewing durations of each user for the sample video, and the attribute information of the sample video for each user, i.e., the viewing duration and the average viewing duration of each user, can be obtained. In actual use, the attribute information can also include the type, label, and total duration information of the corresponding episode of the sample video.

[0078] The method of the embodiments of the present application is applied to a smart terminal, and can be implemented through the smart terminal. Specifically, the smart terminal can be a device for model training of a user, such as a computer or a server.

[0079] In step S12, a duration label of the sample video is calculated according to the plurality of first user viewing durations and the first average viewing duration.

[0080] In the method, the duration label of the sample video can be calculated by calculating the ratio of the first user viewing duration to the first average viewing duration and taking the ratio as the duration label of the sample video, or the ratio of the first user viewing duration to the first average viewing duration can be further calculated to obtain the duration label of the sample video. In a possible implementation, the calculating the duration label of the sample video according to the plurality of first user viewing durations and the first average viewing duration comprises: setting the duration label of the sample video with a user viewing duration less than a preset threshold as a second preset label value. Specifically, the second preset label value can be 0 or the like.

[0081] In step S13, the attribute information of the sample video is input into the to-be-trained network model to calculate a predicted viewing duration of the sample video, and a current loss of the to-be-trained network model is calculated according to the predicted viewing duration and the duration label. The parameters of the to-be-trained network model are adjusted according to the current loss to continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, and a trained network model is obtained.

[0082] The attribute information of the sample video is input into the to-be-trained network model, and the to-be-trained network model is trained with the time length label as a training target. The attribute information of the sample video can be input into the to-be-trained network model, and the corresponding time length label is predicted through the to-be-trained network model to obtain a prediction result. Then, the parameters of the to-be-trained network model are corrected according to the prediction result and the time length label of the sample video. Then, the attribute information of the sample video is input into the to-be-trained network model to calculate the predicted viewing time length of the sample video, and the training continues until a preset training stop condition is met to obtain a trained network model. Specifically, the attribute information of another sample video corresponding to the user can be selected to input into the corrected model for further training. For example, when the method of the embodiment of the present application is applied to the recommendation of a specified user, the attribute information of another sample video corresponding to the user can be selected for training. When the method of the embodiment of the present application is applied to the recommendation of multiple users, the attribute information of a sample video corresponding to another user can be selected for further training. The preset training stop condition can be that the number of iterations of the to-be-trained model reaches a preset number, or the difference between the predicted time length and the time length label is less than a preset threshold, and a trained network model is obtained.

[0083] Through the scheme of the embodiment of the present application, the user viewing time length corresponding to the sample video and the average viewing time length of the user are obtained, and then the sample label is calculated according to the user viewing time length and the average viewing time length of the user, so that the trained network model is obtained by training the model with the calculated label as the target. Since the user often watches only the videos he likes for a long time, when the video recommended by the user is recommended according to the trained network model, the video is recommended according to the time length of the video and the predicted user viewing time length, which can avoid the problem of low accuracy when the video is recommended only by the user's historical browsing records, content popularity, user identification and other features that cannot accurately reflect the user's real preferences, and improve the accuracy of video recommendation.

[0084] At the same time, in actual use, the user's viewing of the video may have different effects on the operator of the application, wherein the user's viewing of the long video generally has a higher income than the short video; the income of the user's viewing time is generally higher than that of the user's viewing time. Therefore, based on the user's viewing time, the label is set, and the trained model is obtained based on the label, and the user's viewing time is predicted and the video is recommended through the model, which not only improves the recommendation accuracy, but also improves the operator's income by preferentially recommending long videos to users.

[0085] In a possible implementation, referring to Figure 2calculating the length label of the sample video according to the plurality of first user viewing time lengths and the first average viewing time length, comprises:

[0086] Step S21, identifying a time length interval corresponding to each first user viewing time length in a plurality of preset time length intervals; determining a time length characteristic value corresponding to the identified corresponding time length interval according to a preset correspondence between the time length interval and the time length characteristic value, to obtain a plurality of first viewing qualities of the sample video, wherein the first viewing quality is used to represent the length of the first user viewing time length;

[0087] Step S22, calculating a ratio of the plurality of first viewing qualities and the first average viewing time length to obtain a first ratio;

[0088] Step S23, calculating the length label of the sample video according to the first ratio.

[0089] In the actual use process, the correspondence between the time length interval and the time length characteristic value can also be preset, for example, the intervals 0-10 seconds, 10 seconds-1 minute, 1 minute-10 minutes correspond to the time length characteristic values 0.25, 0.5, 1 respectively. When obtaining the first viewing quality of the sample video, it can be determined which time length interval the first user viewing time length belongs to, and the characteristic value corresponding to the interval is selected as the first viewing quality. For example, when the user viewing time length is 15 seconds, it belongs to the preset interval 10 seconds-1 minute, and the corresponding time length characteristic value is 0.5, then the first viewing quality corresponding to the user viewing time length 15 seconds is 0.5. In the actual use process, the time length interval corresponding to the first user viewing time length can also be determined according to the first user viewing time length and the length of the corresponding sample video, for example, calculating the ratio of the first user viewing time length and the length of the corresponding sample video, and determining the corresponding time length interval according to the ratio, for example, presetting a plurality of intervals: 0-0.25, 0.25-0.5, 0.5-1, that is, when the user viewing time length is less than one fourth of the total time length, it corresponds to the first interval, when the user viewing time length is between one fourth and one half of the total time length, it corresponds to the second interval, and when the user viewing time length is greater than one half of the total time length, it corresponds to the third interval, and the time length characteristic values corresponding to the three intervals can be set as 0.25, 0.5, 1 respectively.

[0090] The ratio of the first viewing quality and the first average viewing duration is calculated, and then the duration label of the sample video is calculated according to the first ratio. The ratio of the first user viewing duration and the first average viewing duration can be taken as the duration label of the sample video, or the ratio of the first user viewing duration and the first average viewing duration can be further calculated to obtain the duration label of the sample video. In a possible implementation, the calculating the duration label of the sample video according to the first ratio comprises: calculating the duration label of the sample video according to the first ratio by a preset formula: T = max (1, 2.3 * log (a)), where a represents the first ratio, and T represents the duration label of the sample video. In the embodiment of the application, the coefficient 2.3 is an empirical coefficient obtained through a large number of experiments. In the experimental process of the application, the inventor found that when the value of 2.3 is reduced to approach 1, the value of MR (Mean Rank, model evaluation index) continuously increases, when the value increases from 1 to 2.3, the value of MR continuously decreases, and when the value continues to increase to more than 2.3, the value of MR continuously increases again. Since the value of MR can reflect the performance of the model, and the smaller the value is, the better the performance is, therefore, the value of 2.3 is taken in the application. Wherein, a = t / 102, t is the viewing duration of the user after using the suggest search (unit: second), the first viewing quality is obtained by mathematical transformation to a certain interval, and a is the average viewing duration after each search, that is, the first average viewing duration. In the experimental process of the application, the average viewing duration a calculated by the inventor is 102, and the unit is second.

[0091] It can be seen that the method of the embodiment of the application can calculate the duration label of the sample video according to the first viewing quality and the first average viewing duration, so that the training of the network model can be performed based on the label, the trained model is obtained, and the prediction of the user viewing duration and the recommendation of the video are performed through the model. Not only the recommendation accuracy can be improved, but also the long video can be preferentially recommended to the user to improve the revenue of the operator of the application.

[0092] In a possible implementation, referring to Figure 3 , the attribute information of the sample video is obtained in step S11, including:

[0093] In step S111, the second average user viewing duration of the multiple sample videos of the same episode in the multiple historical time intervals and the second viewing quality of each sample video are obtained.

[0094] In step S12, the duration label of the sample video is calculated according to the multiple first user viewing durations and the first average viewing duration, including:

[0095] Step S121, for any historical time interval, calculate the second viewing quality of each sample video in the episode and the second average user viewing time of the episode, to obtain a second ratio;

[0096] Step S122, calculate the time length label of each sample video in the episode according to the second ratio.

[0097] Among them, the sample video of the embodiment of the application can be multiple sample videos of the same episode, for example, a certain TV series includes multiple episodes, and the sample video can be multiple episodes of the TV series. The user viewing time can be the viewing time of the user for each episode, and the average viewing time can be the average time of the user viewing each episode of the entire TV series. Specifically, a plurality of historical time intervals can be pre-set, for example, 7 days, 15 days and 30 days, and the second average user viewing time of multiple sample videos of the same episode and the second viewing quality of each sample video are obtained for each time interval.

[0098] Among them, for any historical time interval, the second ratio of the second viewing quality of each sample video in the episode and the second average user viewing time of the episode is calculated, and then the time length label of each sample video in the episode corresponding to the historical time interval is calculated according to the second ratio. The second ratio can be used as the time length label, or the second label can be obtained by further calculating according to the second ratio. For example, the corresponding time length label is calculated by a preset formula T=2.3*log(a), wherein a represents the first ratio.

[0099] In a possible implementation, after the time length label of each sample video in the episode corresponding to the historical time interval is calculated according to the second ratio, the method further comprises: comparing the calculated time length label with a first preset label value, when the first preset label value is greater than the calculated time length label, modifying the calculated time length label to the first preset label value.

[0100] After the time length label is calculated, the calculated time length label is compared with a first preset label value, and when the first preset label value is greater than the calculated time length label, the calculated time length label is modified to the first preset label value. For example, the first preset label value is set as 1 in advance, the calculated label is compared with 1 after the second label is calculated according to the second ratio according to the preset formula T=2.3*log(a), and the larger one of the two is taken as the final time length label. In a possible implementation, the time length label of the sample video is calculated according to the first ratio, including: calculating the time length label of the sample video according to the first ratio through a preset formula: T=max(1,2.3*log(a)), where a represents the first ratio, and T represents the time length label of the sample video.

[0101] In order to illustrate the method of the embodiments of the present application, the following is described in combination with specific embodiments, referring to Figure 4 , including:

[0102] 1. Extract meta features, specifically including: time length of suggest query within 7 days, viewing quality, average viewing time length; time length of suggest query within 15 days, viewing quality, average viewing time length; time length of suggest query within 30 days, viewing quality, average viewing time length;

[0103] 2. Change the training target; when the positive sample is not a positive sample, the Label is set to 0, and the Label of the positive sample is set to 1 by default. The Label of the positive sample is changed from 1 to a new Label T(T>=1), and the calculation formula is T=max(1,2.3*log(t / 102)), t is the viewing time length of the user after using the suggest search (unit: second), and is smoothed to a certain interval through some mathematical transformations, and 102 is the average viewing time length (102 seconds) after the suggest search;

[0104] 3. Model training, specifically including inputting the extracted sample features into the network model to be trained and performing calculation, comparing the calculation result with the changed training target, and modifying the model parameters according to the comparison result, and then re-inputting the sample for training until a preset iteration stop condition is met, such as reaching a preset iteration, and obtaining the trained network model.

[0105] It can be seen that, by the method implemented in the present application, the user viewing duration corresponding to the sample video and the average viewing duration of the user are obtained, and then the sample label is calculated according to the user viewing duration and the average viewing duration of the user, so as to train the model by taking the calculated label as the target to obtain the trained network model, so that when the user's favorite video is recommended according to the trained network model, the user's viewing duration can be predicted, and the video is recommended based on the predicted user's viewing duration, improving the accuracy of user recommendation, and long videos can be preferentially recommended to users to improve the operating party's revenue of the application.

[0106] In the second aspect of the present application, a video recommendation method is also provided, which is described in detail with reference to Figure 5 The above method comprises:

[0107] Step S51, obtaining attribute information of a plurality of videos to be recommended;

[0108] Step S52, inputting the attribute information of the plurality of videos to be recommended into a pre-trained network model to obtain a preset viewing duration of each video to be recommended, wherein the pre-trained network model is a network model trained by the above network model training method;

[0109] Step S53, selecting the first N videos to be recommended corresponding to the longest preset viewing duration from the plurality of videos to be recommended for recommendation to the user.

[0110] The attribute information can include the type, label, total duration information of the corresponding episode of the video, etc. Since the pre-trained network model is obtained by obtaining the user viewing duration corresponding to the sample video and the average viewing duration of the user, and then calculating the sample label according to the user viewing duration and the average viewing duration of the user, so as to train the model by taking the calculated label as the target to obtain the trained network model, therefore when the user's favorite video is recommended according to the trained network model, the user's viewing duration can be predicted to provide the accuracy of the recommendation.

[0111] Since the user usually only watches the video that he likes for a long time, when recommending the video that the user likes according to the trained network model, the video is recommended according to the time length of the video and the predicted watching time length of the user, which can avoid the problem of low accuracy when the video is recommended by the features such as the historical browsing record of the user, the content heat, and the user identification that cannot accurately reflect the real preference of the user, and improve the accuracy of video recommendation. At the same time, in the actual use process, the user watching the video may have different benefits for the operator of the application, wherein the benefit of the user clicking to watch the long video is generally greater than the benefit of the short video; the click benefit of the long watching time is generally greater than the benefit of the short watching time. Therefore, the prediction of the user watching time length and the recommendation of the video through the model can not only improve the recommendation accuracy, but also improve the operator benefit of the application by preferentially recommending long videos to the user.

[0112] In the third aspect of the embodiment of the present application, a network model training device is also provided, which is described as follows. Figure 6 The device comprises:

[0113] The attribute acquisition module 601 is configured to acquire attribute information of a sample video, wherein the attribute information comprises a plurality of first user watching time lengths and a first average watching time length of the sample video, and the first average watching time length is an average time length calculated according to the plurality of first user watching time lengths.

[0114] The label calculation module 602 is configured to calculate a time length label of the sample video according to the plurality of first user watching time lengths and the first average watching time length.

[0115] The model training module 603 is configured to input the attribute information of the sample video into a network model to be trained to calculate a predicted watching time length of the sample video, calculate a current loss of the network model to be trained according to the predicted watching time length and the time length label, adjust the parameters of the network model to be trained according to the current loss to continue the training until a preset loop storage is met or the current loss is less than a preset loss threshold, and obtain a trained network model.

[0116] In a possible implementation, the label calculation module comprises:

[0117] The quality acquisition sub-module is configured to identify a time length interval corresponding to each first user watching time length in a plurality of preset time length intervals, determine a time length characteristic value corresponding to the identified corresponding time length interval according to a predetermined correspondence between the preset time length interval and the time length characteristic value, and obtain a plurality of first watching qualities of the sample video, wherein the first watching quality is used to represent the length of the first user watching time length.

[0118] The first ratio calculation sub-module is configured to calculate a ratio of the plurality of first watching qualities and the first average watching time length to obtain a first ratio.

[0119] a time length label calculation sub-module configured to calculate a time length label of the sample video according to the first ratio.

[0120] In a possible implementation, the attribute acquisition module is specifically configured to acquire a second average user viewing time length of the multiple sample videos of the same episode in multiple historical time intervals and a second viewing quality of each sample video;

[0121] The label calculation module comprises:

[0122] a second ratio calculation sub-module configured to calculate, for any historical time interval, a ratio of the second viewing quality of each sample video in the episode to the second average user viewing time length of the episode, to obtain a second ratio;

[0123] a time interval label calculation sub-module configured to calculate, according to the second ratio, a time length label of each sample video in the episode corresponding to the historical time interval.

[0124] In a possible implementation, the apparatus further comprises:

[0125] a label modification module configured to compare the calculated time length label with a first preset label value, and modify the calculated time length label to the first preset label value when the first preset label value is greater than the calculated time length label.

[0126] In a possible implementation, the time length label calculation sub-module is specifically configured to calculate the time length label of the sample video according to the first ratio through a preset formula:

[0127] T = max (1, 2.3 * log (a))

[0128] wherein a represents the first ratio, and T represents the time length label of the sample video.

[0129] In a possible implementation, the label calculation module is specifically configured to set the time length label of the sample video with a user viewing time length less than a preset threshold to a second preset label value.

[0130] It can be seen that, by the device and the scheme of the embodiments of the present application, the user viewing duration corresponding to the sample video and the average viewing duration of the user are acquired, and then the sample label is calculated according to the user viewing duration and the average viewing duration of the user, so as to train the model by taking the calculated label as a target to obtain a trained network model. Since the user often watches the video that he likes for a long time, when the video recommended according to the trained network model is performed, the video is recommended according to the duration of the video and the predicted viewing duration of the user, which can avoid the problem of low accuracy when the video is recommended by only using the historical browsing records of the user, the content heat, the user identifier and other features that cannot accurately reflect the real preference of the user, and improve the accuracy of video recommendation. At the same time, in the actual use process, the revenue of the operator applied to the user watching the video may be different, wherein the revenue of the user clicking to watch the long video is generally greater than the revenue of the short video; the click revenue of the long watching time is generally greater than the revenue of the short watching time. Therefore, the label is set based on the viewing duration of the user, and the trained model is obtained based on the label, and the model is used to predict the viewing duration of the user and recommend the video, which not only can improve the recommendation accuracy, but also can improve the revenue of the operator of the application by preferentially recommending long videos to the user.

[0131] In the fourth aspect of the present application, a video recommendation device is also provided, which is shown in Figure 7 The device includes:

[0132] The information acquisition module 701 is configured to acquire attribute information of a plurality of videos to be recommended.

[0133] The duration calculation module 702 is configured to input the attribute information of the plurality of videos to be recommended into a pre-trained network model to obtain a preset viewing duration of each video to be recommended, wherein the pre-trained network model is a network model trained by the training method of the network model.

[0134] The video selection module 703 is configured to select the first N videos to be recommended corresponding to the longest preset viewing duration from the plurality of videos to be recommended and recommend the first N videos to the user.

[0135] It can be seen that, by the method of the embodiments of the present application, the model trained based on the user viewing time is used to predict the viewing duration of the user and recommend the video, which not only can improve the recommendation accuracy, but also can improve the revenue of the operator of the application by preferentially recommending long videos to the user.

[0136] The embodiments of the present application also provide an electronic device, which is shown in Figure 8As shown, the device comprises a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902 and the memory 903 complete mutual communication through the communication bus 904,

[0137] The memory 903 is used for storing a computer program.

[0138] The processor 901 is used for executing the program stored in the memory 903 to realize the following steps:

[0139] Obtaining attribute information of a sample video, wherein the attribute information comprises a plurality of first user viewing durations and a first average viewing duration of the sample video, and the first average viewing duration is an average duration calculated according to the plurality of first user viewing durations;

[0140] Calculating a duration label of the sample video according to the plurality of first user viewing durations and the first average viewing duration;

[0141] Inputting the attribute information of the sample video into a to-be-trained network model to calculate a predicted viewing duration of the sample video, and calculating a current loss of the to-be-trained network model according to the predicted viewing duration and the duration label, adjusting parameters of the to-be-trained network model according to the current loss and continuing to train until a preset loop storage is met or the current loss is less than a preset loss threshold, and obtaining a trained network model.

[0142] Since a user often watches a video for a long time only when the user likes the video, when recommending a video that a user likes according to the trained network model, the video is recommended according to the duration of the video and the predicted viewing duration of the user, which can avoid the problem of low accuracy when a video is recommended only according to features such as a user's historical browsing record, content popularity and user identification that cannot accurately reflect the real preference of the user, and improve the accuracy of video recommendation. Meanwhile, in actual use, the revenue of a user watching a video may be different for an operator of the application, wherein the revenue of the user watching a long video is generally greater than the revenue of the user watching a short video, and the revenue of the user watching a video for a long time is generally greater than the revenue of the user watching a video for a short time. Therefore, the prediction of the user's viewing duration and the recommendation of the video through the model can not only improve the recommendation accuracy, but also increase the revenue of the operator of the application by preferentially recommending long videos to the user.

[0143] The embodiment of the application further provides an electronic device, such as Figure 9 As shown, the device comprises a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902 and the memory 903 complete mutual communication through the communication bus 904,

[0144] The memory 903 is used for storing a computer program.

[0145] The processor 901 is configured to implement the following steps when executing the program stored in the memory 903:

[0146] Obtain attribute information of a plurality of videos to be recommended;

[0147] Input the attribute information of the plurality of videos to be recommended into a pre-trained network model to obtain a preset viewing duration of each video to be recommended, wherein the pre-trained network model is a network model trained by the training method of the network model.

[0148] Select the first N videos to be recommended corresponding to the longest preset viewing duration from the plurality of videos to be recommended and recommend the first N videos to the user.

[0149] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0150] The communication interface is configured to communicate between the terminal and other devices.

[0151] The memory can include a Random Access Memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the processor.

[0152] The processor mentioned above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0153] In another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements the training method of any of the network models described in the above embodiments.

[0154] In another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the video recommendation methods described in the above embodiments.

[0155] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the training method of any of the network models described in the above embodiments.

[0156] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the video recommendation methods described in the above embodiments.

[0157] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

[0158] It is to be noted that, in the present text, the terms such as first and second, and the like, are used merely to differentiate one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between such entities or operations. Moreover, the terms "comprising", "containing", or any other variant thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements in the list, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the statement "comprising a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the stated element.

[0159] The various embodiments described in the present specification are described in a related manner, and the same or similar parts among the various embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, the device, electronic device, storage medium, and computer program product embodiments are described simply because they are substantially similar to the method embodiments, and the relevant parts can be referred to the part of the method embodiment.

[0160] The above only describes the preferred embodiments of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for training a network model, characterized in that, The method comprises: obtaining attribute information of a sample video, wherein the attribute information comprises a plurality of first user viewing durations of the sample video and a first average viewing duration, and the first average viewing duration is an average duration calculated according to the plurality of first user viewing durations; identifying a time duration interval corresponding to each first user viewing duration in a plurality of preset time duration intervals; determining a time duration characteristic value corresponding to the identified corresponding time duration interval according to a preset correspondence between the preset time duration interval and the time duration characteristic value, to obtain a plurality of first viewing qualities of the sample video, wherein the first viewing quality is used to represent the length of the first user viewing duration; calculating a ratio of the plurality of first viewing qualities and the first average viewing duration to obtain a first ratio; calculating a time duration label of the sample video according to the first ratio; inputting the attribute information of the sample video into a to-be-trained network model to calculate a predicted viewing duration of the sample video, and calculating a current loss of the to-be-trained network model according to the predicted viewing duration and the time duration label, adjusting parameters of the to-be-trained network model according to the current loss to continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, to obtain a trained network model.

2. The method of claim 1, wherein, The calculating of the time duration label of the sample video according to the first ratio comprises: calculating the time duration label of the sample video according to the first ratio through a preset formula: T = max(1, 2.3 log(a) ) wherein a represents the first ratio, and T represents the time duration label of the sample video.

3. A method of training a network model, the method comprising: The method comprises: obtaining a second average user viewing duration of a plurality of sample videos of the same episode in a plurality of historical time intervals and a second viewing quality of each sample video; for any historical time interval, calculating a second ratio of the second viewing quality of each sample video in the episode to the second average user viewing duration of the episode; calculating a time duration label of each sample video in the episode corresponding to the historical time interval according to the second ratio; inputting the second average user viewing duration and the second viewing quality of the sample video into a to-be-trained network model to calculate a predicted viewing duration of the sample video, and calculating a current loss of the to-be-trained network model according to the predicted viewing duration and the time duration label, adjusting parameters of the to-be-trained network model according to the current loss to continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, to obtain a trained network model.

4. The method of claim 3, wherein, After the calculating of the time duration label of each sample video in the episode corresponding to the historical time interval according to the second ratio, the method further comprises: comparing the calculated time duration label with a first preset label value, and modifying the calculated time duration label to the first preset label value when the first preset label value is greater than the calculated time duration label.

5. A video recommendation method, characterized by, The method comprises: obtaining attribute information of a plurality of to-be-recommended videos; Input the attribute information of the plurality of videos to be recommended into a pre-trained network model to obtain a preset viewing time length of each video to be recommended, wherein the pre-trained network model is a network model trained by the method in any one of claims 1-4; Select the first N videos to be recommended corresponding to the longest preset viewing time length from the plurality of videos to be recommended and recommend the first N videos to the user.

6. A device for training a network model, characterized by, The device comprises: an attribute acquisition module configured to acquire attribute information of a sample video, wherein the attribute information comprises a plurality of first user viewing time lengths of the sample video and a first average viewing time length, and the first average viewing time length is an average time length calculated according to the plurality of first user viewing time lengths; a label calculation module comprising: a quality acquisition submodule configured to identify a time length interval corresponding to each first user viewing time length in a plurality of preset time length intervals, determine a time length characteristic value corresponding to the identified corresponding time length interval according to a preset correspondence between the time length interval and the time length characteristic value, and obtain a plurality of first viewing qualities of the sample video, wherein the first viewing quality is used to represent the length of the first user viewing time length; a first ratio calculation submodule configured to calculate a ratio of the plurality of first viewing qualities and the first average viewing time length to obtain a first ratio; a time length label calculation submodule configured to calculate a time length label of the sample video according to the first ratio; a model training module configured to input the attribute information of the sample video into a network model to be trained to calculate a predicted viewing time length of the sample video, calculate a current loss of the network model to be trained according to the predicted viewing time length and the time length label, adjust parameters of the network model to be trained according to the current loss, and continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, thereby obtaining a trained network model.

7. A device for training a network model, characterized by, The device comprises: an attribute acquisition module configured to acquire a second average user viewing time length of a plurality of sample videos of a same episode in a plurality of historical time intervals and a second viewing quality of each sample video; a label calculation module comprising: a second ratio calculation submodule configured to calculate, for any historical time interval, a second ratio of the second viewing quality of each sample video in the episode to the second average user viewing time length of the episode; an interval label calculation submodule configured to calculate a time length label of each sample video in the episode corresponding to the historical time interval according to the second ratio; a model training module configured to input the second average user viewing time length and the second viewing quality of the sample video into a network model to be trained to calculate a predicted viewing time length of the sample video, calculate a current loss of the network model to be trained according to the predicted viewing time length and the time length label, adjust parameters of the network model to be trained according to the current loss, and continue training until a preset loop storage is met or the current loss is less than a preset loss threshold, thereby obtaining a trained network model.

8. A video recommendation apparatus, comprising: The device comprises: an information acquisition module configured to acquire attribute information of a plurality of videos to be recommended; The time length calculation module is configured to input attribute information of the plurality of videos to be recommended into a pre-trained network model to obtain a preset viewing time length of each video to be recommended, wherein the pre-trained network model is a network model trained by the method in any one of claims 1-4. The video selection module is configured to select the first N videos corresponding to the longest preset viewing time length from the plurality of videos to be recommended and recommend the first N videos to the user.

9. An electronic device, comprising: The computer device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are in communication with each other through the communication bus. The memory is configured to store a computer program. The processor is configured to execute the program stored in the memory to implement the method steps in any one of claims 1-5.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps in any one of claims 1-5.

Citation Information

Patent Citations

  • Video recommendation method, model training method, electronic equipment and storage medium

    CN115408559A