A video recommendation method, device, apparatus and storage medium
Patent Information
- Application Number
- CN202110932117.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-13
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2041-08-13
AI Technical Summary
[0004]然而,若待推荐视频的标题为网络用户上传该待推荐视频时自定义的标题,可能会导致存在视频的内容相同,而视频的标题不同的多个视频
[0061]在本发明实施的又一方面,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一所述的视频推荐方法。
Smart Images

Figure CN113641855B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet technology, and in particular to a video recommendation method, apparatus, device, and storage medium. Background Technology
[0002] With the rapid development of internet technology, mobile applications offer users an increasing number of functions, allowing them to browse various online resources. For example, when a user wants to watch a video, they can enter search keywords into the client. Upon receiving the user's search keywords, the client can send them to the server. The server can then identify videos associated with the search keywords (which can be called recommended videos) and recommend them to the user.
[0003] In existing technology, if there are videos with the same title among the videos to be recommended, when recommending videos to users, one of the videos with the same title can be selected to recommend to the user in order to avoid recommending duplicate videos.
[0004] However, if the title of the video to be recommended is a custom title set by the user when uploading it, it may result in multiple videos with identical content but different titles. Consequently, based on the above processing, multiple videos with different titles but identical content may be recommended to the user, meaning duplicate videos will be recommended, wasting display space on the client side. Summary of the Invention
[0005] The purpose of this invention is to provide a video recommendation method, apparatus, device, and storage medium to reduce the waste of display space on the client side used for displaying videos. The specific technical solution is as follows:
[0006] In a first aspect of this invention, a video recommendation method is provided, the method comprising:
[0007] When a video request instruction is received from a user, multiple videos to be recommended are obtained based on the video request instruction;
[0008] For every two videos to be recommended, the similarity between the two videos is calculated based on their video content and used as the first similarity score.
[0009] Based on each first similarity, a first number of videos are determined from the plurality of videos to be recommended as target videos; wherein, the first similarity between any two videos in the target videos is less than a preset similarity threshold;
[0010] The target video is recommended to the user.
[0011] Optionally, the video request instruction may include search keywords;
[0012] The process of obtaining multiple videos to be recommended based on the video request instruction includes:
[0013] The search keywords are segmented to obtain multiple keywords, which will be used as keywords to be matched.
[0014] From a set of preset videos, videos whose video feature tags intersect with the multiple keywords to be matched are selected as the first candidate videos;
[0015] Based on the upload time of the first candidate video, and / or the click parameters within the first historical time period, a second number of videos are selected from the first candidate videos as the second candidate videos;
[0016] A third number of videos are selected from the second pool of candidate videos as the videos to be recommended.
[0017] Optionally, selecting a third number of videos from the second candidate videos as videos to be recommended includes:
[0018] Based on the video feature tags of the second candidate videos, the identifier of the user who uploaded the second candidate videos, the click parameters of the second candidate videos within a second historical time period, and the upload time of the second candidate videos, a third number of videos are selected from the second candidate videos as videos to be recommended.
[0019] Optionally, the step of calculating the similarity between the two videos to be recommended, based on their video content, as the first similarity, includes:
[0020] Based on the video content and titles of the two videos to be recommended, the similarity between the two videos to be recommended is calculated and used as the first similarity score.
[0021] Optionally, the step of calculating the similarity between the two videos to be recommended, based on their video content and titles, as the first similarity, includes:
[0022] Based on a pre-trained text vectorization model, the sampled video frames and video titles of the two videos to be recommended are processed to obtain the feature vectors of the two videos to be recommended.
[0023] Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0024] Optionally, before calculating the similarity between the two videos to be recommended based on their video content and titles, and using this as the first similarity score, the method further includes:
[0025] Obtain the target keywords for each of the two videos to be recommended; wherein, the target keywords for one of the videos to be recommended include: the keywords used by users when searching for the video to be recommended within the third historical time period;
[0026] The step of calculating the similarity between the two videos to be recommended, based on their video content and titles, as the first similarity, includes:
[0027] Based on the video content, video titles, video feature tags, and target keywords of the two videos to be recommended, the similarity between the two videos to be recommended is calculated and used as the first similarity score.
[0028] Optionally, the step of calculating the similarity between the two videos to be recommended, based on the video content, video titles, video feature tags, and target keywords of the two videos to be recommended, as the first similarity, includes:
[0029] Based on a pre-trained text vectorization model, the sampled video frames, video titles, video feature tags, and target keywords of the two videos to be recommended are processed to obtain the feature vectors of the two videos to be recommended.
[0030] Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0031] Optionally, the pre-trained text vectorization model processes the sampled video frames, video titles, video feature tags, and target keywords of the two videos to be recommended to obtain feature vectors for each of the two videos to be recommended, including:
[0032] For each target keyword of the two videos to be recommended, determine the videos that users searched based on the target keyword within the third historical time period as the videos to be processed;
[0033] Generate an information sequence corresponding to the target keyword; wherein, the information sequence includes: video information of the target keyword and the video to be processed respectively; in the information sequence, each piece of video information is located after the target keyword, and each piece of video information is arranged in descending order of the number of clicks of the corresponding video to be processed within the third historical time period; the video information of a video to be processed includes: the video identifier, video title, sampled video frames and video feature tags of the video to be processed;
[0034] The information sequence corresponding to each target keyword is input into a pre-trained text vectorization model. For each video to be recommended, the feature vector of the video identifier in the video information of the video to be recommended is obtained from the video information of the video to be recommended output by the text vectorization model, and is used as the feature vector of the video to be recommended.
[0035] In a second aspect of the invention, a video recommendation device is also provided, the device comprising:
[0036] The first acquisition module is used to acquire multiple videos to be recommended based on the video request instruction input by the user when it receives the video request instruction input by the user.
[0037] The first determining module is used to calculate the similarity between any two videos to be recommended based on their video content, and use this similarity as the first similarity.
[0038] The second determining module is used to determine a first number of videos from the plurality of videos to be recommended as target videos based on each first similarity; wherein the first similarity between any two videos in the target videos is less than a preset similarity threshold.
[0039] The recommendation module is used to recommend the target video to the user.
[0040] Optionally, the video request instruction may include search keywords;
[0041] The first acquisition module is specifically used to perform word segmentation on the search keywords to obtain multiple keywords as keywords to be matched;
[0042] From a set of preset videos, videos whose video feature tags intersect with the multiple keywords to be matched are selected as the first candidate videos;
[0043] Based on the upload time of the first candidate video, and / or the click parameters within the first historical time period, a second number of videos are selected from the first candidate videos as the second candidate videos;
[0044] A third number of videos are selected from the second pool of candidate videos as the videos to be recommended.
[0045] Optionally, the first acquisition module is specifically used to select a third number of videos from the second candidate videos as recommended videos based on the video feature tags of the second candidate videos, the identifier of the user who uploaded the second candidate videos, the click parameters of the second candidate videos in a second historical time period, and the upload time of the second candidate videos.
[0046] Optionally, the first determining module is specifically used to calculate the similarity between the two videos to be recommended based on the video content and the video titles of the two videos to be recommended, and use this similarity as the first similarity.
[0047] Optionally, the first determining module is specifically used to process the sampled video frames and video titles of the two videos to be recommended based on a pre-trained text vectorization model to obtain the feature vectors of the two videos to be recommended respectively.
[0048] Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0049] Optionally, the device further includes:
[0050] The second acquisition module is used to acquire the target keywords of each of the two videos to be recommended; wherein, the target keywords of one video to be recommended include: the keywords used by users when searching for the video to be recommended within the third historical time period;
[0051] The first determining module is specifically used to calculate the similarity between the two videos to be recommended based on the video content, video titles, video feature tags, and target keywords of the two videos to be recommended, and use this similarity as the first similarity.
[0052] Optionally, the first determining module is specifically used to process the sampled video frames, video titles, video feature tags and target keywords of the two videos to be recommended based on a pre-trained text vectorization model, so as to obtain the feature vectors of the two videos to be recommended respectively.
[0053] Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0054] Optionally, the first determining module is specifically used to determine, for each target keyword of the two videos to be recommended, the videos that the user searched based on the target keyword within the third historical time period, as the videos to be processed;
[0055] Generate an information sequence corresponding to the target keyword; wherein, the information sequence includes: video information of the target keyword and the video to be processed respectively; in the information sequence, each piece of video information is located after the target keyword, and each piece of video information is arranged in descending order of the number of clicks of the corresponding video to be processed within the third historical time period; the video information of a video to be processed includes: the video identifier, video title, sampled video frames and video feature tags of the video to be processed;
[0056] The information sequence corresponding to each target keyword is input into a pre-trained text vectorization model. For each video to be recommended, the feature vector of the video identifier in the video information of the video to be recommended is obtained from the video information of the video to be recommended output by the text vectorization model, and is used as the feature vector of the video to be recommended.
[0057] In another aspect of the present invention, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
[0058] Memory, used to store computer programs;
[0059] When a processor executes a program stored in memory, it implements any of the video recommendation method steps described above.
[0060] In another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program, when executed by a processor, implements any of the video recommendation methods described above.
[0061] In another aspect 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 above.
[0062] This invention provides a video recommendation method. When a user inputs a video request instruction, the method acquires multiple videos to be recommended based on the instruction. For every two videos to be recommended, the method calculates the similarity between them based on their content, using this similarity as a first similarity. Based on each first similarity, a first number of videos are selected from the multiple videos to be recommended as target videos. The first similarity between any two target videos is less than a preset similarity threshold. The target videos are then recommended to the user.
[0063] Based on the above processing, if the first similarity between any two videos in the target video is less than the preset similarity threshold, since the first similarity can represent the similarity of the video content of the videos to be recommended, then the low similarity between the video content of any two videos in the target video means that there is a low probability of duplicate videos in the target video. Recommending the target video to the user can avoid recommending duplicate videos to the user to a certain extent, and thus reduce the waste of display space in the client for displaying videos. Attached Figure Description
[0064] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0065] Figure 1 This is a flowchart of a video recommendation method provided in an embodiment of the present invention;
[0066] Figure 2 A flowchart of another video recommendation method provided in an embodiment of the present invention;
[0067] Figure 3 A flowchart of another video recommendation method provided in an embodiment of the present invention;
[0068] Figure 4 A flowchart of another video recommendation method provided in an embodiment of the present invention;
[0069] Figure 5 A flowchart of another video recommendation method provided in an embodiment of the present invention;
[0070] Figure 6 A flowchart of another video recommendation method provided in an embodiment of the present invention;
[0071] Figure 7 This is a structural diagram of a video recommendation device provided in an embodiment of the present invention;
[0072] Figure 8 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0073] The technical solutions of the present invention will now be described with reference to the accompanying drawings in the embodiments of the present invention.
[0074] See Figure 1 , Figure 1 This is a flowchart of a video recommendation method provided in an embodiment of the present invention. The video recommendation method is applied to an electronic device, which can be a client or a server, and is used to recommend videos to users.
[0075] The method may include the following steps:
[0076] S101: When a video request instruction is received from the user, multiple videos to be recommended are obtained based on the video request instruction.
[0077] S102: For every two videos to be recommended, calculate the similarity between the two videos based on their video content, and use this similarity as the first similarity.
[0078] S103: Based on the first similarity scores, determine a first number of videos from the multiple videos to be recommended as target videos.
[0079] Among them, the first similarity between any two videos in the target video is less than the preset similarity threshold.
[0080] S104: Recommend target videos to users.
[0081] Based on the video recommendation method provided in this embodiment of the invention, if the first similarity between any two videos in the target video is less than a preset similarity threshold, since the first similarity can represent the similarity of the video content of the videos to be recommended, then the low similarity of the video content between any two videos in the target video means that the possibility of duplicate videos in the target video is low. Recommending target videos to users can avoid recommending duplicate videos to users to a certain extent, and thus can reduce the waste of display space used for displaying videos on the client.
[0082] In step S101, the electronic device can be a smart terminal such as a mobile phone or computer, or it can be a video application installed on such a smart terminal. The electronic device can receive video request commands input by the user. Alternatively, the electronic device can also be a server, and correspondingly, the client can send video request commands input by the user to the electronic device.
[0083] In one implementation, when a user wants to watch a video, they can input a video request command into the electronic device. For example, the electronic device can have a video recommendation page set up. When the user refreshes this page, the electronic device can determine that it has received the user's input video request command. Then, based on the video request command, the electronic device can retrieve multiple videos to be recommended.
[0084] In another implementation, the electronic device's display interface can include a search box. When a user wants to watch a video, they can enter search keywords in the search box to find the video. Correspondingly, when the electronic device receives the search keywords, it can determine that it has received a video request instruction.
[0085] In one embodiment of the invention, the video request instruction carries search keywords. Accordingly, in Figure 1 Based on this, see Figure 2 Step S101 may include the following steps:
[0086] S1011: When a video request instruction is received from a user, the search keywords are segmented to obtain multiple keywords, which are then used as keywords to be matched.
[0087] S1012: From a set of multiple videos, identify the videos whose video feature tags intersect with multiple keywords to be matched, and use them as the first candidate videos.
[0088] S1013: Based on the upload time of the first candidate video and / or the click parameters within the first historical time period, select a second number of videos from the first candidate videos as the second candidate videos.
[0089] S1014: Select a third number of videos from the second candidate videos as the videos to be recommended.
[0090] The preset videos are all videos in the database, which are determined by technical staff based on currently available videos. For example, the preset videos could be all currently uploaded videos, or all videos uploaded by users.
[0091] A video's feature tags may include: a feature tag indicating the video's type, a feature tag indicating the video's theme, and an identifier of the user who uploaded the video.
[0092] When a user wants to watch a video, they can input search keywords into the electronic device. Upon receiving the user's search keywords, the electronic device can perform word segmentation on the received search keywords based on a preset algorithm, resulting in multiple keywords as matchable keywords. The preset algorithm can be a forward maximum matching method, a reverse maximum matching method, or a shortest path segmentation method, etc., but is not limited to these.
[0093] Furthermore, electronic devices can obtain multiple videos to be recommended from a set of preset videos based on the keywords to be matched.
[0094] In one implementation, for each preset video, the electronic device can determine the video feature tag for that video. Then, the electronic device can determine whether the video feature tag of the video intersects with the keyword to be matched. If the video feature tag of the video intersects with the keyword to be matched, that is, at least one video feature tag of the video is the same as the keyword to be matched, then the video can be determined as a video to be recommended.
[0095] In another implementation, the electronic device can identify videos whose video feature tags intersect with multiple keywords to be matched, and use these as the first candidate videos.
[0096] Then, the electronic device can select a second number of videos from the first candidate videos whose upload time is closest to the current time, based on the upload time of each first candidate video, and use them as the second candidate videos.
[0097] Alternatively, the electronic device can select the second-most videos as the second candidate videos, based on the order of their click parameters from largest to smallest within a first historical time period. A video's click parameter can be its click-through rate, its number of clicks, or the sum of its click-through rate and its number of clicks.
[0098] Alternatively, for each first candidate video, the electronic device can calculate the weighted sum of the upload time of the first candidate video and the click parameters of the first candidate video within a first historical time period. Then, the electronic device can select the second-most videos from the first candidate videos as second candidate videos, according to the corresponding weighted sums in descending order.
[0099] The second number can be set by technicians based on experience; for example, the second number can be 1000, or it can be 1500, but it is not limited to these. The first historical time period can be set by technicians based on experience; for example, the first historical time period can be one day before the current time, or it can be three days before the current time, but it is not limited to these.
[0100] Then, the electronic device can determine a third number of videos to be recommended from the second pool of candidate videos in two ways. The third number can be set by technicians based on experience; it can be the same as or different from the second number.
[0101] Method 1: Electronic devices can directly select the second alternative video as the video to be recommended. In this case, the number of third videos is the same as the number of second videos.
[0102] If the second candidate video is directly used as the recommended video, the number of recommended videos will be large, and the calculation of the first similarity between each pair of recommended videos by the electronic device will be very large.
[0103] Therefore, in order to reduce the computational load of electronic devices in determining the first similarity between every two videos to be recommended and improve video recommendation efficiency, in Method 2, the above step S1014 may include the following steps: selecting a third number of videos from the second candidate videos as videos to be recommended, based on the video feature tags of the second candidate videos, the identifier of the user who uploaded the second candidate videos, the click parameters of the second candidate videos within a second historical time period, and the upload time of the second candidate videos.
[0104] The second historical time period can be set by technical personnel based on experience. The second historical time period can be the same as the first historical time period, or it can be different from the first historical time period.
[0105] In one implementation, the electronic device can input the video feature tags of the second candidate video, the identifier of the user who uploaded the second candidate video, the click parameters of the second candidate video within a second historical time period, and the upload time of the second candidate video into a pre-trained rating prediction model to obtain the rating of the second candidate video output by the rating prediction model. The rating prediction model can be a DNN (Deep Neural Network) model or an NCF (Neural Collaborative Filtering) model.
[0106] Then, the electronic device can select the top three number of videos from the second pool of candidate videos, in descending order of their corresponding ratings, as the videos to be recommended. The third number is different from the second number; for example, the third number could be 10% of the second number, or it could be 15% of the second number, but it is not limited to these.
[0107] The rating prediction model is trained based on a first preset training sample. This first preset training sample may include: video feature labels of the first sample video, the identifier of the user who uploaded the first sample video, click parameters of the first sample video within a fourth historical time period, the upload time of the first sample video, and the rating of the first sample video. The rating of the first sample video can be determined based on whether the user has watched it. For example, if the user has watched the first sample video, the rating is 1; if the user has not watched the first sample video, the rating is 0.
[0108] The electronic device can use the video feature tags of a sample video, the identifier of the user who uploaded the first sample video, the click parameters of the first sample video within the fourth historical time period, and the upload time of the first sample video as input data for the initial rating prediction model. The rating of the first sample video is used as the output data for the initial rating prediction model, and the model parameters of the initial rating prediction model are adjusted. When a preset convergence condition is met, a trained rating prediction model is obtained.
[0109] Based on the above processing, it is evident that reducing the number of videos to be recommended can reduce the computational load of electronic devices in determining the first similarity between every two videos to be recommended, thereby improving video recommendation efficiency.
[0110] In step S102, the electronic device can calculate the first similarity between every two videos to be recommended in the following manner.
[0111] Method 1: For each video to be recommended, the electronic device can extract video frames from the video to obtain sampled video frames. For example, the electronic device can extract the first frame, the middle frame, and the last frame of the video to be recommended as sampled video frames, or the electronic device can extract video frames from the video to be recommended according to a preset sampling interval.
[0112] Then, for each sampled video frame of the video to be recommended, the pixel value of each pixel in the sampled video frame is obtained, and a feature matrix of the sampled video frame is generated based on the pixel values of each pixel. For example, the pixel values of RGB (red, green, blue) images belong to 0-255, which can be divided into 16 sub-ranges of 16 pixel values each. For each pixel in the sampled video frame, if the pixel value belongs to the sub-range 0-16, the corresponding feature element is determined to be 0; if the pixel value belongs to the sub-range 17-32, the corresponding feature element is determined to be 1; if the pixel value belongs to the sub-range 33-48, the corresponding feature element is determined to be 2, and so on, so that the feature elements corresponding to each pixel can be obtained, which serve as the feature matrix of the sampled video frame.
[0113] Furthermore, for each pair of videos to be recommended, the electronic device can calculate the Hamming distance of the feature matrix of each sampled video frame of the two videos to be recommended, and calculate the mean of the Hamming distances of each sampled video frame as the first similarity between the two videos to be recommended.
[0114] Method 2: In one embodiment of the present invention, in Figure 1 Based on this, see Figure 3 Step S102 may include the following steps:
[0115] S1021: Based on the video content and video titles of the two videos to be recommended, calculate the similarity between the two videos to be recommended, and use it as the first similarity.
[0116] In one implementation, for each of the two videos to be recommended, the electronic device can generate a content feature vector of the video content and a title feature vector of the video title of the video to be recommended. The method by which the electronic device generates the content feature vector and the title feature vector can be found in the following embodiments.
[0117] Then, the electronic device can calculate the similarity (which can be called the second similarity) of the content feature vectors of the two videos to be recommended, and calculate the similarity (which can be called the third similarity) of the title feature vectors of the two videos to be recommended. Then, the weighted sum of the second similarity and the third similarity of the two videos to be recommended is calculated to obtain the first similarity of the two videos to be recommended.
[0118] In another implementation, Figure 3 Based on this, see Figure 4 Step S1021 may include the following steps:
[0119] S10211: Based on a pre-trained text vectorization model, the sampled video frames and video titles of the two videos to be recommended are processed to obtain the feature vectors of the two videos to be recommended.
[0120] S10212: Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0121] Among them, the text vectorization model can be the word 2vec (word to vector) model.
[0122] In one implementation, for each video to be recommended, the electronic device can process the sampled video frames and video titles of the two videos to be recommended based on a pre-trained text vectorization model to obtain the feature vectors of the two videos respectively. The method by which the electronic device determines the feature vectors of the videos to be recommended can be found in the following embodiments.
[0123] Furthermore, the electronic device can calculate the similarity between the feature vectors of the two videos to be recommended, as the first similarity. For example, the electronic device can calculate the Euclidean distance between the feature vectors of the two videos to be recommended, or it can calculate the cosine similarity between the feature vectors of the two videos to be recommended.
[0124] Method 3: In one embodiment of the present invention, in Figure 3 Based on this, see Figure 5 Before step S1021, the method may further include the following steps:
[0125] S1022: Obtain the target keywords for each of the two videos to be recommended.
[0126] The target keywords for a video to be recommended include the keywords used by users when searching for the video within the third historical time period.
[0127] Accordingly, step S1021 may include the following steps:
[0128] S10213: Based on the video content, video titles, video feature tags, and target keywords of the two videos to be recommended, calculate the similarity between the two videos to be recommended, and use it as the first similarity score.
[0129] The third historical time period can be set by technical personnel based on experience. The third historical time period can be the same as or different from the first and second historical time periods.
[0130] In one embodiment of the present invention, step S10213 may include the following steps:
[0131] Step 1: Based on the pre-trained text vectorization model, process the sampled video frames, video titles, video feature tags and target keywords of the two videos to be recommended to obtain the feature vectors of the two videos to be recommended.
[0132] Step 2: Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0133] In one embodiment of the present invention, step 1 may include the following steps:
[0134] Step 11: For each target keyword of the two videos to be recommended, determine the videos that users searched for based on the target keyword within the third historical time period, and use them as the videos to be processed.
[0135] Step 12: Generate the information sequence corresponding to the target keyword.
[0136] The information sequence includes the target keyword and the video information of the video to be processed. In the information sequence, each video information item follows the target keyword, and the video information items are arranged in descending order of the number of clicks on the corresponding video to be processed within the third historical time period. The video information of a video to be processed includes: the video identifier, video title, sampled video frames, and video feature tags.
[0137] Step 13: Input the information sequence corresponding to each target keyword into the pre-trained text vectorization model. For the video information of each video to be recommended, obtain the feature vector of the video identifier in the video information of the video to be recommended output by the text vectorization model, and use it as the feature vector of the video to be recommended.
[0138] Each target keyword corresponds to an information sequence, and the information sequence contains the target keyword and video information of the videos to be processed that the user searched for based on the target keyword within the third historical time period.
[0139] The videos to be processed are those found by users based on target keywords within the third historical time period, and the target keywords are the keywords used by users when searching for the videos to be recommended within the third historical time period. Based on the target keywords, users may find other videos besides the videos to be recommended. In other words, the videos to be recommended belong to the videos found by users based on target keywords, and thus belong to the category of videos to be processed.
[0140] Therefore, the information sequence corresponding to each target keyword input into the text vectorization model contains the video information of the two videos to be recommended. Accordingly, based on the text vectorization model, the feature vectors of the video information (including video identifier, video title, sampled video frame and video feature label) of the two videos to be recommended can be obtained, and the feature vectors of the video identifiers of the two videos to be recommended can be obtained as the feature vectors of the two videos to be recommended respectively.
[0141] A video identifier can be a unique number set by technicians to indicate the video's identity.
[0142] The text vectorization model is trained based on a second preset training sample. The second preset training sample may include: sample keywords, video information of videos searched by users based on sample keywords (which can be called second sample videos), and feature vectors of video identifiers, video titles, sampled video frames, and video feature labels in the video information of the second sample videos, determined by the one-hot encoding algorithm.
[0143] The electronic device can determine the information sequence of video information containing sample keywords and a second sample video. Then, the electronic device can use the information sequence corresponding to the sample keywords as the input data of the initial structure text vectorization model, and use the feature vectors of the video identifier, video title, sampled video frames, and video feature labels in the video information of the second sample video as the output data of the initial structure text vectorization model. The model parameters of the initial structure text vectorization model are adjusted, and when the preset convergence condition is reached, the trained text vectorization model is obtained.
[0144] In one implementation, the electronic device can calculate the similarity between the feature vectors of the two videos to be recommended, as a first similarity. For example, the electronic device can calculate the Euclidean distance between the feature vectors of the two videos to be recommended, or it can calculate the cosine similarity between the feature vectors of the two videos to be recommended.
[0145] For example, an electronic device can calculate the Euclidean distance between the feature vectors of the two videos to be recommended, based on the following formula, as the first similarity.
[0146]
[0147] d represents the Euclidean distance between the feature vectors of the two videos to be recommended, N represents the number of elements in the feature vectors of the two videos to be recommended, and x represents the distance between the feature vectors of the two videos to be recommended. 1o Let x represent the i-th element in the feature vector of one of the two videos to be recommended. 2o This represents the i-th element in the feature vector of the other video among the two videos to be recommended.
[0148] In another implementation, for every two videos to be recommended, the electronic device can calculate the similarity of the feature vectors of the video identifiers, the feature vectors of the video titles, the feature vectors of the sampled video frames, and the feature vectors of the video feature tags. Then, the electronic device can calculate a weighted sum of these similarities as the first similarity between the two videos to be recommended.
[0149] Furthermore, to improve video recommendation efficiency, electronic devices can acquire the target keywords used by users during a third historical time period and the videos found in those searches. Based on the target keywords and video information, they calculate the feature vectors for each video. The electronic device can then store these feature vectors locally. Subsequently, when a video to be recommended is determined based on a received video request, the electronic device can directly retrieve the locally stored feature vectors of the videos to be recommended and calculate the first similarity between the feature vectors of every two videos to be recommended. Then, the electronic device can recommend videos to the user based on this first similarity. Compared to calculating the feature vectors of videos to be recommended after they have been determined, this method improves video recommendation efficiency, reduces user waiting time, and enhances the user experience.
[0150] In step S103, the first number can be set by a technician based on experience. For example, the first number can be the number of videos that the client's display interface can display. The preset similarity threshold can be set by a technician based on experience. For example, the preset similarity threshold can be 0.3, or the preset similarity threshold can be 0.2, but it is not limited to these.
[0151] The electronic device can obtain the ratings of the videos to be recommended. Then, the electronic device can select the first number of videos with a first similarity less than a preset similarity threshold from the videos to be recommended, in descending order of rating, as the target videos.
[0152] For multiple videos with low initial similarity, these videos may share the same cover image. If all of these videos are identified as target videos, they will be recommended to the user. However, when browsing the videos, the user may perceive them as having identical content and only view one of them, resulting in a poor user experience and wasting display space on the client side.
[0153] In one implementation, the electronic device can select the top four numbers of videos with a first similarity score less than a preset similarity threshold from the videos to be recommended, in descending order of their scores, as the third candidate videos. The fourth number is greater than the first number. For each third candidate video, the electronic device can obtain its cover image.
[0154] Then, the electronic device can select one video from the third pool of candidate videos in descending order of score as the video to be compared, and determine whether there is a video in the third pool of candidate videos with the same cover image as the video to be compared. If there is no video with the same cover image as the video to be compared, the electronic device can determine the video to be compared as the target video, and select the next video from the third pool of candidate videos in descending order of score as the video to be compared, and continue to determine whether there is a video in the third pool of candidate videos with the same cover image as the video to be compared.
[0155] If a video with the same cover image as the video to be compared exists, the electronic device can identify the video to be compared as the target video and remove the video with the same cover image from the third candidate video list. Then, the electronic device can select the next video from the third candidate video list in descending order of score as the video to be compared, and continue to determine whether there is a video with the same cover image as the video to be compared in the third candidate video list, and so on, until a first number of target videos are identified.
[0156] Based on the above processing, we can avoid recommending videos with the same cover image to users, reduce the waste of display space in the client for displaying videos, and improve the user experience.
[0157] In step S104, in one implementation, if the electronic device is a client, the electronic device can directly display the target video on the display interface for the user to watch.
[0158] In another implementation, if the electronic device is a server, it can send the target video to the client so that the client can display the target video on the display interface for the user to watch.
[0159] See Figure 6 , Figure 6 This is a flowchart of another video recommendation method provided in an embodiment of the present invention.
[0160] In the offline phase, electronic devices can perform image embedding based on the target keywords used by users during searches and the videos found within the third historical time period. Specifically, the electronic device can calculate the feature vectors of each video based on the target keywords and the video information. The electronic device can also perform image-text similarity calculations on each video; that is, it can obtain the locally stored feature vectors of each video, calculate the similarity between the feature vectors of two videos, and store the similarity locally.
[0161] During the Online phase, when the electronic device receives the user's search keywords, it can retrieve videos from the corpus (database). Specifically, it can identify videos from a set of pre-defined videos whose feature tags intersect with the keywords to be matched, thus obtaining first-choice videos. For each first-choice video, the electronic device can calculate a weighted sum of its upload time and the click parameters within a first historical time period.
[0162] The electronic device can perform a coarse sorting of the first candidate videos to obtain the second candidate videos. That is, the electronic device can select the second-to-last number of videos from the first candidate videos according to the corresponding weighted sum in descending order, and use them as the second candidate videos.
[0163] The electronic device can refine the second candidate videos to obtain the videos to be recommended. That is, the electronic device can select a third number of videos from the second candidate videos as the videos to be recommended based on the video feature tags of the second candidate videos, the identifier of the user who uploaded the second candidate videos, the click parameters of the second candidate videos in the second historical time period, and the upload time of the second candidate videos.
[0164] Then, the electronic device can perform image-text diversity control on the videos to be recommended, that is, the electronic device can obtain the first similarity between each video to be recommended that is stored locally. The electronic device can determine a first number of target videos from the multiple videos to be recommended that have a first similarity of less than a preset similarity threshold (i.e., θ) between any two videos.
[0165] For example, the videos to be recommended may include 11 videos, namely: item1, item2, item3...item10, item11. For each video to be recommended, if the first similarity between the video to be recommended and any other video to be recommended is less than a preset similarity threshold (i.e., θ), the electronic device can determine that the video to be recommended is the target video. For example, the first similarity between item3 and item1 is less than the preset similarity threshold, i.e., sim(1,3)<θ; the first similarity between item3 and item2 is less than the preset similarity threshold, i.e., sim(2,3)<θ, and so on, until the first similarity between item3 and item11 is less than the preset similarity threshold, i.e., sim(11,3)<θ, at which point the electronic device can determine that item3 is the target video.
[0166] Furthermore, electronic devices can recommend target videos to users. For example, an electronic device can display target videos according to Twiddler (a preset display rule).
[0167] Based on the video recommendation method provided in this embodiment of the invention, if the first similarity between any two videos in the target video is less than a preset similarity threshold, since the first similarity can represent the similarity of the video content of the videos to be recommended, then the low similarity of the video content between any two videos in the target video means that there is a low probability of duplicate videos in the target video. Recommending target videos to users can avoid recommending duplicate videos to users to a certain extent, and thus can reduce the waste of display space used for displaying videos on the client.
[0168] and Figure 1 For the corresponding method implementation examples, see [link to relevant documentation]. Figure 7 , Figure 7 This is a structural diagram of a video recommendation device provided in an embodiment of the present invention. The device includes:
[0169] The first acquisition module 701 is used to acquire multiple videos to be recommended based on the video request instruction input by the user when the video request instruction is received.
[0170] The first determining module 702 is used to calculate the similarity between two videos to be recommended based on the video content of the two videos to be recommended, and use the result as the first similarity.
[0171] The second determining module 703 is used to determine a first number of videos from the plurality of videos to be recommended as target videos based on each first similarity; wherein the first similarity between any two videos in the target videos is less than a preset similarity threshold.
[0172] The recommendation module 704 is used to recommend the target video to the user.
[0173] Optionally, the video request instruction may include search keywords;
[0174] The first acquisition module 701 is specifically used to perform word segmentation on the search keywords to obtain multiple keywords as keywords to be matched;
[0175] From a set of preset videos, videos whose video feature tags intersect with the multiple keywords to be matched are selected as the first candidate videos;
[0176] Based on the upload time of the first candidate video, and / or the click parameters within the first historical time period, a second number of videos are selected from the first candidate videos as the second candidate videos;
[0177] A third number of videos are selected from the second pool of candidate videos as the videos to be recommended.
[0178] Optionally, the first acquisition module 701 is specifically used to select a third number of videos from the second candidate videos as recommended videos based on the video feature tags of the second candidate videos, the identifier of the user who uploaded the second candidate videos, the click parameters of the second candidate videos in a second historical time period, and the upload time of the second candidate videos.
[0179] Optionally, the first determining module 702 is specifically used to calculate the similarity between the two videos to be recommended based on the video content and the video titles of the two videos to be recommended, and use this as the first similarity.
[0180] Optionally, the first determining module 702 is specifically used to process the sampled video frames and video titles of the two videos to be recommended based on a pre-trained text vectorization model to obtain the feature vectors of the two videos to be recommended respectively.
[0181] Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0182] Optionally, the device further includes:
[0183] The second acquisition module is used to acquire the target keywords of each of the two videos to be recommended; wherein, the target keywords of one video to be recommended include: the keywords used by users when searching for the video to be recommended within the third historical time period;
[0184] The first determining module 702 is specifically used to calculate the similarity between the two videos to be recommended based on the video content, video titles, video feature tags, and target keywords of the two videos to be recommended, and use this similarity as the first similarity.
[0185] Optionally, the first determining module may be specifically used to process the sampled video frames, video titles, video feature tags and target keywords of the two videos to be recommended based on a pre-trained text vectorization model, so as to obtain the feature vectors of the two videos to be recommended respectively.
[0186] Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
[0187] Optionally, the first determining module 702 is specifically used to determine, for each target keyword of the two videos to be recommended, the videos that the user searched based on the target keyword within the third historical time period, as the videos to be processed;
[0188] Generate an information sequence corresponding to the target keyword; wherein, the information sequence includes: video information of the target keyword and the video to be processed respectively; in the information sequence, each piece of video information is located after the target keyword, and each piece of video information is arranged in descending order of the number of clicks of the corresponding video to be processed within the third historical time period; the video information of a video to be processed includes: the video identifier, video title, sampled video frames and video feature tags of the video to be processed;
[0189] The information sequence corresponding to each target keyword is input into a pre-trained text vectorization model. For each video to be recommended, the feature vector of the video identifier in the video information of the video to be recommended is obtained from the video information of the video to be recommended output by the text vectorization model, and is used as the feature vector of the video to be recommended.
[0190] Based on the video recommendation device provided in this embodiment of the invention, if the first similarity between any two videos in the target video is less than a preset similarity threshold, since the first similarity can represent the similarity of the video content of the video to be recommended, the low similarity of the video content between any two videos in the target video means that the possibility of duplicate videos in the target video is low. Recommending the target video to the user can avoid recommending duplicate videos to the user to a certain extent, and thus can reduce the waste of display space used to display videos in the client.
[0191] This invention also provides an electronic device, such as... Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.
[0192] Memory 803 is used to store computer programs;
[0193] When processor 801 executes a program stored in memory 803, it performs the following steps:
[0194] When a video request instruction is received from a user, multiple videos to be recommended are obtained based on the video request instruction;
[0195] For every two videos to be recommended, the similarity between the two videos is calculated based on their video content and used as the first similarity score.
[0196] Based on each first similarity, a first number of videos are determined from the plurality of videos to be recommended as target videos; wherein, the first similarity between any two videos in the target videos is less than a preset similarity threshold;
[0197] The target video is recommended to the user.
[0198] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not indicate that there is only one bus or one type of bus.
[0199] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0200] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0201] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0202] 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.
[0203] 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.
[0204] 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)).
[0205] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0206] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0207] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A video recommendation method, characterized in that, The method includes: When a video request instruction is received from a user, multiple videos to be recommended are obtained based on the video request instruction; For every two videos to be recommended, the similarity between the two videos is calculated based on their video content and used as the first similarity score. Based on the first similarity scores, a first number of videos are selected from the plurality of videos to be recommended as target videos; wherein, the first similarity score between any two videos in the target videos is less than a preset similarity threshold; and the cover images of any two videos in the target videos are different. Recommend the target video to the user; The step of calculating the similarity between the two videos to be recommended, based on their video content, as the first similarity, includes: Based on the video content and titles of the two videos to be recommended, the similarity between the two videos to be recommended is calculated as the first similarity score; wherein, the title of one of the videos to be recommended is: the title customized by the user who uploaded the video to be recommended when uploading the video to be recommended; The calculation of the similarity between the two videos to be recommended, based on their video content and titles, and using this similarity as the first similarity, includes: Based on a pre-trained text vectorization model, the sampled video frames and video titles of the two videos to be recommended are processed to obtain the feature vectors of the two videos to be recommended. The feature vector of a video to be recommended includes: a content feature vector representing the video content of the video to be recommended, and a title feature vector representing the video title of the video to be recommended. Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity. The calculation of the similarity between the feature vectors of the two videos to be recommended, as the first similarity, includes: Calculate the similarity between the content feature vectors of the two videos to be recommended, and use it as the second similarity. Calculate the similarity between the title feature vectors of the two videos to be recommended, and use it as the third similarity. The weighted sum of the second similarity and the third similarity is calculated to obtain the first similarity between the two videos to be recommended.
2. The method according to claim 1, characterized in that, The video request command carries search keywords; The process of obtaining multiple videos to be recommended based on the video request instruction includes: The search keywords are segmented to obtain multiple keywords, which will be used as keywords to be matched. From a set of preset videos, videos whose video feature tags intersect with the multiple keywords to be matched are selected as the first candidate videos; Based on the upload time of the first candidate video, and / or the click parameters within the first historical time period, a second number of videos are selected from the first candidate videos as the second candidate videos; A third number of videos are selected from the second pool of candidate videos as the videos to be recommended.
3. The method according to claim 2, characterized in that, The step of selecting a third number of videos from the second candidate videos as videos to be recommended includes: Based on the video feature tags of the second candidate videos, the identifier of the user who uploaded the second candidate videos, the click parameters of the second candidate videos within a second historical time period, and the upload time of the second candidate videos, a third number of videos are selected from the second candidate videos as videos to be recommended.
4. The method according to claim 1, characterized in that, Before calculating the similarity between the two videos to be recommended based on their video content and titles, and using this similarity as the first similarity score, the method further includes: Obtain the target keywords for each of the two videos to be recommended; wherein, the target keywords for one of the videos to be recommended include: the keywords used by users when searching for the video to be recommended within the third historical time period; The calculation of the similarity between the two videos to be recommended, based on their video content and titles, and using this similarity as the first similarity, includes: Based on the video content, video titles, video feature tags, and target keywords of the two videos to be recommended, the similarity between the two videos to be recommended is calculated and used as the first similarity score.
5. The method according to claim 4, characterized in that, The similarity between the two videos to be recommended is calculated based on their video content, titles, feature tags, and target keywords. This similarity serves as the first similarity score. The calculation includes: Based on a pre-trained text vectorization model, the sampled video frames, video titles, video feature tags, and target keywords of the two videos to be recommended are processed to obtain the feature vectors of the two videos to be recommended. Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity.
6. The method according to claim 5, characterized in that, The pre-trained text vectorization model processes the sampled video frames, video titles, video feature tags, and target keywords of the two videos to be recommended, obtaining feature vectors for each of the two videos to be recommended, including: For each target keyword of the two videos to be recommended, determine the videos that users searched based on the target keyword within the third historical time period as the videos to be processed; Generate an information sequence corresponding to the target keyword; wherein, the information sequence includes: video information of the target keyword and the video to be processed respectively; in the information sequence, each piece of video information is located after the target keyword, and each piece of video information is arranged in descending order of the number of clicks of the corresponding video to be processed within the third historical time period; the video information of a video to be processed includes: the video identifier, video title, sampled video frames and video feature tags of the video to be processed; The information sequence corresponding to each target keyword is input into a pre-trained text vectorization model. For each video to be recommended, the feature vector of the video identifier in the video information of the video to be recommended is obtained from the video information of the video to be recommended output by the text vectorization model, and is used as the feature vector of the video to be recommended.
7. A video recommendation device, characterized in that, The device includes: The first acquisition module is used to acquire multiple videos to be recommended based on the video request instruction input by the user when it receives the video request instruction input by the user. The first determining module is used to calculate the similarity between any two videos to be recommended based on their video content, and use this similarity as the first similarity. The second determining module is used to determine a first number of videos as target videos from the plurality of videos to be recommended based on each first similarity; wherein, the first similarity between any two videos in the target videos is less than a preset similarity threshold; and the cover images of any two videos in the target videos are different; The recommendation module is used to recommend the target video to the user; The first determining module is specifically used for: Based on the video content and titles of the two videos to be recommended, the similarity between the two videos to be recommended is calculated as the first similarity score; wherein, the title of one of the videos to be recommended is: the title customized by the user who uploaded the video to be recommended when uploading the video to be recommended; The first determining module is specifically used for: Based on a pre-trained text vectorization model, the sampled video frames and video titles of the two videos to be recommended are processed to obtain the feature vectors of the two videos to be recommended. The feature vector of a video to be recommended includes: a content feature vector representing the video content of the video to be recommended, and a title feature vector representing the video title of the video to be recommended. Calculate the similarity between the feature vectors of the two videos to be recommended, and use it as the first similarity. The first determining module is specifically used for: Calculate the similarity between the content feature vectors of the two videos to be recommended, and use it as the second similarity. Calculate the similarity between the title feature vectors of the two videos to be recommended, and use it as the third similarity. The weighted sum of the second similarity and the third similarity is calculated to obtain the first similarity between the two videos to be recommended.
8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-6.
Citation Information
Patent Citations
Video recommendation method, server and computer readable storage medium
CN111212303A