Video generation method, device, electronic device and computer readable storage medium

By extracting the intent features of the video generation request and multi-level action recognition technology, combined with the attention mechanism, screening and fusion of video clips, the problem of discontinuous and single video generation in the existing technology is solved, and video generation that is more in line with the user's intention is achieved. , which improves the user experience.

CN113079420BActive Publication Date: 2024-10-18BEIJING SAMSUNG TELECOM R&D CENT +1

Patent Information

Application Number
CN202010006953.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-03
Publication Date
2024-10-18
Estimated Expiration
2040-01-03

AI Technical Summary

Technical Problem

Existing video generation methods cannot effectively consider user intentions, causing the generated video content to be discontinuous and single, making it difficult to meet the specific needs of users.

Method used

By extracting the intent features of the video generation request, the target video is generated based on the intent features and candidate videos, and technologies such as multi-level action recognition and attention mechanisms are used to filter and fuse video clips to generate videos that are more in line with the user's intent.

Benefits of technology

It improves the continuity and diversity of video generated content, which can better meet the actual needs of users and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113079420B_ABST
    Figure CN113079420B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a video generation method, device, electronic device and computer-readable storage medium, the method comprising: extracting the intent feature of the video generation request; generating a target video based on the intent feature and the candidate video. Based on the solution provided by the embodiment of the present application, a target video that can better reflect the user's true intention can be obtained, better meet the user's actual needs, and enhance the user's perception.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a video generation method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the rapid development of science and technology and the improvement of people's living standards, film cameras have gradually withdrawn from the stage, and users are increasingly accustomed to using mobile phones and other terminal devices to take photos and videos. However, this convenient shooting method also brings some problems. Since the shooting is relatively casual, a large amount of video content is repeated, it is not easy to find a specific video you want, and there are often many useless clips in the video that need to be cut. Although editing software can be used to edit the video later, most video editing software is too professional, which makes it difficult for users to operate.

[0003] In order to meet the application needs of users, some products with video generation functions have appeared. However, the videos generated by the current video generation methods cannot meet the needs of users and need to be further optimized. Summary of the invention

[0004] The purpose of the embodiments of the present application is to solve at least one of the above technical defects, especially the problem that the video generation method in the prior art needs to be further optimized. The solution provided by the embodiments of the present application is as follows:

[0005] In a first aspect, an embodiment of the present application provides a video generation method, the method comprising:

[0006] Extract intent features of video generation requests;

[0007] Generate a target video based on the intent features and candidate videos.

[0008] In a second aspect, an embodiment of the present application provides a video generating device, the device comprising:

[0009] An intent extraction module, used to extract intent features of video generation requests;

[0010] The video generation module is used to generate the target video based on the intent features and candidate videos.

[0011] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor; wherein a computer program is stored in the memory; and the processor is used to execute the method provided in the embodiment of the present application when running the computer program.

[0012] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is run by a processor, the method provided by the embodiment of the present application is executed.

[0013] The beneficial effect brought about by the technical solution provided by the present application is: the solution method provided in the embodiment of the present application, when generating a target video based on a user's video generation request, generates a target video by extracting the intention features of the video generation request, and generating the target video based on the intention features and the candidate videos. Since the user's intention is taken into consideration when generating the target video, the generated target video can better reflect the user's actual intention, better meet the user's actual needs, and enhance the user's perception. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0015] Figure 1 A schematic diagram of a process flow of a video generation method provided in an embodiment of the present application is shown;

[0016] Figure 2 A schematic diagram of a process of generating a video provided in an example of the present application is shown;

[0017] Figure 3 A schematic diagram of a process of screening a video clip provided in an example of the present application is shown;

[0018] Figure 4 A schematic diagram of a process for obtaining a character video clip provided in an example of the present application is shown;

[0019] Figure 5 A schematic diagram of a process of obtaining an action video frequency band provided in an example of the present application is shown;

[0020] Figure 6 A schematic diagram showing the Gaussian distribution of durations corresponding to two levels provided in an example of the present application;

[0021] Figure 7 A schematic diagram of a screening process of an action suggestion result provided in an example of the present application is shown;

[0022] Figure 8 A schematic diagram for explaining the principle of action suggestion result screening provided in an example of the present application is shown;

[0023] Fig. 9 A schematic diagram of a screening process of an action suggestion result provided in an example of the present application is shown;

[0024] Fig.10 A schematic diagram showing relevant information of an action video clip provided in an example of the present application;

[0025] Fig.11 A schematic diagram of a process for screening video clips based on intent features provided in an example of the present application is shown;

[0026] Fig.12a A schematic diagram of a process of calculating correlation provided in an example of the present application is shown;

[0027] Figure 12b A schematic diagram showing the correlation between feature vectors provided in an example of the present application;

[0028] Fig.12c A schematic diagram showing a correlation between feature vectors provided in another example of the present application;

[0029] Fig.13 A schematic diagram of a screening process of a video clip provided in an example of the present application is shown;

[0030] Fig.14 A schematic diagram of a screening process of a video clip provided in an example of the present application is shown;

[0031] Fig.15 A schematic diagram showing the principle of video clip fusion provided in an example of the present application is shown;

[0032] Fig.16 A schematic diagram of the process of generating a video clip in an application scenario in an example of the present application is shown;

[0033] Fig.17 A schematic diagram showing the process of generating a video clip in another application scenario in the present application example is shown;

[0034] Fig.18 A schematic diagram of a process of a video generation method based on an attention mechanism provided in an example of the present application is shown;

[0035] Fig.19 A flowchart of a method for determining an attention weight incorporating user intention provided in an example of the present application is shown;

[0036] Fig. 20 A schematic diagram of the structure of a video generating device provided in an embodiment of the present application is shown;

[0037] Fig.21 A schematic diagram of the structure of an electronic device applicable to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0038] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.

[0039] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0040] With the rapid development of science and technology (especially artificial intelligence technology and computer vision technology) and the improvement of people's living standards, more and more intelligent data processing methods have begun to appear in people's daily lives, and the automatic generation of videos is one of them, such as generating a new video based on multiple videos selected by the user, or generating some new videos based on some clips in one or more videos selected by the user. The inventor of this application found through research that although some products on the market currently provide simple video retrieval and video generation functions, there are at least the following areas for improvement in the existing video generation solutions:

[0041] Most video generation methods simply randomly select some pictures or videos, and then connect and synthesize the selected pictures or videos according to some simple rules (such as in chronological order), without considering the content information of the video. The content continuity of the generated video is poor and it is very unnatural, which is difficult to meet the needs of users. On the other hand, the existing video generation methods do not consider the user's intention in the process of generating videos. Users cannot generate the videos they want, that is, users cannot specify the theme of the video they want to generate, etc., resulting in the content of the videos generated by the existing methods being single and poor in richness.

[0042] In order to solve at least one problem existing in the prior art, the present application provides a new video generation method, which can generate more interesting, diverse, flexible and better meet user needs videos based on various optional implementations of the method.

[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the following will be combined with specific embodiments and drawings to describe in detail how the various optional implementation methods of the present application and the technical solutions of the embodiments of the present application solve the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the drawings.

[0044] Figure 1 A schematic flow chart of a video generation method provided by an embodiment of the present application is shown. As shown in the figure, the method may mainly include the following steps:

[0045] Step S110: obtaining a video generation request;

[0046] The video generation request may include a request for what kind of video the user wants to generate, that is, the request carries the user's intention. Specifically, the video generation request may include the type of video the user wants to generate, the subject of the video to be generated, or the object for which the video to be generated is targeted, and the request may also include the duration of the video the user wants to generate.

[0047] For example, if the video generation request is "I want to generate a 5-minute wonderful video of playing basketball" or "Please help me generate a 5-minute wonderful video of playing basketball", the request includes that the theme of the video that the user wants to generate is "playing basketball" and the video duration is 5 minutes. For another example, a video generation request is "I want to generate a wonderful video of a child riding a bicycle", the request includes that the object of the video to be generated is "children" and the theme of the video is "riding a bicycle".

[0048] Step S120: extracting the intention feature of the video generation request;

[0049] Specifically, the intent feature may be extracted through a neural network, such as a RNN (Recurrent Neural Network).

[0050] Step S130: Generate a target video based on the intent features and the candidate videos.

[0051] In an embodiment of the present application, the candidate videos may be some videos specified by the user, or may be all videos that the executing subject of the method can be authorized to obtain, that is, when a video generation request is obtained, the operation of obtaining candidate videos is triggered, and at this time all videos that can be obtained can be used as candidate videos.

[0052] Among them, the specific way in which the user specifies the candidate video is not limited in the embodiments of the present application. For example, the user can specify which time period the videos obtained (which can be taken by himself or obtained from other devices) are used as candidate videos, or can directly select candidate videos. As an optional method, for example, the user's video generation request can include indication information of the candidate video (such as the time period for obtaining the video). After obtaining the user's video generation request, the video of the corresponding time period can be used as a candidate video based on the indication information; it can also be that after the user's video generation request is obtained, all videos that can be authorized to be obtained are displayed to the user, and the user can specify a candidate video from the displayed videos.

[0053] In actual applications, when the user does not specify which videos to use as candidate videos, the number of videos that can be obtained may be large. For example, the videos that can be obtained may be all videos stored in the user's terminal device or cloud storage space (such as a cloud disk), but a considerable portion of these videos may be irrelevant to the video that the user wants to generate. Therefore, in order to reduce the number of candidate videos and thus reduce the amount of subsequent data processing, the obtained videos may be screened first and the screened videos may be used as candidate videos.

[0054] In an optional embodiment of the present application, the candidate video may specifically be a candidate video obtained based on the intent features of the video generation request; and / or a candidate video obtained based on keywords and / or key words in the video generation request.

[0055] Specifically, as an optional solution, when performing video screening, the videos can be filtered based on the intent features of the user's video request, such as extracting the video features of each acquired video separately, and filtering out some irrelevant videos based on the correlation between the intent features and the video features, such as filtering out videos corresponding to video features whose correlation with the intent features is less than a set value. Among them, the set value can be configured according to actual needs. The larger the set value, the more videos are filtered out, the fewer the number of candidate videos obtained, and the less the subsequent data processing volume. Correspondingly, the smaller the set value, the fewer videos are filtered out. However, if the set value is too large, it will cause one or some of the videos or video clips in the filtered videos to be what the user wants, which may cause some useful videos or video clips to be filtered out. Therefore, when screening videos, as an optional method, the set value can be relatively small.

[0056] As another optional method, all the videos that can be obtained can be filtered based on one or some keywords, key words, etc. in the video generation request. Since the user usually initiates the video generation request in a targeted manner for some content (which may be an object, event, time, etc.), the keywords and / or key words, etc. in the request can be extracted, and the videos can be filtered based on these to obtain candidate videos.

[0057] Of course, in addition to the above two optional methods, some other video screening methods can also be configured according to actual application scenarios or requirements, and different screening methods can be used alone or in combination with each other.

[0058] The video generation method provided in the present application takes the user's intention into consideration when generating the video, so that the generated target video can better reflect the user's actual intention, better meet the user's actual needs, and enhance the user's usage perception.

[0059] It should be noted that the video generation method provided in the embodiment of the present application is executed by an electronic device, specifically by a user terminal device, and of course, it can also be executed by a server. For example, in an application with a video generation function, the method can be executed by the server of the application. Specifically, the user can initiate a video generation request through the user interface of the application installed on the user terminal device. After receiving the request, the user terminal device can send the request to the server. The server can generate a target video based on the video generation method provided in the embodiment of the present application, based on the videos stored in the server or obtained from other storage spaces (such as external storage devices, cloud storage spaces, user terminal devices, etc.), based on the intention features of the user's video generation request. After completing the generation of the target video, the target video that can correspond to the user's video generation intention can be sent to the user terminal device, so that the user terminal device can play and / or save the video. When the method is executed by the user terminal device, the user terminal device can extract the corresponding intention features based on the obtained user's video generation request, and generate a target video corresponding to the user's actual intention based on the extracted intention features and the videos stored in the user terminal device and / or obtained from other storage spaces.

[0060] In the description below, the user terminal device will be taken as the execution subject, and the video generation method will be explained by taking the videos stored in the user terminal device as an example. However, it can be seen from the previous description that the videos based on which the target video is generated can be stored in the terminal device, in an external storage device, or in the cloud or other storage space, as long as the terminal device or server can obtain it with authorization.

[0061] In an optional embodiment of the present application, the above-mentioned intention features may specifically include action behavior intention features.

[0062] In order to generate a target video that can better meet the user's needs, when extracting the user's intention features, deep features of the user's video generation request can be extracted to extract the action behavior intention features contained in the video generation request, that is, what action behavior the user wants to generate or a video related to what action behavior, so as to generate a target video that better meets the needs based on the action behavior intention features and candidate videos.

[0063] In an optional embodiment of the present application, generating a target video based on the intent feature and the candidate videos includes:

[0064] Extracting video features of each candidate video respectively;

[0065] Determine candidate video segments in each candidate video based on video features of each candidate video;

[0066] Screening each candidate video segment based on the intention feature to obtain each target video segment;

[0067] A target video is generated based on each target video segment.

[0068] Specifically, when generating a target video based on the intent features and candidate videos, some candidate video segments in the video can be screened out based on the video features of each candidate video, and then the target video segments can be screened out from each candidate video segment based on the intent features. Based on this method, the segmentation of each candidate video is realized. Compared with the method of directly using one or some videos as target videos, this solution can use the video segments screened out based on video features as candidate video segments for generating target videos. Using this method, video segments with more diverse content and forms can be segmented, so that the target video generated subsequently can be more interesting and more attractive.

[0069] Among them, the method of determining candidate video segments from candidate videos based on the video features of candidate videos can be configured as needed. For example, based on the similarity between the video segments in the candidate videos, some segments with very similar content in the candidate videos can be filtered out, that is, similar segments can be deduplicated. Object recognition can also be performed on the video based on the objects (such as people) contained in the candidate videos, and the segments containing the objects can be screened out.

[0070] In the embodiment of the present application, the video features may specifically include visual features and / or optical flow features of the video.

[0071] Among them, the visual features of a video generally refer to the features obtained by extracting the visual content in the image in the video, that is, the features that can characterize the visual content in the image, which may include but are not limited to the pixel values, color information, objects, etc. in the image. The optical flow is generated by the movement of the foreground target itself in the scene and / or the movement of the shooting device. When the human eye observes the moving object, the scene of the object forms a series of continuously changing images on the human retina. This series of transformed information continuously "flows" through the retina, that is, the image plane, like a "flow" of light, so it can be called optical flow. The optical flow feature is a feature that can reflect the changing information of the image object.

[0072] The extraction of visual features and optical flow features can be realized through neural networks, such as extracting visual features through convolutional neural networks and extracting optical flow features through optical flow networks (Flownet). Optionally, when extracting visual features through neural networks, 3D-CNN (3 Dimensions Convolutional Neural Networks, three-dimensional convolutional neural networks) can be used for extraction. The visual features extracted by 3D-CNN can not only represent the video content, but also the temporal relationship between images of different frames of the video.

[0073] As an optional method, the visual features of the embodiments of the present application can simultaneously adopt visual features and optical flow features, so as to more comprehensively reflect the content in the video and the information on changes in the content through different features, so that subsequently based on the visual features, video clips that are more in line with the user's intentions and rich in content can be screened out to generate a better target video.

[0074] In an optional embodiment of the present application, for a candidate video, determining a candidate video segment in the candidate video based on a video feature of the candidate video may specifically include at least one of the following:

[0075] Based on the video features of the candidate video, object recognition is performed on the candidate video to obtain first candidate video segments containing the target object;

[0076] Based on the video features of the candidate video, action behavior recognition is performed on the candidate video to obtain the time period information corresponding to each video segment containing actions in the candidate video, and based on each time period information, each second candidate video segment is obtained.

[0077] Among them, when performing object recognition, the identified target object can be a specified object or a general object. For example, the object can be a general person, or a certain class or a certain person, such as a man, a woman, or a child. In addition, in practical applications, if the video generation request includes relevant information of the specified object, when the first candidate video segment containing the target object is obtained based on the video features of the candidate video, the candidate video segments can be screened based on the video features and the relevant information of the object included in the video generation request, and subsequent video segments containing the target object related to the user's needs can be screened. If the video generation request does not include relevant information of the specified object, such as the video generation request is "please help me generate a wonderful video of playing basketball", and the request does not include relevant information of the specified object, then the candidate video can be identified based on the video features to obtain each candidate video segment containing the target object (general object, such as a person).

[0078] When performing action recognition of a video based on video features, this method can be specifically understood as analyzing the possible action behaviors in the video, and based on the differences in the possible action behaviors, dividing the candidate video into one or more (including two) video segments, obtaining the time period information of each segment, that is, the duration of the possible action behaviors in a video segment, wherein the time period information can specifically be the time period of a video segment in the candidate video, or the starting time and the ending time, or the starting time and the segment duration, or the ending time and the segment duration. For example, a video segment is a segment from the 10th to the 15th second in the candidate video, and the time period information can be a time period range from the 10th to the 15th second, or it can include the starting time of the 10th second and the ending time of the 15th second, or it can be the starting time of the 10th second and the duration of 5 seconds, or it can be the duration of 5 seconds and the ending time of the 15th second, and of course it can also be other configured time period information representation methods.

[0079] For a time period information, since the time period information reflects the time information of a video clip in the candidate video where an action behavior may exist, the time period information can also be called an action suggestion result or action suggestion for a video clip, that is, it can be understood as a time period suggestion for a video clip where an action behavior may exist.

[0080] For a candidate video, after obtaining the action suggestion results for each video clip in the video, a second candidate video clip can be selected therefrom based on some rules, such as selecting a candidate video clip based on the duration of each action suggestion result (which can be determined based on time period information); in addition, selection can also be made based on the intent features of the video generation request and the clip features of the video clips corresponding to each action suggestion result, such as selecting a video clip with a higher correlation (such as a correlation greater than a set value) as the second candidate video clip based on the correlation between the intent features and the clip features of the video clips corresponding to each action suggestion result.

[0081] Specifically, based on the video features of the candidate videos, action recognition is performed on the candidate videos to obtain information of each time period, which can be achieved through a neural network.

[0082] In an optional embodiment of the present application, if the target video segment includes a first candidate video segment and a second candidate video segment belonging to the same candidate video, generating a target video based on each target video segment includes:

[0083] Merging the first candidate video segment and the second candidate video segment belonging to the same candidate video in each target video segment;

[0084] Generate a target video based on the fused video clips.

[0085] For the same candidate video, since the first candidate video segment and the second candidate video segment are in the candidate video but correspond to two different types of segments, one is a video segment containing an object (which can be referred to as an object segment), and the other is a video segment corresponding to a possible action (which can be referred to as an action segment), therefore, one, some or all of the two types of video segments can be fused to obtain a part or all of the video segments corresponding to a certain object doing a certain action. Of course, the candidate video segments that have not been fused will also be used in the process of generating the candidate target video. That is to say, if the fusion operation of the video segments is performed, these video segments can be used as candidate video segments based on the fused video segments and the candidate video segments that have not been fused to generate the target video.

[0086] In an optional embodiment of the present application, obtaining each second candidate video segment based on each time period information may specifically include:

[0087] Determine the duration of the video clips corresponding to each time period information;

[0088] Determine the level of each time period information based on the length of each segment corresponding to the information of each time period;

[0089] Based on the level of each period of time information, a second candidate video segment is determined from each video segment corresponding to each period of time information.

[0090] That is to say, after determining the action suggestion results in the candidate video, the suggestion results can be graded according to the length of the segments corresponding to each suggestion result, and based on the levels corresponding to all the action suggestion results, the second candidate video segment can be screened out from each video segment. The grade division is based on the length, and the grade division method can be configured according to the needs. Generally, the segment length of the action suggestion result with a higher level is not less than the segment length of the action suggestion result with a lower level. For example, level 1 is the highest level, that is, the larger the number corresponding to the level, the lower the level. The segment length of the action suggestion result belonging to level 1 is not less than the segment length of the action suggestion result belonging to level 2.

[0091] It should be noted that in actual applications, of course, the action suggestion results may not be graded, and all video clips corresponding to each action suggestion result may be used as candidate video clips. The method of determining candidate video clips based on the grade of the action suggestion result can filter out some video clips, thereby reducing the amount of subsequent data processing and improving the efficiency of generating the target video.

[0092] Among them, the specific method of determining the candidate video clips based on the levels corresponding to the action suggestion results can be configured according to actual application needs. For example, the video clips corresponding to one or some higher-level action suggestion results can be determined as candidate video clips, or a certain number of video clips corresponding to all levels can be determined as candidate video clips. Of course, the number of video clips corresponding to different levels can be the same or different. For example, 3 video clips in each level can be used as candidate video clips, and then 3 video clips corresponding to each level can be randomly or pre-configured (such as screening longer) selected as candidate video clips. Of course, if the number of video clips corresponding to a certain level is less than 3, if there are 2 video clips belonging to this level, these 2 can be used as candidate video clips.

[0093] In an optional embodiment of the present application, the step of determining the second candidate video segment from each video segment corresponding to each time segment information based on the level of each time segment information includes:

[0094] Determine the target level within each level;

[0095] The video segments corresponding to the time period information belonging to the target level are determined as second candidate video segments.

[0096] That is to say, when determining candidate videos based on levels, one or more target levels can be determined first, and each video segment with action suggestion results of the target level can be used as a candidate video segment. The method of determining the target level can be configured according to actual application requirements, such as determining one or several higher levels as the target level, or determining the level to which the action suggestion results with durations within a certain duration range belong as the target level.

[0097] In an optional embodiment of the present application, if the video generation request includes the video duration of the target video, based on the level of each action suggestion result, determining the target level in each level includes:

[0098] Based on the video duration and the duration threshold corresponding to each level, a target level in each level is determined.

[0099] That is, each level may correspond to a duration threshold, and the target level may be determined according to the video duration of the target video to be generated and the duration threshold corresponding to each level, so that the generated target video can better meet the actual needs. Similarly, according to the video duration and the duration threshold corresponding to each level, the specific method of determining the target level may also be configured according to the needs, such as determining one or several levels that are closest to the duration threshold and the video duration as the target level.

[0100] Among them, the duration threshold corresponding to each level can be determined based on empirical values ​​and / or experimental values ​​(such as values ​​obtained based on a large amount of sample data). For example, based on a large number of samples, the average duration of each action suggestion result of the same level in the sample can be used as the duration threshold corresponding to the level (in the following description, the duration threshold corresponding to a level may be referred to as the average duration of the level). Generally, the duration threshold corresponding to a higher level is greater than the duration threshold corresponding to a lower level, such as the duration threshold corresponding to level 1 is 10s, and the duration threshold corresponding to level 2 is 5 seconds.

[0101] In an optional embodiment of the present application, for a period of time information, determining the level of the period of time information based on the segment duration corresponding to the period of time information may include at least one of the following:

[0102] Determine the duration interval to which the segment duration corresponding to the time period information belongs, and determine the level corresponding to the duration interval as the level of the time period information, each level corresponding to its own duration interval;

[0103] The level corresponding to the duration threshold closest to the duration of the segment corresponding to the time period information is determined as the level of the time period information.

[0104] In this optional embodiment of the present application, two optional solutions for determining action suggestion results are provided. Specifically, one is to configure a duration interval for each level, and for each action suggestion result, the level to which the action suggestion result belongs can be determined by the duration interval to which the action suggestion result segment duration belongs; the other is to directly determine the level corresponding to the duration threshold closest to the segment duration of the action suggestion result as the level of the action suggestion result.

[0105] Similarly, the duration interval and duration threshold corresponding to each level can be determined based on experimental values ​​and / or empirical values. As an optional solution, based on a large number of samples, according to experience and statistical results, the duration interval of the level can be determined by taking the mean of the segment durations of the action suggestion results of the same level in a large number of samples, i.e., the average duration and the duration standard deviation.

[0106] In an optional embodiment of the present application, there is a common transition duration interval between two adjacent levels. For a period of time information, determining the duration interval to which the segment duration corresponding to the period of time information belongs, and determining the level corresponding to the duration interval as the level of the period of time information may specifically include:

[0107] If the segment duration corresponding to the time period information belongs to a transition duration interval between two adjacent levels, the two adjacent levels corresponding to the transition duration interval are determined as the level of the time period information.

[0108] That is to say, a common duration area, namely the above-mentioned transition duration interval, can be configured for two adjacent levels. If the duration of a certain action suggestion result, namely the segment duration of the time period information, happens to fall within the common duration interval, then the action suggestion result can belong to both levels at the same time.

[0109] The setting of the transition duration area can make an action suggestion result belong to two levels at the same time. The setting of the transition duration interval can at least provide the following two advantages:

[0110] 1) The distinction between levels can be made not too abrupt, and the transition can be natural and more in line with human cognition. This is because, for each video clip in a video, the first few frames of a video clip may be associated with the last few frames of the previous video clip of the clip, and the last few frames of the clip may also be associated with the first few frames of the next video clip of the clip. In other words, a video clip may contain more than one possible potential action, and there may also be some transitional video frames containing different actions. Therefore, by setting the transition duration interval, the level division of the action suggestion results corresponding to each video clip can be more in line with the actual situation.

[0111] 2) It can enhance the content diversity of video clips: As can be seen from the previous description, the duration of higher-level action suggestion results is usually longer than that of lower-level action suggestion results. By setting the transition duration interval, the video clip corresponding to a higher-level action suggestion result can include both relatively long video clips and a small number of shorter video clips. Since the duration of a video clip is determined by the duration of a certain action that may exist in the video, a relatively short video clip corresponds to a possible action of relatively short duration. Therefore, a relatively short video clip can focus more on detailed actions than a longer video clip. Similarly, as can be seen from the foregoing description, in actual applications, there is a high probability that there will be transition areas between different video clips of the same video. It is also possible that during video recording, a certain action is switched to another scene while it is still in progress due to the change of the lens, resulting in no action in the subsequent image, but in fact, the above-mentioned action is still continuing. For these actual scenes, by setting the transition duration interval, a video clip corresponding to a lower-level action suggestion result can have the opportunity to include longer video clips in addition to shorter-duration clips, so that the video clip corresponding to the lower-level action suggestion result can cover some actions in the transition area, or image frames of the switching of action shots. When determining candidate video clips based on levels, since a level can contain both relatively long clips and relatively short clips, it can cover more forms and richer content video clips. Therefore, the types and contents of candidate video clips can be richer, and the clip forms and contents are more diverse, so that the target video generated subsequently can be more interesting and more attractive.

[0112] In an optional embodiment of the present application, based on the video duration and the duration threshold corresponding to each level, determining the target level in each level includes:

[0113] Based on the video length, determine the video time limit;

[0114] The target level in each level is determined according to the video limit time and the time threshold corresponding to each level.

[0115] When the video generation request includes the video duration of the target video segment to be generated, since the target video finally generated may contain one or more of the above-mentioned candidate video segments (the first candidate video segment or the second candidate video segment), the duration of the candidate video segment finally used to generate the target video should not be greater than the video duration. In order to meet this principle, a video limit duration can be determined based on the video duration, and the target level can be determined based on the limit duration.

[0116] It is understandable that, since the duration of the candidate video segment should not be greater than the duration of the target video, the video limit duration should also not be greater than the duration of the video.

[0117] As an optional solution, a duration adjustment factor n can be configured. Assuming that the video duration of the target video is T′, the video limit duration T can be expressed as: T=T′ / n, where n is a positive number not less than 1. For example, the value of n can be a positive integer not less than 1, and of course it can also not be an integer.

[0118] In an optional embodiment of the present application, the levels are arranged in descending order, and the duration threshold corresponding to the current level is not less than the duration threshold corresponding to the next level; according to the video limit duration and the duration threshold corresponding to each level, the target level in each level is determined, including at least one of the following methods 1 and 2:

[0119] Method 1 is as follows:

[0120] According to the order of the levels from high to low, the video limit duration and the duration threshold corresponding to the current level are compared in turn until the video limit duration is not less than the duration threshold corresponding to the current level, and the current level is determined as the target level.

[0121] Method 2 is as follows:

[0122] In order from high to low in each level, the following processes are carried out in sequence until the target level is determined:

[0123] If the video limit duration is not less than the duration threshold corresponding to the current level, the current level is determined as the target level;

[0124] If the video limit duration is less than the duration threshold corresponding to the current level, the target level is determined or the processing to the next level is entered based on the first number of time period information belonging to the current level whose corresponding segment duration is not greater than the video limit duration, and the second number of recommended results whose corresponding segment duration is not greater than the video limit duration in each time period information belonging to the next level.

[0125] Correspondingly, the above-mentioned determining each video segment corresponding to each time period information belonging to the target level as the second candidate video segment includes:

[0126] The video segments corresponding to the time period information of the target level and having a duration shorter than the video limit duration are determined as second candidate video segments.

[0127] For the above-mentioned method 1, the level with the first duration threshold less than the video limit duration is determined as the target level in descending order. For the above-mentioned method 2, when the duration threshold corresponding to the current level is less than the video limit duration, the current level is determined as the target level, and when the current level is greater than the video limit duration, according to the number of action suggestion results with duration not greater than the video limit duration in the level and the number of action suggestion results with duration not greater than the video limit duration in the next level, it is determined whether to determine the current level as the target level or to enter the next level and perform the above-mentioned determination process again.

[0128] Optionally, for the solution in the second method, determining the target level or entering the next level according to the first number and the second number may include:

[0129] If the first number is not less than the second number, determining the current level as the target level;

[0130] If the first number is less than the second number, and the next level is the last level, determining the next level as the target level;

[0131] If the first number is smaller than the second number, and the next level is not the last level, the process proceeds to the next level.

[0132] Specifically, when the duration threshold corresponding to the current level is greater than the video limit duration, if, among all the action suggestion results belonging to the current level, the number of action suggestion results whose clip duration is less than the video limit duration is greater than the number of suggestion results whose clip duration is less than the video limit duration in the next level, then it means that even a part of all the video clips corresponding to the current level can guarantee to provide a sufficient number of action suggestion results that meet the duration requirement, that is, it can provide a sufficient number of video clips that meet the duration requirement. Therefore, the current level can be determined as the target level at this time.

[0133] In addition, as can be seen from the previous description, there may be a transition duration interval between adjacent levels, and an action suggestion result may also belong to two levels at the same time. In practical applications, in order to generate the target video later, there may be more options. When an action suggestion result belongs to two levels, if any of the two levels is determined as the target level, the action suggestion result can be used as an action suggestion result belonging to the target level. Of course, when determining the target level according to the duration threshold corresponding to each level, if the above-mentioned method 2 is adopted, the action suggestion results belonging to two levels at the same time can also be used as the action suggestion results in the two levels to which they belong. For example, if an action suggestion result belongs to both level 1 and level 2, regardless of whether level 1 or level 2 is determined as the target level, the video clip corresponding to the action suggestion result can be used as a candidate video clip, and the action suggestion result can be regarded as both an action suggestion result in level 1 and an action suggestion result in level 2.

[0134] In an optional embodiment of the present application, when screening the candidate video segments based on the intention feature to obtain the target video segments, the following may be specifically included:

[0135] Obtaining video segment features of each candidate video segment;

[0136] Determining the correlation between the intent feature and the video segment feature of each candidate video segment respectively;

[0137] Based on the correlation corresponding to each candidate video segment, each candidate video segment is screened to obtain each target video segment.

[0138] In an optional embodiment of the present application, screening each candidate video segment based on the intention feature to obtain each target video segment may specifically include:

[0139] Obtaining video segment features of each candidate video segment;

[0140] Determine the weight of each video segment to be processed based on the intention feature and the video segment feature of each video segment to be processed; wherein each video segment to be processed is each candidate video segment, or is each video segment after each candidate video segment is screened based on the correlation between the intention feature and the video segment feature of each candidate video segment;

[0141] Based on the video segment features and weights of the video segments to be processed, each target video segment is screened out.

[0142] In order to determine the video segments that are ultimately used to generate the target video, after obtaining the candidate video segments, the candidate video segments can be further screened based on the user's intention, and the target video segments that are more in line with the user's intention can be screened out, and the target video can be generated based on these target video segments. Among them, one optional method is to screen based on the correlation between the intention feature and the segment feature of each candidate video segment, and use the candidate video segment with greater correlation as the target video segment, such as using the candidate video segment with a correlation greater than a set threshold as the target video segment. Another optional method is to determine the weight of each candidate video segment based on the intention feature and the video segment feature of each candidate video segment, that is, to analyze the importance of each candidate video segment, and then screen out the target video segment based on the weight of each candidate video segment. Another optional method is to combine the above two methods, specifically, based on the compatibility of the segment feature and the intention feature of each candidate video segment, screen out the candidate video segment with greater correlation, and then further analyze the importance of each candidate video segment with greater correlation based on the intention feature, so as to screen out the target video segment from each video segment with greater correlation.

[0143] In an optional embodiment of the present application, based on the intention feature, determining the weight of each video segment to be processed, and based on the video segment features of each video segment to be processed and the weight of each video segment to be processed, screening out each target video segment, may specifically include:

[0144] Based on the intent features and the video segment features of each video segment to be processed, the following operations are performed in sequence to obtain the target video segment corresponding to each operation:

[0145] Determine the weight of each video segment to be processed in the current operation based on the intention feature, the video segment features of each video segment to be processed, and the weight of each video segment to be processed determined by at least one operation before the current operation;

[0146] Based on the video segment features of each to-be-processed video segment, the weights of each to-be-processed video segment of the current operation, and the target video segment determined by at least one operation before the current operation, the target video segment corresponding to the current operation is screened out.

[0147] As an optional solution, in order to generate a video sorted according to a certain rule for the user, the above operation can be performed multiple times, each operation filtering out a target video segment, and based on the multiple target video segments with sorting (the order in which the target video segments are filtered out) screened out by the multiple operations, a target video with more coherent video content is generated.

[0148] Among them, when determining the weight of each video segment to be processed in the current operation, the weight of each video segment to be processed determined by at least one operation before the current operation can be integrated, such as the weight of each video segment to be processed corresponding to the previous operation of the current operation can be integrated, so that when determining the weights corresponding to the current operation, the associated historical information is also taken into account, so that the weights determined by each operation can have a better internal correlation, so that when determining the target video segment corresponding to the current operation based on the determined weight, it is possible to obtain a target video segment with a better internal correlation with the previously screened target video segment, and a better potential temporal relationship between the segment contents of each screened target video segment. Similarly, when screening the target video segment based on the current weight, the target video segment determined by at least one operation before the current operation, that is, the screened target video segment, can be further considered, so as to further screen out the current target video segment that has a better temporal relationship with the determined video segments.

[0149] It can be understood that when the above operation is performed for the first time, since there is no operation before the current operation, the weight of each video segment to be processed of the current operation can be determined based on the intention feature and the video segment feature of each video segment to be processed. Similarly, when screening the current target video segment, the target video segment corresponding to the current operation can be screened out based on the video segment features of each video segment to be processed and the weight of each video segment to be processed of the current operation.

[0150] In actual applications, in order to avoid executing the above operation too many times or screening out too many target video clips, when screening the target video clips by continuously executing the above operation, the corresponding operation execution stop condition can be configured according to different application scenarios. For example, when the user requires the video length of the target video, it can be configured according to the video length of the target video required by the user. When the total length of the screened target video clips is not less than the video length of the target video, the above operation can be stopped. When the user does not require the video length of the target video, a default video length or the number of video clips contained in the target video can be configured as a condition for stopping the above operation. For another example, if the user does not require the video length of the target video, different processing methods can be used according to the type of video clip to be processed. For example, when the video clip to be processed is a candidate video clip, the above-mentioned operation stop conditions can be configured according to the requirements. When the video clip to be processed is a video clip after each candidate video clip is screened based on the intention feature and the correlation between the video clip features of each candidate video clip, since each video to be processed is a video clip that has been screened based on the user's intention, the operation stop conditions do not need to be configured at this time. In other words, the number of each target video clip finally determined can be the number of each video clip to be processed. Through the above operation, each video clip to be processed with a time sequence relationship is obtained. Of course, when each video to be processed is a video that is screened based on the user's intention, the operation stop conditions can also be configured. The above are just a few optional methods.

[0151] In addition, it should be noted that the temporal sequence between the above-mentioned clip contents is not a real time sequence. The temporal sequence here can be understood as a relative temporal sequence of the content of a video clip. For example, one video clip is a video corresponding to a summer scene, and another video clip is a video corresponding to an autumn scene. When the target video clip corresponding to each of the above operations is obtained, the first operation can filter out the video of the summer scene, and the second operation can filter out the video of the autumn scene. The temporal relationship between the different video contents in this scheme may be understood as a sequence relationship corresponding to a certain rule. In this example, the video clip of the summer scene is in front, and the video clip of the autumn scene is in the back. As an illustrative example, when a recurrent neural network is used to implement the screening of the above-mentioned target video clips, the operations of the above-mentioned different operations can specifically be different processing moments or time steps in the recurrent neural network.

[0152] In an optional embodiment of the present application, based on the intention feature and the video segment feature of each video segment to be processed, determining the weight of each video segment to be processed, and based on the video segment feature and weight of each video segment to be processed, screening out each target video segment, may specifically include:

[0153] For the first operation, based on the intention feature and the segment features of each video segment to be processed, the weight of each video segment to be processed at the initial moment is determined; based on the weight of each video segment to be processed of the first operation, the weighted video segment feature of the first operation is obtained; based on the weighted video segment feature of the first operation, the hidden state feature of the first operation is obtained; based on the hidden state feature of the first operation and the weighted video segment feature, the target video segment of the first operation is obtained;

[0154] For operations other than the first operation, the weights of each video segment to be processed of the current operation are determined based on the hidden state features, intention features, and video segment features of each video segment to be processed of the previous operation; the weighted video segment features of the current moment are obtained based on the weights of each video segment to be processed of the current operation; the hidden state features of the current operation are obtained based on the hidden state features of the previous moment, the weighted video segment features of the current operation, and the target video segment of the previous operation; the target video segment of the current operation is obtained based on the hidden state features of the current operation and the weighted video segment features of the current operation.

[0155] The optional scheme of the present application provides a method for determining the target video clip based on the attention mechanism and the time recurrent neural network. In most existing video generation methods based on sorting, the semantic information of the video and the theme of the video content are generally not considered, and the sorting is performed only according to simple rules, which will result in poor connectivity between the generated videos and does not meet user needs; at the same time, when faced with complex scenes, it is difficult to extract and summarize the video generation rules from the complicated and cumbersome data. In order to solve this problem, the present application proposes a video generation method based on the attention mechanism, which can automatically edit the video clips based on the video content and the user's intention to generate the video the user wants. In the scheme of the present application, the user's intention, that is, the intention feature reflecting the user's intention, is added to the calculation of the attention weight, so that when determining the weight of each video clip, the user's intention is integrated. In addition, the time recurrent neural network based on the attention mechanism is used to obtain the target video clip at each operation. Since the user's intention and video features are considered at the same time, and the internal relationship between each video clip to be processed (such as each candidate video clip) can be extracted through the neural network, therefore, based on this scheme, a better video generation effect can be obtained than the rule-based method.

[0156] Among them, when obtaining the hidden state feature of the current operation based on the hidden state feature of the previous operation, the weighted video segment feature of the current operation, and the target video segment of the previous operation, the hidden state feature of the current operation can be obtained based on the hidden state feature of the previous operation, the weighted video segment feature of the current operation, and the index of the target video segment of the previous operation. For a certain operation, since the hidden state feature of the previous operation can reflect the relevant information of the video segment recorded by the network from the initial operation, that is, the first operation to the last operation, or at least can reflect the state of the last operation, that is, the target video segment selected by the last operation, therefore, when determining the hidden state feature of the current operation, if the current operation is not the initial operation, the hidden state feature of the last operation can be considered at the same time, so as to better obtain the hidden state feature that integrates the relevant information of the current operation and the operations before the current operation, so that the video segment of the current operation that has a better internal connection with the target video segment of the last operation can be determined based on the hidden state feature of the current operation and the weighted video segment feature.

[0157] In an optional embodiment of the present application, if the video generation request includes the video duration of the target video, after filtering out the target video segment at the current moment, the method further includes:

[0158] Determine the total duration of each selected target video segment;

[0159] If the total duration is less than the video duration, the target video segment screening operation is performed for the next operation;

[0160] If the total duration is not less than the video duration, the screening operation of the target video segment is terminated.

[0161] In order to generate a video whose duration meets the time length desired by the user, in an embodiment of the present application, after each target video segment of an operation is determined, it is possible to determine whether the total duration of the currently determined video segments meets the requirement; if so, the target video can be generated based on the determined video segments; if the total duration of the determined video segments does not yet meet the required video duration, the selection of target candidate segments can continue.

[0162] In an optional embodiment of the present application, if each target video segment is a target video segment screened out by each operation, generating a target video based on each target video segment includes:

[0163] Based on the order in which the target video clips are screened, the target video clips are merged to obtain the target video.

[0164] After obtaining the target video clips at each moment, the video clips can be merged based on the chronological order in which the target video clips are screened out to obtain a target video whose contents have a good chronological relationship, thereby better conforming to the actual situation and meeting the needs of users.

[0165] In an optional embodiment of the present application, generating a target video based on each target video segment may specifically include:

[0166] Screening each target video segment based on the correlation between the video segments in each target video segment;

[0167] A target video is generated based on the filtered target video segments.

[0168] In practical applications, after each target video segment is obtained by screening the candidate video segments, the target video can be directly generated by using the target video segments, or the target video segments can be screened again to better meet the needs of users.

[0169] Among them, when screening target video segments based on the correlation between video segments, different screening methods can be used for different application requirements. For example, if the correlation between the video segments contained in the target video to be generated is as high as possible, some video segments with higher correlation can be screened out based on the correlation between the video segments in each target video segment. If the video content in the target video to be generated is diverse and as rich as possible, some video segments with lower correlation can be screened out based on the correlation between the video segments in each target video segment.

[0170] It should be noted that, when screening each target video segment based on the video segment features and weights of each to-be-processed video segment described in the foregoing text, if each to-be-processed video segment is selected based on the correlation between the intention feature and each subsequent video segment, the above-mentioned scheme can also be applied to each to-be-processed video segment, that is, the to-be-processed video segment can be screened again based on the correlation between each to-be-processed video segment, and the target video segment can be screened based on each video segment screened again. That is to say, in practical applications, the various optional schemes provided in the embodiments of the present application can be combined with each other.

[0171] In an optional embodiment of the present application, each target video segment is screened based on the correlation between video segments in each target video segment, including:

[0172] Determining a reference video segment in each target video segment;

[0173] The reference video segment is used as the initial filtered target video segment, and the following operations are repeated for each to-be-filtered video segment except the filtered target video segment in each target video segment until all filtered target video segments are determined:

[0174] The correlations between the screened target video segments and the video segments to be screened are determined respectively, and the video segment to be screened corresponding to the smallest correlation smaller than a set value among the correlations is determined as a new screened video segment.

[0175] That is to say, when screening video clips, one or more (including two) reference video clips can be selected first. For example, based on the correlation between the video clip features and the intention features of each target video clip, the target video clip with the highest correlation can be used as the reference video clip, and the selected reference video clip can be used as the screened clip for generating the target video. Thereafter, the process of using the target video clip corresponding to the calculated correlation degree that is less than a set value and the smallest correlation degree as the next screened video clip can be repeated based on the correlation between the screened clip and other target video clips, until there are no more clips that meet the conditions (i.e., the above-mentioned correlation degree is less than the set value and the lowest correlation degree) in the target video clips other than the screened clips.

[0176] Based on the scheme, some video clips with low correlation can be screened out from each target video clip, so that a target video with rich and diverse content can be generated based on these screened videos. Of course, as described above, according to different application scenarios, some video clips with high correlation can also be screened out, so that the contents between the video clips included in the target video are more similar, and the coherence of the video content is likely to be relatively higher. Of course, the above two target videos can also be provided to the user at the same time, and the user can choose one or both of them according to actual needs.

[0177] It should be noted that in this scheme, if there are multiple target video clips that have been screened, for a video clip to be screened, when determining the correlation between the screened target video clip and the video clip to be screened, different determination methods can be configured. For example, the correlation between the video clip to be screened and each of the screened target video clips can be calculated separately, and the maximum correlation, the minimum correlation, or the average of the correlations can be used as the correlation corresponding to the video clip to be screened. It is also possible to select one from each of the screened target video clips (such as the latest screened clip or a benchmark video clip, etc.), and use the correlation between the selected clip and the video clip to be screened as the correlation corresponding to the video clip to be screened.

[0178] In an optional embodiment of the present application, generating a target video based on each of the target video segments may specifically include:

[0179] Determine the action type of the action behavior contained in each target video clip;

[0180] Based on each target video segment and the action type corresponding to each target video segment, a target video is generated to display the action type corresponding to each target video segment to the user.

[0181] That is to say, when generating the target video, the action type corresponding to each video clip contained in the video can also be provided to the user, so that the user can know which action video clips are specifically included in the target video generated in the end. Among them, the method of displaying the action type to the user is not limited in the embodiment of the present application. As an optional scheme, for example, for each video clip contained in the target video, the identification of the action type of each video clip can be carried on the corresponding video frames, or carried on the first or first few video frames of each clip, or carried on the last frame of the previous clip, so that when the user watches the target video and plays each video clip, he can know the action corresponding to the video to be played from the video frame. For another example, the action type can also be not carried on the video frame of the generated target video, but the action type corresponding to the target video and each clip contained in it can be displayed to the user separately, such as the action type corresponding to each video clip contained in the target video, according to the playback order of each video clip in the target video, and displayed to the user, such as the description information of the target video can be generated, and the description information can include each action type corresponding to the target video.

[0182] In order to better illustrate the video generation solution provided in the embodiments of the present application, some solutions involved in the optional embodiments of the present application are further described in detail below with reference to some specific examples. In the examples below, the objects in the frame images of the video are described using people as an example.

[0183] The solution provided in the embodiment of the present application may include the following two stages:

[0184] Stage 1: Aggregation of video clips: Multiple videos (corresponding to the candidate videos in the previous text) are segmented according to different content semantics (characters and behavioral actions), and the semantic information of character actions is extracted from the segmented clips (corresponding to the candidate video clips in the previous text). Clips that are irrelevant to user intentions are filtered out, that is, candidate video clips are filtered based on intention features to obtain target video clips.

[0185] Stage 2: Generation of target video: The segmented segments obtained in the previous stage, namely the candidate video segments, are combined with user intentions to generate a wonderful video of a given length.

[0186] The implementation methods of each stage will be described in detail below with reference to specific examples.

[0187] Figure 2 A schematic diagram of a video generation method provided in an example of the present application is shown in FIG. Figure 2 As shown in , the implementation of this method can mainly include the following aspects:

[0188] ●Input: multiple videos of the user and the user's video generation request; Output: the final generated video, i.e. the target video;

[0189] Among them, the video generation request can specifically include the duration of the video to be generated (i.e., the video duration in the previous text, the input video duration shown in the figure, such as 15 seconds) and the user intention (such as "I want to play basketball" as shown in the figure).

[0190] In actual application, a variety of different ways in which users can initiate video generation requests can be configured, for example, users can initiate the request through voice commands, or through text input, and more detailed functions can be configured for users. For example, after a user initiates a video generation request, a video personalized information configuration interface can be displayed to the user, and the user can enter the relevant information of the video he wants to generate through the interface, such as one or more of the above-mentioned video duration, the video about what character, and the video about what scene, etc. The user can make relevant settings or not set them as needed through the interface (i.e., default settings can be made). Specifically, for example, if a user wants to generate a video about a certain person, the person's gender, age or other person attribute information can be configured through the interface. Of course, the user can also directly provide at least one image of the person. When generating the target video, the image provided by the user can be subjected to face recognition, and the video containing only the person is used as a candidate video. When determining the first candidate video segment containing the object, only the video segments containing the person in the candidate video can be used as the first candidate video segment.

[0191] ● Preprocessing: Extract the video features of each candidate video and the intent features of the video generation request, i.e., the user intent;

[0192] In this example, the video features include visual and optical flow features. Figure 2As shown in , 3D-CNN can be used to extract visual features (i.e., feature maps). The output tensor of 3D-CNN is L*H*W*C, where L represents the number of frames of the input video, H and W represent the height and width of the output feature map (which can be called a visual feature map), and C represents the number of output channels, that is, the number of feature maps. Optical flow features can be extracted using Flownet, and the output tensor of Flownet is L*H*W*2. Similarly, L, H, and W represent the number of frames of the input video, the height and width of the output feature map (which can be called an optical flow feature map), and 2 represents the number of output channels. Since the optical flow feature is used to reflect the position change of pixels in two adjacent frames, the number of output feature maps of the optical flow feature is 2, and the value of the same point in the two output feature maps reflects the pixel displacement of the point.

[0193] Among them, the image sizes of the optical flow feature map and the visual feature map can be the same or different. If they are different, in order to be able to fuse the two types of visual feature maps (specifically, it can be a concatenation operation as shown in the figure), and use the fused features (which can be called dual-stream features) as video features in subsequent processing, at least one of the optical flow feature map and the visual feature map can be processed (such as upsampling and / or downsampling processing, etc.) to obtain two feature maps of the same size.

[0194] In practical applications, as an optional implementation, the height and width of the above-mentioned visual feature map and optical flow feature map can be specifically the height and width of the frame image of the input video, respectively, and the value of the same point in the two optical flow feature maps reflects the pixel displacement of the pixel point in the frame image of the video.

[0195] For the intent feature, optionally, as shown in the figure, it can be extracted through RNN (Recurrent Neural Network). Specifically, the video generation request can be input into the RNN, and the corresponding intent feature can be obtained based on the output of the RNN. The intent feature can specifically be a feature vector of a set dimension (which can be configured according to application requirements), such as a 256-dimensional feature vector.

[0196] ●Video clip aggregation and video generation

[0197] In the example of the present application, the module for implementing the video segment aggregation function may be referred to as a video segment aggregation module, and the module for generating the final target video may be referred to as a video generation module. Figure 2As shown in , the video clip aggregation module is specifically used to generate each candidate video clip (corresponding to the first candidate video clip and / or the second candidate video clip in the previous text), and the video generation module generates a target video based on each candidate video clip. Of course, when generating a target video based on each target video clip, video background music can also be added. The music can be selected by the user, pre-configured, or screened from each candidate background music based on user intention or other relevant information. For example, matching background music can be selected based on the content of each target video clip used to generate the target video.

[0198] The video segment aggregation part and the video generation part are described in detail below.

[0199] 1. Video segment aggregation based on video understanding

[0200] In practical applications, users generally shoot videos around people's activities. It can be said that people and their activities are the core semantic information in the video. In the prior art, it is usually just a simple segmentation of a video to extract the video clips in which the characters face the camera, and it is impossible to analyze multiple videos, which is not a strict extraction of character semantic information. In this application, the semantic information of the characters and action behaviors of many videos is fully considered and analyzed, and a multi-level action recognition scheme (to be described in detail later) and character understanding processing are adopted. The detailed semantic information of the characters and actions in the video clips can be obtained, such as "someone does something", and then analyzed in combination with the user's intention, so that the video clips that the user wants can be obtained.

[0201] In order to solve the problem that the existing video generation schemes do not consider user intent and do not apply video semantic information, resulting in the generated videos not being able to meet user needs well, this application proposes a video clip aggregation scheme based on video understanding.

[0202] like Figure 2 As shown in , the module used to implement the video segment aggregation function can be called a video segment aggregation module. The flow of the solution implemented by the module is as follows: Figure 3 As shown in , the input of this module may include the dual-stream features, intent features and video length, i.e., video duration, obtained in the previous text. Of course, the video duration may be optional. If the video duration is not obtained, the input may not include the video duration. Of course, if the video duration input by the user is not obtained, the pre-configured duration may be used, or the duration limit may be ignored and the target video may be generated based on the target video segment finally determined.

[0203] like Figure 3As shown in , the scheme implemented by the video segment aggregation module can mainly include three parts. One part is used for character recognition to obtain a first candidate video segment containing a character, and the other part is to perform action behavior analysis (multi-level action recognition shown in the figure), and obtain a second candidate video segment based on the analysis result (i.e., the time period information in the previous text, i.e., the action suggestion result). If the candidate video segments obtained based on these two branches include both the first candidate video segment corresponding to the character and the second candidate video segment corresponding to the action analysis result, it can also include a part of fusing the first candidate video segment and the second candidate video segment (segment fusion shown in the figure), and determine the target video segment (the best video segment shown in the figure) based on each candidate video segment after the fusion processing. Specifically, the fusion processing step can be after the target video segment is determined based on each first candidate video segment and each second candidate video segment, if the determined target video segment contains the first candidate video segment and the second candidate video segment belonging to the same candidate video, it can also be performed at this time. The first candidate video segment and the second candidate video segment belonging to the same candidate video in each target video segment are fused, and the target video is generated based on each video segment after the fusion processing.

[0204] The following will Figure 3 It should be noted that the serial numbers in the following description are not used to limit the order of implementation of each part, but are only an identifier added to facilitate the description of each part. In actual applications, the order of implementation of each part can be configured according to actual needs, or it can be executed simultaneously.

[0205] 1.1. About Person Recognition

[0206] This part can be implemented by the person recognition method as an optional solution. Figure 4 FIG. 4 shows a flow chart of obtaining a video segment containing a person (i.e., a first candidate video segment) based on person recognition, as shown in FIG. Figure 4 As shown in the figure, the optional solution mainly includes the following three parts, such as steps ①, ②, and ③ shown in the figure. The specific description of this part is as follows:

[0207] ■ Pedestrian detection and tracking: This can be achieved using pedestrian detection and tracking methods, with the input being the dual-stream features of the video and the output being the pedestrian trajectory (such as the location information of the person in the image, etc.);

[0208] ■ Face recognition: For each pedestrian trajectory, the face recognition algorithm can be used to extract facial features and confirm identity;

[0209] ■ Face clustering: The face clustering algorithm can be used to cluster each pedestrian trajectory according to the face recognition results and give all the characters a unique identity number. After this processing, the video slices of all the characters in the video can be obtained. Figure 4 The character video slice information shown in .

[0210] Figure 4 In the example shown in , for a video (video 001 shown in the figure, 001 is the identifier of the video), it is identified that the video contains three characters, namely character A, character B and character C, and three character video clips are obtained, namely, in video 001, the video clip containing character A is from 0.5 to 5 seconds, the video clip containing character B is from 2 to 6 seconds, and the video clip containing character C is from 10 to 20 seconds.

[0211] 1.2. Multi-level behavior recognition

[0212] The embodiment of the present application provides a method for adaptively segmenting an input video into action segments and providing different levels of action category recognition. When the duration of the required video input by the user, i.e., the above-mentioned video duration, is known, the execution of this step can also incorporate the user's required information of the video duration of the target video.

[0213] Figure 5 The flowchart of the multi-level behavior recognition scheme is shown. As shown in the figure, the input of this part can mainly include dual-stream features and input video length (i.e., the video length of the target video, optional content), and the input is a video clip, i.e., the second candidate video clip. The scheme can mainly include three steps, as shown in steps ①, ②, and ③ in the figure. The specific description of this part is as follows:

[0214] Step ① is step S1 shown in the figure: suggestion hypothesis generation, that is, action suggestion result generation, that is, the time period information corresponding to each video clip that may contain actions in the candidate video.

[0215] The purpose of this step is to generate a large number of action suggestion hypotheses, i.e., time period information (also referred to as suggestion hypotheses, action suggestions, or action suggestion results) based on dual-stream features. Each action suggestion hypothesis may specifically include the start time and end time of the action (the action that may exist in the video clip). For example, if P1 (1 to 14 seconds) is suggested, the start time of the action suggestion hypothesis is the 1st second of the video, and the end time is the 14th second of the video. The action suggestion result indicates that there is a high probability of an action in the video clip from the 1st to the 14th second of the video, and the clip duration is 14 seconds. Figure 5In the example shown in , multiple action suggestion hypotheses are shown (the action suggestions shown in the figure). In this example, each action suggestion hypothesis is directly represented by its starting time and ending time. As shown in the figure, an action suggestion hypothesis is represented as (T1, T14), where T can be understood as time, and the subscript values ​​are the starting time and the ending time, that is, the starting time of the action suggestion hypothesis (T1, T14) is the 1st second of the video, and the ending time is the 14th second of the video.

[0216] Among them, the determination of the action hypothesis result can be specifically realized by a neural network, and the neural network is trained by using a large number of video samples, so that the neural network can realize the action suggestion hypothesis corresponding to the video clip in the video based on the characteristics of the video (such as dual-stream features). Specifically, the dual-stream features of the video obtained in the previous stage can be further extracted by the feature extraction network for action suggestion features (i.e., features used to generate action suggestion hypotheses), and then a large number of action suggestion hypotheses can be generated based on the extracted action suggestion features. As an example, the dual-stream features of the video can be input into a 3D convolutional network containing 2 layers of convolution kernels of 3*3*3, and deeper action suggestion features can be further extracted through the network. Then, a large number of action suggestion hypotheses can be generated according to the existing action suggestion generation method, and then these action suggestions can be classified into different levels according to the time length according to the level determination strategy. Generally, for suggestions with longer duration, the level is higher, such as level 1.

[0217] For the level determination of the action suggestion hypothesis, the embodiment of the present application provides two optional level determination strategies, one with higher accuracy and better performance, hereinafter referred to as strategy J1, and the other with faster computing speed and less resource consumption, hereinafter referred to as strategy J2. Figure 5 The level determination schemes based on these two strategies are explained respectively.

[0218] a. Strategy J1

[0219] In this example, for a video, it is assumed that 5 action suggestion hypotheses are obtained based on its dual-stream features, which are recorded as P1 (1~14s), P2 (2~8s), P3 (3~8s), P4 (11~20s), and P5 (21~25s), respectively. s is the time unit in seconds, and the two times in brackets are the start and end times of the video clips corresponding to each action suggestion hypothesis in the video. Then, the clip lengths of these 5 action suggestion hypotheses are 14s, 6s, 5s, 9s and 4s respectively. The following will take these 5 action suggestion hypotheses as examples for relevant explanations.

[0220] For each level of action recommendation hypothesis, the duration threshold and duration interval corresponding to that level can be obtained based on a large amount of training data (i.e., training samples, specifically sample videos) through experience and statistical analysis. Specifically, based on experience and statistics, within a certain error range, the action segments of different levels in the training data (the segments with actions in the video) can be considered to follow a Gaussian distribution of duration, and different levels of duration intervals [mean - N * deviation, mean + N * deviation] can be used to determine the level to which each action recommendation hypothesis belongs. Here, mean is the mean of the Gaussian distribution, deviation is the standard deviation. For example, for level 1, its corresponding duration interval is determined based on the mean and standard deviation of the Gaussian distribution corresponding to the action segments of this level. Among them, N is a value preset according to needs, N is a positive number, and the specific value of N can be configured according to actual requirements. One optional value of N can be 3. When this value is taken, the duration intervals of each level can cover 99.7% of the training samples. That is to say, the duration of the action recommendation results of each level in 99.7% of the training samples can fall within the corresponding level's duration interval determined based on this value.

[0221] The following takes the training data with only two levels as an example for illustration. Figure 6 shows a schematic diagram of the Gaussian distribution of duration corresponding to two levels, namely level 1 and level 2 (level 1 is higher than level 2). In this schematic diagram, the time period interval [t1, t2] is the transition duration interval between level 1 and level 2. For each action recommendation hypothesis, its level can be determined based on the duration corresponding to this action recommendation hypothesis and the duration intervals corresponding to each level.

[0222] Specifically, assume that the duration of an action recommendation hypothesis (i.e., the duration of the video segment corresponding to the action recommendation hypothesis) is t. Then, by comparing the duration intervals [mean - N * deviation, mean + N * deviation] of the two levels with the duration t of this action recommendation hypothesis, the level of this action recommendation hypothesis can be determined. As Figure 6 shown, t1 is the left interval boundary of level 1, and t2 is the right interval boundary of level 2. When t < t1, this recommendation hypothesis is level 2; when t > t2, this recommendation is level 1; when t falls within the interval [t1, t2], this recommendation belongs to both level 1 and level 2.

[0223] For the five action suggestions described above, namely action suggestions P1 (1-14s), P2 (2-8s), P3 (3-8s), P4 (11-20s), and P5 (21-25s), the corresponding segment lengths are 14 seconds, 6 seconds, 5 seconds, 9 seconds, and 4 seconds, respectively. Applying the above strategy J1, action suggestions P1 and P4 can be marked as level 1, P5 as level 2, and P2 and P3 belong to both level 1 and level 2. For example Figure 5 The strategy J1 can also be used to determine the level of each action suggestion hypothesis shown in the figure. For example, the duration corresponding to the action suggestion (T1, T14) is 14 seconds and the level is 1; the duration corresponding to the action suggestion (T55, T60) is 5 seconds and the level is 2.

[0224] b. Strategy J2

[0225] Compared with strategy J1, this strategy is simple to calculate, consumes less device resources during calculation, and is suitable for scenarios that are sensitive to computing time. For strategy J2, the average duration of segments of different levels in the training data can be first calculated (as the duration threshold corresponding to each level). When determining the level of each action suggestion hypothesis, the duration of the action suggestion hypothesis can be compared with the average duration of each level, and the level with the average duration closest to the duration of the action suggestion hypothesis can be selected as the level of the action suggestion.

[0226] Still Figure 6 Taking the two levels shown in as an example, t1 and t2 are two different durations of action suggestions. Since t1 is closest to the average duration (mean) of level 2, the level of action suggestion corresponding to t1 is level 2. Similarly, t2 is closest to the average duration of level 1, and the level of action suggestion corresponding to t2 is level 1.

[0227] Applying strategy J2, if the average duration of level 1 is 10 seconds and the average duration of level 2 is 5 seconds, for the action suggestions with durations of 14 seconds, 6 seconds, 5 seconds, 9 seconds and 4 seconds respectively, the durations of action suggestions P1 and P4 are closest to 10 seconds between 10 seconds and 5 seconds, and can be marked as level 1. The durations of action suggestions P2, P3 and P5 are closest to 5 seconds between 10 seconds and 5 seconds, and can be marked as level 2.

[0228] After determining the level of each action suggestion hypothesis, you can proceed to the following step ②.

[0229] Step ② corresponds to step S2 in the figure: recommending selection, i.e. determining the second candidate video segment.

[0230] In the previous step, many suggestion hypotheses may be generated. In order to reduce the amount of calculation and improve accuracy, only a part of the suggestions can be selected for subsequent processing. Figure 7As shown in , this step is used to select the suggestions that meet the conditions, i.e., the selected suggestions that meet the conditions as shown in the figure, that is, to decide which level of suggestion hypothesis is selected to be sent to the next step for further processing, that is, to determine the target level, and determine the video clips corresponding to each action suggestion hypothesis belonging to the target level as the second candidate video clips.

[0231] Specifically, the target level can be based on the duration of the video that the user wants to generate (i.e. Figure 5 The input video length shown in , Figure 7 If the user does not specify the input video duration, in actual processing, the duration can be considered to be infinite and this step can be ignored. Of course, the preconfigured duration can be used to replace the input video duration for processing this step. In actual applications, if a preconfigured duration is set, different optional durations can be configured for different application scenarios, such as selecting a corresponding preconfigured duration according to the scene of the video that the user wants to generate.

[0232] Corresponding to the previous step, the embodiment of the present application also proposes two recommended selection strategies, which can be respectively referred to as strategies Z1 and Z2. These two strategies will be introduced below.

[0233] a. Strategy Z1

[0234] This strategy Z1 is the corresponding selection strategy of strategy J1. The five action suggestions P1 (1-14s), P2 (2-8s), P3 (3-8s), P4 (11-20s), and P5 (21-25s) described in the previous article are still used as examples for explanation. Based on the above strategy J1, the following recommendation levels have been obtained:

[0235] P1 (1-14s) is level 1, P2 (2-8s) is level 1 and level 2, P3 (3-8s) is level 1 and level 2, P4 (11-20s) is level 1, and P5 (21-25s) is level 2.

[0236] Assuming that the input video duration (the length of the video that the user wants to generate in the end) is T', by adding an adjustment factor n, the length limit of each video segment can be obtained, that is, the video limit duration T = T' / n. n is an integer not less than 1. In practical applications, empirical values ​​2 to 5 can be used according to the input video length. For convenience of description, n = 2 is used as an example. In this example, it is assumed that the average duration of level 1, that is, the duration threshold, is 10 seconds, and the average duration of level 2 is 5 seconds.

[0237] When determining the target level, start from level 1 and compare T with the average duration of level 1. Assuming that the video duration input by the user is 30 seconds, the video length limit (i.e., video limit duration) T is 15 seconds. If it is greater than 10 seconds, level 1 is selected (i.e., level 1 is the target level), and the corresponding suggestion assumption of level 1 is selected and sent to the next step, and the processing of this step is exited. If the video duration input by the user is 18 seconds, the video length limit T is 9 seconds, which is less than 10 seconds, but not less than the average duration of level 2, i.e., 5 seconds. Figure 8 As shown, N1 and N2 can be compared, where N1 represents the number of suggestions belonging to level 1 and having a duration less than T, such as Figure 8 As shown in the shaded part, N2 represents the number of suggestions belonging to level 2 and having a duration less than T. If N1>N2, level 1 is selected. At this time, it means that even a part of level 1 can guarantee to provide a sufficient number of suggestions that meet the duration requirement. Otherwise, level 2 is selected, that is, the suggestions in level 2 that are less than T are selected. If there are more than two levels, the same method as above can be used for expansion. For example, including 3 levels, if the average duration of level 1 is greater than T, and the number of suggestions in level 1 with a duration less than T is less than the number of suggestions in level 2 with a duration less than T, then the processing of levels 2 and 3 can be entered. Based on the number of suggestions in level 2 with a duration less than T and the number of suggestions in level 3 with a duration less than T, it is determined whether to determine level 2 as the target level or level 3 as the target level.

[0238] Once a certain level is selected, the suggestions for the transition duration area corresponding to this level that meet the conditions (when the duration is less than the video duration limit) will use this level as the level for subsequent processing. That is to say, if the duration of an action suggestion falls within a certain transition duration interval, and one of the two levels corresponding to the transition duration interval is determined as the target level, if the duration of the action suggestion is less than the video duration limit, then the action suggestion result is also used as the action suggestion result corresponding to the target level, and the video clip corresponding to the action suggestion result is also used as a candidate video clip for subsequent processing. For example, when the above level 1 is selected as the target level, Figure 8 Although the action suggestions with medium duration in the transition duration region [t1, t2] belong to both level 1 and level 2, they are ultimately processed as level 1 suggestions.

[0239] Regarding the above-mentioned corresponding strategies J1 and Z1, the embodiment of the present application uses Gaussian distribution to fit training data of different levels, in which the judgment interval of the level, that is, the time interval [mean-N*deviation, mean+N*deviation], plays a key role. In practical applications, when a smaller N (such as 0.5) is selected, the suggestions of each level will tend to be concentrated, that is, the interval range of the time interval is smaller. Therefore, only the suggestions that are very close to the average duration of a level will be classified as this level. This kind of processing will make the level division more strict, the suggestions of each level will become less, and the amount of data to be processed later will be reduced, which is convenient for subsequent rapid processing, and will also improve the classification accuracy. On the other hand, if the diversity of the fragments needs to be considered, a larger N (such as 5) can be used. At this time, more suggestions are assumed to be in the transition duration interval and can belong to multiple levels. At the same time, the suggestions selected to enter the next step of classification processing will also increase, and the content of the obtained video fragments will be richer. In practical applications, the value of N can be determined according to different application requirements.

[0240] b. Strategy Z2

[0241] This strategy is the corresponding selection strategy of strategy J2. For the above suggestions P1 to P5, based on strategy J2, suggestions P1 and P4 are level 1, and P2, P3 and P5 are level 2. Fig. 9 The flowchart of target level selection based on the strategy Z2 is shown in FIG. 1 , which is still described by taking the above-mentioned level 1 and level 2 as examples. Fig. 9 As shown in the figure, the average duration of each level is compared with the size of the video length limit starting from level 1. The details are as follows:

[0242] If the average duration of the current level is not greater than the video length limit, the suggestion of this level is selected. For example, if the average duration of level 1 is 10 seconds and the video length limit is 15 seconds, level 1 meets the conditions and is selected as the target level. The action suggestions P1 and P4 belonging to this level are selected and the step is exited.

[0243] If the average duration of the current level is greater than the video length limit, you need to compare the average duration of the next level until the average duration of a certain level is less than the video length limit. For example, when the video length limit is 7 seconds, the average duration of level 1 does not meet the condition, then compare the video length limit with the average duration of level 2, which is 5 seconds. Level 2 meets the condition, that is, the average duration of level 2 is less than the video length limit, select the action suggestions P2, P3, P5 of level 2 and exit this step.

[0244] Step ③ corresponds to Figure 5 Step S3 shown in : action type classification.

[0245] The purpose of this step is to determine the action type of each action suggestion hypothesis screened out by step S2. Specifically, for a certain action suggestion, the suggestion feature of the action suggestion (i.e., the feature of the video clip corresponding to the action suggestion) is passed to the FC layer (full connection Layer, FC Layer, fully connected layer), and the output feature vector is obtained based on the network parameters (weights and biases) of the FC layer. Specifically, the FC layer calculates the value of weight * suggestion feature + bias, and the feature vector output by the FC layer is then classified by the Softmax layer to obtain the action classification result corresponding to the action suggestion result. Specifically, the specific output of the Softmax layer can be a label of a specific action classification result, that is, a label of a specific action type, or a classification result vector. The vector is specifically a one-dimensional column vector, and the number of elements in the vector is equal to the number of categories of all action types. The value of each element in the vector can be the probability that the action type corresponding to the action suggestion is of each type. Among them, for an action suggestion, the segment feature of the video clip corresponding to the action suggestion can be obtained according to the start time and end time of the action suggestion by intercepting the features of the corresponding time period in the dual-stream features ( Figure 5 The feature tensor of the segment feature can be expressed as P*H*W*C, where P, H, W, and C are the number of frames contained in the video segment corresponding to the action suggestion, the height of the feature map, the width of the feature map, and the number of feature maps. Of course, you can also intercept the corresponding video segment in the video according to the start and end time of the action, and then extract the features of the video segment to obtain the segment features of the video segment.

[0246] For the levels 1 and 2 described above, assuming that the action suggestions of level 1 are selected, this step uses the segment features of each video segment corresponding to each action suggestion hypothesis of level 1 to classify the action type of each action suggestion of this level. For example, P1 is classified as "playing basketball" and P4 is classified as "swimming". Similarly, if the action suggestions of level 2 are selected, the segment features corresponding to each action suggestion hypothesis of level 2 are used to classify the action type of the action suggestions, such as P2 is classified as "floating", P3 is classified as "dribbling", and P5 is classified as "shooting". It can be understood that only the selected suggestions will be classified in this step. If level 1 is selected in S2, the suggestions P1 and P4 of level 1 can be classified, and P2, P3, and P5 are ignored.

[0247] Based on the above multi-level action recognition solution provided by the embodiment of the present application, action clips of different levels and categories can be obtained according to the input video duration, and the video clips entering the subsequent processing steps can be determined based on the corresponding processing strategy, and the action type corresponding to each video clip can also be obtained. As an example, for a video 001, the relevant action clip information of each screened video clip can include the following: Fig.10 The information shown may include but is not limited to the time information of the clip. For example, the time information of the first video clip shown in the figure includes the starting time (1.5 seconds) and the ending time (5 seconds), and may also include the action type in the video clip, namely "laughing".

[0248] 1.3. Fragment selection

[0249] The purpose of this section is to filter out the clips related to the user's intention, that is, based on the intention features, filter the candidate video clips obtained in Sections 1.1 and 1.2 above to select the target video clip. Figure 3 In the flowchart shown in , the segment selection is used to screen the candidate video segments of each action. It should be noted that in actual applications, the segment selection can be to screen the candidate video segments of the characters and / or the candidate video segments of the actions mentioned above. The following description will be made by taking the candidate video segments of the actions as an example.

[0250] Since the correlation between two vectors (also called relevance) can measure the similarity between the vectors, and the greater the correlation, the more similar the two vectors are, therefore, when selecting segments based on intent features, as an optional method, segment screening can be performed by calculating the correlation between the user intent features and the segment features of each candidate video segment.

[0251] Fig.11 A schematic diagram of the principle of segment selection is shown in the figure. As shown in the figure, based on the segment features (segment feature vectors shown in the figure) and intention features of the action candidate video segments corresponding to each action suggestion hypothesis belonging to the target level obtained by the previous action recognition, the correlation between the segment features and the intention features of each action candidate video segment can be calculated respectively, and the action candidate video segment corresponding to the higher correlation can be used as the screened video segment, i.e., the target video segment.

[0252] It should be noted that, in practical applications, when calculating the correlation between the segment features and the intent features of a candidate video segment, the segment features of the candidate video segment can use the features of the corresponding time period extracted from the dual-stream features of the candidate video based on the start and end times corresponding to the action suggestion hypothesis (referred to as the first feature for short), or the segment features obtained by re-extracting the features of the candidate video segment (referred to as the second feature for short), or the features after feature conversion again using the first feature and / or the second feature, such as the feature vector output by the FC layer during the above-mentioned action type classification, or the classification result vector output by the Softmax layer. When calculating the correlation between the segment features and the intent features, if the segment features and / or the intent features are multi-dimensional feature vectors, it is necessary to convert the multi-dimensional feature vectors into one-dimensional feature vectors before calculating the correlation. The following is a detailed description of the screening scheme for target video segments.

[0253] a. Correlation calculation

[0254] Generally, whether a segment is related to the user's intention can be determined by calculating the similarity between the segment feature vector (i.e., the form of the segment feature) and the intent feature vector (i.e., the form of the intent feature). It should be noted that in the following description, the segment feature vector and the intent feature vector are both one-dimensional feature vectors.

[0255] As an optional method, the correlation between the intent feature and the segment feature can be realized based on the correlation calculation model of the attention mechanism, which is specifically calculated by the following expression:

[0256] c(f v , f intention )=v T tanh(Wf v +Vf intention +b)

[0257] Among them, f v represents the segment features of the candidate video segment, f intention is the intention feature, c(f v , f intention ) indicates f v and f intention The correlation of W is f v The feature space transformation parameter matrix, W is f intention The feature space transformation parameter matrix, b is the bias vector, and v T is the weight matrix of the feature. Tanh is the activation function, which is used here to normalize the feature vector to between (-1,1). Specifically, W, V, b, and v TBoth are network parameters of the correlation calculation model based on the attention mechanism, which can be learned during model training. W and V are used to convert the fragment features and intent features to the same feature space, respectively. T It is used to convert the dimension of the normalized feature vector to the specified dimension. The following is a detailed explanation of the calculation of the correlation based on this expression:

[0258] As an example, Fig.12a A schematic diagram of a process for determining video clip features and intent features provided by an embodiment of the present application is shown in FIG. Fig.12a As shown in , the process is mainly as follows:

[0259] 1. Convert the feature vector of the video clip feature and the feature vector of the intent feature to the same feature space.

[0260] Since the intent feature is located in the intent feature space and the video clip feature is located in the visual feature space, the correlation between vectors in different spaces cannot be directly calculated. Therefore, in order to calculate the correlation, the video clip feature and the intent feature should first be converted to the same feature space. For example, the video clip feature and the intent feature can be extracted again through the same feature extraction network to obtain feature vectors located in the same feature space, and then subsequent processing is performed based on the converted feature vectors of the video clip and the converted feature vectors of the intent feature.

[0261] like Fig.12a As shown in , it is assumed that the feature vector of the video clip feature is an n*1-dimensional feature vector, that is, an n-dimensional column vector, corresponding to f shown in the figure v (n*1), the feature vector of the intention feature is a d*1-dimensional feature vector, that is, a d-dimensional column vector, corresponding to f shown in the figure intention (d*1), the arrows in the figure represent the direction vectors of the corresponding eigenvectors, and through the feature conversion parameter matrix, f v (n*1) and f intention (d*1) is converted to the same feature space A, and f is obtained v (n*1) corresponds to the feature vector Wf of feature space A v (m*1), get f intention (d*1) corresponds to the feature vector Vf of feature space A intention (m*1), that is, the transformed eigenvectors are all m-dimensional column vectors. Specifically, W is an m*n matrix, that is, a parameter matrix with m rows and n columns. v (n*1) is a matrix with n rows and 1 column. The multiplication of the two matrices results in a new matrix with m rows and 1 column, namely Wf v (m*1), similarly, V is an m*d matrix, which is the same as f intention(d*1) to obtain a matrix with m rows and 1 column, namely Vf intention (m*1).

[0262] After the conversion, the initial correlation between the two can be calculated in the same feature space A. For two feature vectors, if the correlation between the two is large, the two should have similar directions in the same feature space, and their sum should be relatively large. If the correlation between the two is small, the directions of the two in the same feature space will be greatly different, and the sum of the two should be relatively small. Therefore, the correlation between the two can be represented by the sum of the two vectors. Figure 12b and Fig.12c As shown in , the sum vector of vector A and vector B is vector C, the sum vector of vector D and vector E is vector F, the directions of vector D and vector E are consistent, and the directions of vector A and vector B are quite different. Therefore, the magnitude of vector F is greater than that of vector C, and the correlation between vector D and vector E is greater than the correlation between vector A and vector B.

[0263] As an example, suppose the user's intention is to generate a video about swimming, where one video clip 1 is a video clip about freestyle swimming, and the other video clip 2 is a clip about playing basketball. Then the length of the sum of the feature vector of the segment features of video clip 1 mapped to the same feature space and the feature vector of the user's intention features is greater than the length of the sum of the feature vector of the segment features of video clip 2 and the feature vector of the intention features.

[0264] Therefore, for the eigenvector Wf v (m*1) and eigenvector Vf intention (m*1), can be obtained by Wf v +Vf intention +b to determine the correlation between the two, where the feature vector b, i.e., the bias b, is a feature offset, so that the above formula, i.e., the correlation calculation formula, is v +Vf intention =0 and other extreme cases. v +Vf intention +b means Wf v (m*1) and Vf intention (m*1) The eigenvalues ​​of the corresponding positions in the two feature vectors are summed, and then the feature vector b is added to obtain a new m-dimensional column vector, which can be understood as the correlation vector between the fragment feature and the intention feature vector.

[0265] Furthermore, since the sum of the eigenvectors varies greatly, the network model is difficult to learn. Therefore, it can be normalized to (-1, 1). For example, the sum of the eigenvectors can be normalized to (-1, 1) by using the activation function tanh function mentioned above. After that, the weight matrix V TThe normalized m-dimensional column vector tanh(Ef v +Vf intention +b) is a T-dimensional column vector. Specifically, V T is a T*m matrix, that is, a matrix with T rows and m columns. By multiplying the two matrices, V T tanh(Ef v +Vf intention + b) to get the correlation calculation result c(f v ,f intention ), which is a T*1 matrix, i.e. a T-dimensional column vector. Optionally, for ease of calculation, the value of T can be 1, then c(f v ,f intention ) is a numerical value. If the value of T is an integer greater than 1, then c(f v ,f intention ) is a column vector.

[0266] Of course, as another option, we can also directly convert tanh(Wf v +Vf intention +b) is calculated as c(f v ,f intention ).

[0267] b. Selection of video clips relevant to user intent

[0268] After obtaining the relevance corresponding to each candidate video segment through the above step a, based on the set threshold 1, the video segment with a relevance greater than the threshold 1 can be selected as the video segment. As an optional example, Fig.13 A flow chart of a method for screening candidate videos based on relevance (correlation value shown in the figure) is shown in the figure. As shown in the figure, the threshold value 1 in this method, for each candidate video segment, the correlation value corresponding to each candidate video segment is calculated based on the segment feature vector and the intention feature vector. If the correlation value is greater than the threshold, the corresponding video segment can be used as the screened video segment. If the correlation value is not greater than the threshold, the corresponding video segment is filtered out. The specific value of the above threshold value 1 can be determined based on empirical values ​​and / or experimental values, such as being set to the average correlation of the training data, that is, the average value of the correlations between the segment features of each candidate video segment in the training data and the user intention features.

[0269] It should be noted that, when the calculation result of the correlation is a numerical value, Threshold 1 can be a specific numerical value; when the calculation result of the correlation is a column vector, Threshold 1 can be a column vector of the same dimension, that is, the threshold can be a reference vector, and the similarity of the two column vectors can be calculated to further determine whether the corresponding candidate video segment can be used as the target video segment. For example, when the distance between the two vectors is less than the set distance, the corresponding candidate video segment can be determined as the target video segment.

[0270] in, Fig.13 The segment diversity processing shown in is optional, i.e., it may not be performed, and the video segments screened out based on the relevance may be used as the target video segments. It may also be performed, i.e., this step is performed after each video segment screened out based on the relevance, and each video segment processed in this step may be used as the target video segment. The segment diversity processing step will be introduced below.

[0271] c. Optional processing of fragment diversity

[0272] Assume that the user wants to watch videos about "playing basketball". By calculating the relevance in the previous step, most of the clips screened out are about shooting. This will cause a problem. Most of the clips screened out are related to shooting. If the target video is directly generated based on these clips, the video clips with high relevance may be similar to the user, which will make the user feel that the video content is relatively monotonous. Considering that the user may want to see a variety of materials about playing basketball, the embodiment of the present application designs a method for processing clip diversity. The principle of this method is to calculate the relevance of the clips to be processed in each candidate video clip and the clips that have been screened.

[0273] The core idea of ​​this method of processing the diversity of segments is to calculate the correlation between the segments. The smaller the correlation value, the greater the difference between the segment and other segments, and the less relevant it is. By finding the segment with the minimum correlation, we can find as many segments with different contents as possible. Taking the above-mentioned playing basketball as an example, we can eventually filter out the segments of different subcategories such as shooting, dribbling, and blocking, which belong to the category of playing basketball. Fig.14 A detailed flow chart of the method is shown in FIG. 8 . As shown in the figure, the detailed processing flow may include the following steps:

[0274] 1) Select the segment with the largest correlation value from the candidate video segments obtained in the previous step b (the candidate video segments shown in the figure) as the screened segment ①, that is, the candidate video segment with the largest correlation between the segment feature and the intention feature among the candidate video segments screened in the previous step is used as the initial screened video segment;

[0275] 2) Calculate the correlation between other segments in the candidate video segments and the selected segments. If the correlation is not less than the set threshold 2, the segment is considered to be a similar segment to the selected segment and can be ignored. Otherwise, the segment with the minimum correlation value is selected from all segments with correlation less than the threshold 2 and added to the selected segment set ②;

[0276] 3) Repeat the above process 2), that is, again calculate the correlation between other segments in the candidate video segments and the already screened segments (including the screened segment ① and other segments screened by process 2, i.e., each segment in the segment combination ②), screen out the segment with the corresponding correlation less than the set threshold 2 and the smallest correlation, and repeat this process until all candidate video segments are processed. The final required video segments are: segment ① and each segment in the segment set ②.

[0277] The setting method of the above-mentioned threshold value 2 may be the same as the setting method of the above-mentioned threshold value 1, that is, it is obtained based on training data.

[0278] 1.4. Fragment fusion

[0279] By combining the character video slices (i.e., character video clips) and action video slices (i.e., action video clips) information, the character action clip information, i.e., a video clip of a person doing a certain action, can be obtained through the intersection processing of the slice sets. As an optional fusion method, for each video belonging to the same candidate video, the fusion can be performed based on the information of the common time periods in both the character video clips and the action video clips, for example Fig.15 In the character slice shown in , character A appears at 0.5 to 5 seconds in video 001, and in the action slice, the time from 1.5 to 5 seconds in video 001 is the action of "laughing", so the two slices are fused, and the information of the best video segment (the fused video segment) can be obtained as follows: character A—video 001—1.5 to 5 seconds—laughing, that is, character A is laughing in the segment from 1.5 to 5 seconds in video 001. Similarly, all character slices and action slices can be processed in this way to obtain the best video segment, that is, the video segment containing a person doing a certain action.

[0280] It can be understood that in practical applications, the rules for segment fusion can be configured according to actual needs. The fusion method shown above is only an optional method. For example, a duration threshold can also be configured. For character segment a and action segment b belonging to the same video, if the common duration of the two corresponding to the video is greater than the duration threshold, then the action segment b can be considered to be the action segment of the character in character segment a. Then, the segments corresponding to the common duration in character segment a and action segment b can be fused to obtain a video segment of doing something. In addition, based on this method, the same action segment can correspond to one or more character segments. For example, for a video of a meeting of multiple characters, there may be video segments of multiple characters doing the same action in the same period. For example, in a certain period of time, multiple characters laugh at the same time, then the laughing action segment can correspond to these multiple characters.

[0281] In summary, the above-mentioned video generation method based on multi-level action recognition provided by the embodiment of the present application has at least the following advantages:

[0282] Multi-level action recognition can adaptively segment action segments and levels according to the user's input duration. When the user needs a longer generated video, the scheme can quickly segment longer video segments and obtain coarse-grained action categories. For more stringent duration constraints, the scheme can cut fine-grained action video segments. This adaptive segmentation scheme has two major advantages. On the one hand, it can quickly and accurately classify only action suggestions of a certain level. Therefore, the action segments can be quickly and accurately classified, and the subsequent data processing volume can be effectively reduced, improving the efficiency of video generation. The existing action detection technology will classify all granular action suggestions, and the operation speed is slow. At the same time, because the number of suggestions that need to be classified is large, it will seriously affect the classification accuracy. On the other hand, for shorter video generation requirements, fine-grained action type classification can be selected, which can make the types delicate and diversified, and ultimately make the generated video content more diverse and more attractive.

[0283] Use the segment selection process to filter the video segments related to the user's intention. Compared with the prior art, the solution provided in the embodiment of the present application can obtain the video segments that the user wants, and can better meet the user's needs. The solution provided in the embodiment of the present application has great practical value and can greatly improve the user experience. In addition, the present application also takes into account the diversity of video content. In the video segment aggregation process, the key semantic information about the characters and actions of the video can be obtained, that is, the segment of someone doing something can be segmented, which is the core content of video understanding, so that a target video that better meets the user's needs can be generated, which is not available in the existing solutions.

[0284] Based on the above video clip aggregation and video generation solution provided by this application, at least the following technical effects can be obtained:

[0285] -Get a segment of someone doing something

[0286] - Collect the video clips that users need

[0287] - The segmented clips can have various video contents. For example, if a user wants to watch a video of "playing basketball", the segmented video clips may include various fine movements of playing basketball, such as "shooting", "blocking", "dribbling", etc., instead of just shooting videos.

[0288] It should be noted that the multi-level action recognition, segment selection and character recognition mentioned in the above embodiments of the present application can be used independently or in combination. The above video generation scheme provided in the embodiments of the present application can be applied to scenes and functions such as video editing, video story generation, and video retrieval, and has broad application prospects in hardware products with video playback functions such as smart phones, tablet computers, and computers. Of course, it can also be applied in the background server, and the server generates various content-rich videos according to user needs. The scheme based on the embodiments of the present application can greatly enhance the user's video experience.

[0289] For example, based on the solution provided by the embodiment of the present application, the user's intention can be understood quickly and accurately, and the video that the user wants can be found based on the user's intention, so as to realize accurate retrieval of the video; related videos can also be cut and synthesized into a short video clip with a certain internal continuity to realize fast editing of the video; special video effects can also be intelligently added according to the generated video content to realize intelligent creation, such as adding special effects to the generated video, or replacing a certain content in the video screen. Specifically, for example, the generated target is a video of a specified person riding a bicycle on the beach. Based on this video, the user can perform further intelligent creation, such as editing the video into a video of riding a bicycle in a pastoral scene. It can be seen that based on the solution provided by the embodiment of the present application, users can obtain videos with rich and diverse content according to their respective needs, so that each moment of the generated video is interesting and memorable, and provide users with valuable memory videos.

[0290] The application of the video generation solution provided in the embodiment of the present application is introduced below in combination with specific application scenarios:

[0291] a. Application scenario 1 - Video multi-level action retrieval in smartphones

[0292] Assume that a user wants to retrieve videos related to playing basketball in the photo album of a mobile phone. Based on the video generation solution provided in the embodiment of the present application, the user can get the following experience:

[0293] -Users use voice or directly input the content to be searched, such as Fig.16 The search term shown in is "playing basketball";

[0294] -The mobile phone program calculates the relevance of the videos saved in the mobile phone album and finds the required videos, that is, pre-screens the videos in the mobile phone based on user needs to obtain candidate videos, and then applies multi-level action recognition algorithms to these videos, such as Fig.16 As shown in the flowchart, the processing result of multi-level action recognition can obtain the following video clip:

[0295] There are 30 long videos related to playing basketball in the album, including 11 shooting clips, 16 dribbling clips, and 3 blocking clips.

[0296] This application scenario is very convenient and practical for basketball enthusiasts. They can quickly view previously shot videos, select their favorite moments, and share them with friends. They can also review the scene at that time or reflect on their sports performance at that time. b. Application scenario 2 - People video retrieval in smartphones

[0297] Assuming that a user wants to retrieve videos of his or her children from the photo album on his or her phone, the user can get the following experience:

[0298] -The user specifies the information of the person to be retrieved (such as profile picture, etc.);

[0299] -The mobile app performs person recognition on the videos in the photo album, finds the person's videos, and then applies a multi-level action recognition algorithm to these videos, such as Fig.17 As shown in , based on the processing of person recognition and multi-level action recognition, the following video clips of the person specified by the user can be returned:

[0300] The album includes a 30-second basketball clip (not shown in the figure), a 15-second bicycle clip, a 22-second sand digging clip, etc.

[0301] This function is very convenient and practical for users, who can find people they are interested in, view relevant wonderful moments, and then share them with friends and family, or bring sweet memories. It is especially suitable for viewing video clips of couples and families from a large number of messy videos.

[0302] As an example, the video clip aggregation module provided in the embodiment of the present application can be deployed on a smart phone. After the smart phone with the module deployed receives a video generation request from the user, it can perform character recognition and multi-level action recognition processing on multiple videos of the user stored in the mobile phone to obtain each video clip, and each video clip can be displayed on the terminal interface. For example, each video clip can specifically show the segmentation result of a person doing something. Specifically, for example, the character information (such as the character's avatar) appearing in the user's video can be displayed on the screen of the terminal. The user can click on the avatar of a character to enter the corresponding personal page, and the relevant video clips about the person can be displayed. The video clips can also be classified according to the action (scene) category, and video clips of different categories can be displayed on the screen of the terminal.

[0303] It can be seen that based on the solution provided in the embodiment of the present application, the characters and clips appearing in the video in the album of the terminal device can be displayed, the action classification labels of the clips can be viewed, and wonderful videos of a given time length can be automatically generated, and the generated interesting videos can be further shared.

[0304] The solution of the embodiment of the present application should also be used in applications with video generation functions, and the relevant information of various video clips used to generate the target video can be displayed through the user interface of the application, such as information about characters appearing in the video, wonderful video clips of the characters, all action video clips of a specific character, etc.

[0305] The following is a detailed description of the attention based video generation method provided in an embodiment of the present application with reference to an example.

[0306] As described above, the existing sorting-based video generation methods generally do not consider the semantic information of the video and the theme of the video content, but only rely on simple rules. There are two main problems with the existing video generation method: first, in order to cope with different application scenarios, different rules need to be summarized. For some special or complex application scenarios, it is likely to be difficult to extract and summarize the video generation rules from the complicated data; second, the user's videos, i.e., candidate videos, are often rich in themes and colorful in content, which may cover travel, family gatherings, daily life, etc. The existing scheme needs to assign a rule to each video theme, which will result in a huge workload, and the extraction of rules will occupy a large amount of memory space on the device. Therefore, the existing video generation method based on simple rules is difficult to generate videos that represent the video content of many users, which will result in the generated videos not meeting user needs.

[0307] In order to solve this problem, the present invention proposes a video generation method based on an attention mechanism, which can automatically edit video clips based on video content, user intention, and the spatiotemporal characteristics of video clips to generate the video that the user wants.

[0308] As an example, Fig.18 The flowchart of a video generation method based on an attention mechanism provided by an embodiment of the present application is shown in the figure. The method can be implemented by a video generation network with an attention mechanism (the attention module shown in the figure). As shown in the figure, the video generation network in this example (the LSTM decoding network based on the attention mechanism shown in the figure) includes an attention module, an LSTM (long short-term memory) network and a generator. The input of the video generation network includes the segment features of each video segment to be processed (which can be a candidate video segment, or each video segment selected from each candidate video segment based on the relevance of the intention feature and each candidate video segment, or each video segment after segment diversity processing), the user intention feature, and the length of the video that the user wants to generate (i.e., the video duration and input video duration in the previous text), and the output is a video that the user wants, i.e., the target video. Among them, the attention module combines the user intention (specifically the intention feature) with the video content (specifically the segment features of the candidate video segment, which can also be called the segment feature vector), and the LSTM network will find the best segment arrangement order based on the rich training data and considering the internal connection between the segments.

[0309] The segment features of each video segment are obtained in the video aggregation module described above. Assume that the number of obtained video segments is T, and their segment features are {h 1 ,...,h T}, that is, h j represents the segment feature of the jth (1≤j≤T) video segment, and the user intention feature is recorded as f intention , the video length that the user wants, that is, the video duration, is L. The specific steps of this solution are as follows:

[0310] a. Filter each video clip using a person filter. This step is optional. For example, if the user wants to generate a video of a specific person (e.g., the user provides an image of the target person to be included in the generated video), the filter needs to be used to filter each video clip. If no person is specified, the filter can be omitted.

[0311] b. Generate the desired video through the LSTM decoding network based on the attention mechanism.

[0312] Specifically, the attention module can use the following formula to calculate the attention weight of each video clip:

[0313] e t,j =v T tanh(Ws t-1 +Vh j +Kf intention +b)

[0314] Among them, e t,j represents the attention weight of the LSTM network at time t for the jth video clip, s t-1 Represents the hidden state variable (also called hidden state feature, hidden state feature vector, hidden vector, implicit representation, hidden state variable, etc.) of the LSTM network at time t-1, such as Fig.18 The s shown in 1 、s 2 、s n-1 They represent the hidden state variables at the initial moment, the second moment, and the n-1th moment, respectively. W, V, and K represent s t-1 、h j and f intention The feature space conversion parameter matrix of , b is the bias of the attention module, Tanh is the activation function, which is used here to normalize the feature vector to normalize the feature vector to (-1,1), v T is the weight matrix of the attention module, which is used to convert the feature dimension of the normalized feature vector into the specified dimension. T These are the network parameters of the attention module, which can be obtained through training.

[0315] It should be noted that in the description of LSTM in this example, the moments or times described (such as t moment, t time, etc.) are all relative time concepts, referring to the time steps in the neural network processing process, corresponding to the operations performed sequentially as described above, such as the above s t-1 That is, it can be understood as the t-1th operation, e t,j It is the attention weight of the j-th video clip at the t-th operation.

[0316] As an example, Fig.19 A flow chart of a method for calculating attention weight based on user intention features provided in an embodiment of the present application is shown in FIG. Fig.19 As shown in , the process can mainly include:

[0317] First, similarly, in order to calculate the attention weight, the features of different feature spaces need to be transformed into the same feature space to calculate their correlation and normalize them, and then the feature vector is transformed to T*1 to obtain the attention weight of each input video clip.

[0318] Specifically, Fig.19 As shown in FIG. 1 , taking the jth video clip as an example, the feature vector of the segment feature of the video clip is the feature vector of the l*1 dimension in the video feature space, corresponding to the h shown in the figure. j (l*1), the feature vector of the intention feature is the d*1-dimensional feature vector of the user intention feature space, that is, the d-dimensional column vector, corresponding to f shown in the figure intention (d*1), s t-1 is the state feature vector of the state feature space, and its feature dimension is n*1. For each feature vector, s can be transformed by the feature space conversion parameter matrix W, V, K respectively. t-1 、h j and f intention Transform to the same feature space (feature space A shown in the figure), and obtain the feature vectors with the transformed dimensions of m*1, that is, Ws shown in the figure t-1 (m*1), Vh j (m*1) and Kf intention , the arrows in the figure represent the direction vectors of the corresponding eigenvectors.

[0319] After converting each eigenvector to the same eigenspace, t-1 +Vh j +Kf intention +b can calculate the correlation between the three. From the previous description of the correlation between features, we can know that if the correlation between multiple feature vectors is large, then these feature vectors should have similar directions in the same feature space, and their sum should be relatively large. Therefore, Ws t-1 +Vh j +Kf intention +b calculates the correlation between the three, and the bias vector (the eigenvector b shown in the figure) is the offset, so the expression is in Ws t-1 +Vh j +Kf intention =0 and is more robust.

[0320] Since the sum of the eigenvectors varies widely, it is difficult for the attention module to learn the network parameters during training. Therefore, the sum of the eigenvectors calculated above can be normalized to (-1, 1) through the activation function tanh(), that is, through the expression tanh(Ws t-1 +Vhj +Kf intention ) calculates the eigenvector with the element value range of (-1, 1) and the dimension of m*1. After that, it can be further converted by the feature dimension matrix v T The dimension of the feature vector corresponding to the correlation is converted from m*1 to T*1.

[0321] After determining the attention weights of each video clip at the current time t, the attention weights can be normalized to [0, 1], and the normalization formula is:

[0322]

[0323] At this time, the feature vector input to the LSTM network, that is, the feature vector output by the attention module, is the feature vector after weighted summation. The weighted video segment features input to the LSTM network at time t are as follows:

[0324]

[0325] like Fig.18 In the example shown in 1 , g 2 , g n They respectively represent the weighted video segment features at the initial moment, the second moment, and the n-th moment, that is, the weighted video segment features corresponding to the first operation, the second operation, and the n-th operation, respectively.

[0326] Through the LSTM network and the generator, the index of the video segment selected at time t can be obtained. The calculation process is as follows:

[0327] s t =LSTM(y t-1 , g t ,s t-1 )

[0328] y t =Generate(s t , g t )

[0329] Among them, at time t, the input information of the LSTM network includes y t-1 、s t-1 , and g t , the output information is s t , that is, the hidden state feature at time t, which represents the information recorded by the LSTM network at that time, y t-1 Indicates the index (i.e., identifier) ​​of the video segment output by the generator at the last moment, i.e., at time t-1, i.e., the index of the target video segment determined by the last operation; the input information of the generator, i.e., Generate, includes st and g t The output information is specifically the index of the selected video segment obtained by the generator at that time, that is, the above y t For example, if the third video clip in the input video is selected at time t, then y t That is 3. Fig.18 In the example shown in 1 ,y 2 ,y n Respectively represent the indexes of the selected videos at the initial moment, the second moment, and the nth moment.

[0330] c. At time t, if the length of the generated video is greater than or equal to the length L of the video desired by the user, the generation network stops. At this time, the video composed of the video clips output in time sequence is the generated video, i.e., the target video.

[0331] In the video generation scheme provided in the embodiment of the present application, the main input of the LSTM decoding network based on the attention mechanism is the segmented video clips, and the output is a video composed of the selected video clips. Assuming that there are 10 input video clips, all of which are related to "playing basketball", wherein the first video clip is a "shooting" clip, the third video clip is a "dribbling" clip, and the fifth video clip is a "blocking" clip, assuming that the goal of the network is to generate a video, the content of which is "dribbling" (t-2) -> "shooting" (t-1) -> "blocking" (t), that is, the three video clips contained in the target video to be generated in chronological order are "dribbling" clip, "shooting" clip, and "blocking" clip, then the output of the LSTM network should be 3 (t-2) -> 1 (t-1) -> 5 (t), that is, at the time t-2 of the LSTM network, the output is the index 3 of the "dribbling" clip, at the time t-1, the output is the index 1 of the "shooting" clip, and at the time t, the output is the index 5 of the "blocking" clip. Specifically, taking time t as an example, the input g of the LSTM network t is the weighted feature of the 10 input video clips, and the weight is calculated based on the input video features, user intent features, and the hidden state variables of LSTM at time t-1; at this time, y t-1 is the index of the "shooting" video clip selected last time, which should be 1. t-1 is the information recorded by LSTM from the beginning to time t-1, which can be simply understood as the state of "shooting" at the previous time. Then, at time t, the output of the LSTM network is the index of the video clip "block", which should be 5 here.

[0332] From the above description, it can be seen that the video generation method based on the attention mechanism proposed in the embodiment of the present application mainly includes two parts: the attention mechanism and the LSTM network. This scheme incorporates the user intention into the calculation of the attention weight, while the existing video generation method does not incorporate this feature into the calculation of the attention weight. In addition, using the LSTM network based on the attention mechanism to generate the video the user wants can obtain better video generation effects than the rule-based method.

[0333] Specifically, for example, 4 videos were shot at different times (Spring 2016, Autumn 2017, Winter 2018, Summer 2019) in the same place. If the existing time sorting method is applied, usually only the order of "2016-2017-2018-2019" can be obtained. However, after learning the LSTM network provided by the embodiment of the present application, a video arranged in the four seasons of "Spring-Summer-Autumn-Winter" can be generated, which is more in line with user needs and people's cognition. In addition, the LSTM network can learn many movie-level cutting and splicing techniques, such as switching between close-up and long-range shots, or more complex montage techniques, inserting another segment representing a mood scene in the general video main line, etc. Therefore, based on the video generation method based on the attention mechanism (incorporating user intention features) provided by the embodiment of the present application, a better effect can be obtained, which is more in line with user expectations.

[0334] Based on the same principle as the method provided in the embodiment of the present application, the embodiment of the present application also provides a video generating device, such as Fig. 20 As shown in , the video generation device 100 includes an intention extraction module 110 and a video generation module 120. Among them: the intention extraction module 110 is used to extract the intention feature of the video generation request;

[0335] The video generation module 120 is used to generate a target video based on the intent feature and the candidate videos.

[0336] Optionally, the above intention features include action behavior intention features.

[0337] Optionally, the video generation module 120 is specifically used for:

[0338] Extracting video features of each candidate video respectively;

[0339] Determine candidate video segments in each candidate video based on video features of each candidate video;

[0340] Screening each candidate video segment based on the intention feature to obtain each target video segment;

[0341] A target video is generated based on each target video segment.

[0342] Optionally, for a candidate video, when the video generation module 120 determines a candidate video segment in the candidate video based on the video feature of the candidate video, it can be specifically configured to perform at least one of the following:

[0343] Based on the video features of the candidate video, perform object recognition on the candidate video to obtain first candidate video segments containing the target object;

[0344] Based on the video features of the candidate video, action behavior recognition is performed on the candidate video to obtain the time period information corresponding to each video segment containing action in the candidate video, and based on each time period information, each second candidate video segment is obtained.

[0345] Optionally, if the target video segment includes a first candidate video segment and a second candidate video segment belonging to the same candidate video, the video generation module 120 generates the target video based on the target video segments. When generating the target video, the video generation module 120 may specifically be used to:

[0346] Merging the first candidate video segment and the second candidate video segment belonging to the same candidate video in each target video segment;

[0347] Generate a target video based on the fused video clips.

[0348] Optionally, when obtaining each second candidate video segment based on each time period information, the video generation module 120 is configured to:

[0349] Determine the duration of the video clips corresponding to each time period information;

[0350] Determine the level of each time period information based on the length of each segment corresponding to the information of each time period;

[0351] Based on the level of each period of time information, a second candidate video segment is determined from each video segment corresponding to each period of time information.

[0352] Optionally, when the video generation module 120 determines the second candidate video segment from each video segment corresponding to each time segment information based on the level of each time segment information, it is configured to:

[0353] Determine the target level within each level;

[0354] The video segments corresponding to the time period information belonging to the target level are determined as second candidate video segments.

[0355] Optionally, if the video generation request includes the video duration of the target video, the video generation module 120 is used to determine the target level among the levels:

[0356] Based on the video duration and the duration threshold corresponding to each level, a target level in each level is determined.

[0357] Optionally, for a period of time information, when the video generation module 120 determines the level of the period of time information based on the length of the segment corresponding to the period of time information, it can be specifically used to perform at least one of the following:

[0358] Determine the duration interval to which the segment duration corresponding to the time period information belongs, and determine the level corresponding to the duration interval as the level of the time period information, each level corresponding to its own duration interval;

[0359] The level corresponding to the duration threshold closest to the duration of the segment corresponding to the time period information is determined as the level of the time period information.

[0360] Optionally, there is a common transition duration interval between two adjacent levels. For a period of time information, when the video generation module 120 determines the duration interval to which the segment duration corresponding to the period of time information belongs and determines the level corresponding to the duration interval as the level of the period of time information, it is specifically used to:

[0361] When the segment duration corresponding to the time period information belongs to a transition duration interval between two adjacent levels, the two adjacent levels corresponding to the transition duration interval are determined as the level of the time period information.

[0362] Optionally, when the video generation module 120 determines the target level in each level based on the video duration and the duration threshold corresponding to each level, it is specifically configured to:

[0363] Based on the video length, determine the video time limit;

[0364] The target level in each level is determined according to the video limit time and the time threshold corresponding to each level.

[0365] Optionally, the levels are arranged in descending order, and the duration threshold corresponding to the current level is not less than the duration threshold corresponding to the next level; when the video generation module 120 determines the target level in each level according to the video limit duration and the duration threshold corresponding to each level, it is specifically used to:

[0366] According to the order of the levels from high to low, the video limit duration and the duration threshold corresponding to the current level are compared in turn until the video limit duration is not less than the duration threshold corresponding to the current level, and the current level is determined as the target level.

[0367] Optionally, the levels are arranged in descending order, and the duration threshold corresponding to the current level is not less than the duration threshold corresponding to the next level; when the video generation module 120 determines the target level in each level according to the video limit duration and the duration threshold corresponding to each level, it is specifically used to:

[0368] In order from high to low in each level, the following processes are carried out in sequence until the target level is determined:

[0369] If the video limit duration is not less than the duration threshold corresponding to the current level, the current level is determined as the target level;

[0370] If the video limit duration is less than the duration threshold corresponding to the current level, the target level is determined or the processing to the next level is entered based on the first number of time period information belonging to the current level whose corresponding segment duration is not greater than the video limit duration, and the second number of time period information belonging to the next level whose corresponding segment duration is not greater than the video limit duration.

[0371] Optionally, when the video generation module 120 determines each video segment corresponding to each time segment information belonging to the target level as the second candidate video segment, it is specifically configured to:

[0372] The video segments corresponding to the time period information of the target level and having a segment duration shorter than the video limit duration are determined as second candidate video segments.

[0373] Optionally, when the video generation module 120 determines the target level or enters the next level of processing according to the first number and the second number, it is specifically configured to:

[0374] If the first number is not less than the second number, determining the current level as the target level;

[0375] If the first number is less than the second number, and the next level is the last level, determining the next level as the target level;

[0376] If the first number is smaller than the second number, and the next level is not the last level, the process proceeds to the next level.

[0377] Optionally, when the video generation module 120 screens the candidate video segments based on the intention feature to obtain the target video segments, it is used to:

[0378] Obtaining video segment features of each candidate video segment;

[0379] Determining the correlation between the intent feature and the video segment feature of each candidate video segment respectively;

[0380] Based on the correlations corresponding to the candidate video segments, the candidate video segments are screened to obtain the target video segments.

[0381] Optionally, when the video generation module 120 screens each candidate video segment based on the intention feature to obtain each target video segment,

[0382] Obtaining video segment features of each candidate video segment;

[0383] Determine the weight of each video segment to be processed based on the intention feature and the video segment feature of each video segment to be processed; wherein each video segment to be processed is a candidate video segment, or is a video segment after each candidate video segment is screened based on the correlation between the intention feature and the video segment feature of each candidate video segment;

[0384] Based on the video segment features and weights of the video segments to be processed, each target video segment is screened out.

[0385] Optionally, when the video generation module 120 determines the weight of each to-be-processed video segment based on the intention feature, and screens out each target video segment based on the video segment features of each to-be-processed video segment and the weight of each to-be-processed video segment, it is specifically used to:

[0386] Based on the intent features and the video segment features of each video segment to be processed, the following operations are performed in sequence to obtain the target video segment corresponding to each operation:

[0387] Determine the weight of each video segment to be processed in the current operation based on the intention feature, the video segment features of each video segment to be processed, and the weight of each video segment to be processed determined by at least one operation before the current operation;

[0388] Based on the video segment features of each to-be-processed video segment, the weights of each to-be-processed video segment of the current operation, and the target video segment determined by at least one operation before the current operation, the target video segment corresponding to the current operation is screened out.

[0389] Optionally, when the video generation module 120 determines the weight of each video segment to be processed based on the intention feature and the video segment feature of each video segment to be processed, and screens out the target video segment corresponding to each moment based on the video segment feature and weight of each video segment to be processed, it is specifically used to:

[0390] For the first operation, based on the intention feature and the segment feature of each video segment to be processed, the weight of each video segment to be processed of the first operation is determined; based on the weight of each video segment to be processed of the first operation, the weighted video segment feature of the first operation is obtained; based on the weighted video segment feature of the first operation, the hidden state feature of the first operation is obtained; based on the hidden state feature of the first operation and the weighted video segment feature, the target video segment of the first operation is obtained;

[0391] For operations other than the first operation, the weights of each video segment to be processed of the current operation are determined based on the hidden state features, intention features, and video segment features of each video segment to be processed of the previous operation; the weighted video segment features of the current operation are obtained based on the weights of each video segment to be processed of the current operation; the hidden state features of the current operation are obtained based on the hidden state features of the previous operation, the weighted video segment features of the current operation, and the target video segment of the previous operation; the target video segment of the current operation is obtained based on the hidden state features of the current operation and the weighted video segment features of the current operation.

[0392] Optionally, if the video generation request includes the video duration of the target video, after filtering out the target video segment at the current moment, the video generation module 120 is further configured to:

[0393] Determine the total duration of each selected target video segment;

[0394] If the total duration is less than the video duration, the target video segment at the next moment is filtered;

[0395] If the total duration is not less than the video duration, the screening operation of the target video segment is terminated.

[0396] Optionally, if each target video segment is a target video segment selected by each operation, the video generation module 120 is specifically used to:

[0397] Based on the order in which the target video clips are screened, the target video clips are merged to obtain the target video.

[0398] Optionally, when the video generation module 120 generates the target video based on each target video segment, it is specifically used to:

[0399] Screening each target video segment based on the correlation between the video segments in each target video segment;

[0400] A target video is generated based on the filtered target video segments.

[0401] Optionally, when the video generation module 120 screens each target video segment based on the correlation between the video segments in each target video segment, it is specifically configured to:

[0402] Determining a reference video segment in each target video segment;

[0403] The reference video segment is used as the initial filtered target video segment, and the following operations are repeated for each to-be-filtered video segment except the filtered target video segment in each target video segment until all filtered target video segments are determined:

[0404] The correlations between the screened target video segments and the video segments to be screened are determined respectively, and the video segment to be screened corresponding to the smallest correlation smaller than a set value among the correlations is determined as a new screened video segment.

[0405] Optionally, when the video generation module 120 generates the target video based on each target video segment, it is specifically used to:

[0406] Determine the action type of the action behavior contained in each target video clip;

[0407] Based on each target video segment and the action type corresponding to each target video segment, a target video is generated to display the action type corresponding to each target video segment to the user.

[0408] Based on the same principle as the video generation method provided in the embodiment of the present application, the embodiment of the present application also provides an electronic device, which includes a memory and a processor; wherein a computer program is stored in the memory; and the processor is used to execute the method provided in any optional embodiment of the present application when running the above-mentioned computer program.

[0409] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method provided by any optional embodiment of the present application is executed.

[0410] Fig.21 A schematic diagram of the structure of an optional electronic device applicable to the method provided in the embodiment of the present application is shown in FIG. Fig.21 As shown, the electronic device 4000 includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.

[0411] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0412] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.21 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0413] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0414] The memory 4003 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the content shown in any of the above method embodiments.

[0415] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0416] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A video generation method, It is characterized in that The following steps are involved: receiving a video generation request for generating a target video from a source video, the video generation request including a user input indicating a target motion of the target video and a target length of the target video; By performing action recognition on the source video, a plurality of action clips are obtained after the source video is segmented; According to the time lengths of the multiple action clips, a plurality of levels are assigned to the multiple action clips, the plurality of levels comprising a first level and a second level, the time length of the first level being greater than the time length of the second level; assigning, based on the segment features of the multiple action segments, a plurality of action types indicating contents of the multiple action segments to the multiple action segments; Based on the target length of the target video, selecting a level from a plurality of levels assigned to the plurality of action clips as a target level; Selecting a target segment from one or more action segments corresponding to the target level based on the target action and the target length of the target video; A target video is generated by merging at least part of the target segments.

2. The method according to claim 1, It is characterized in that The user input is user voice input or user text input.

3. The method according to claim 1, It is characterized in that Select the target segment, including: Acquire the intention feature corresponding to the target action; Extract video features of each source video respectively; Based on the video features of each source video, determine the candidate action segments in each source video; The candidate action segments are selected based on the intention features to obtain target segments.

4. The method according to claim 3, It is characterized in that For a source video, determining a candidate action segment in the source video based on the video features of the source video includes at least one of the following: Based on the video features of the source video, object recognition is performed on the source video to obtain first candidate action segments containing the target object; Based on the video features of the source video, action behavior recognition is performed on the source video to obtain the time length of each action clip in the source video, and based on the time length of each action clip, the level of each action clip is determined, and each action clip belonging to the target level is used as the second candidate action clip.

5. The method according to claim 4, It is characterized in that If the target segment includes a first candidate action segment and a second candidate action segment belonging to the same source video, generating the target video includes: Merging the first candidate action segment and the second candidate action segment belonging to the same source video in each target segment; The target video is generated based on the fused action clips.

6. The method according to claim 1, It is characterized in that Selecting a level as a target level from a plurality of levels assigned to the plurality of action segments comprises: Based on the target length of the target video, determining a limit length of the target video; Based on the restricted length of the target video, a grade is selected from a plurality of grades assigned to the plurality of action clips as a target grade.

7. The method according to claim 1, It is characterized in that The selecting a target segment from one or more action segments corresponding to the target level comprises: Based on the correlation between the segment features of the plurality of action segments assigned the target levels and the intention features corresponding to the target action, a target segment is selected from the action segments assigned the target levels.

8. The method according to claim 7, It is characterized in that An action label to which an action clip is assigned a first level among a plurality of levels is higher than an action label to which an action clip is assigned a level lower than the first level among the plurality of levels.

9. The method according to claim 7, It is characterized in that Select the target segment, including: selecting candidate target segments from the action segments assigned the target levels based on correlations between segment features of the action segments assigned the target levels and intention features; Selecting a candidate target segment having the greatest correlation with the intention feature among the candidate target segments as the target segment; Based on the correlation between the selected target segment and the remaining candidate target segments, some candidate target segments are selected from the remaining candidate target segments as the target segments.

10. The method according to claim 9, It is characterized in that Some candidate target segments are selected from the remaining candidate target segments as target segments, including: From the correlations between the selected target segment and the remaining candidate target segments, a candidate video segment having a correlation smaller than a threshold and the smallest correlation is selected as the target segment.

11. The method according to claim 1, It is characterized in that The method further comprises: By performing object recognition on the source video, the object segments into which the source video is segmented are obtained; Extracting a common segment from the target segment and the object segment segmented from the same source video; The target video is generated by using a public segment as a target segment.

12. The method according to claim 11, It is characterized in that The method further comprises: Some target segments are excluded based on a comparison result between objects included in the target segments and objects identified from the video generation request.

13. The method according to claim 11, It is characterized in that The object recognition includes person recognition, and the object segments include person segments.

14. The method according to any one of claims 1 to 13, It is characterized in that Generating the target video includes: Based on the segment features and the intent features of the target segment, a target video is generated by merging segments sequentially selected from the target segment.

15. The method according to any one of claims 1 to 13, It is characterized in that Generating the target video includes selecting a target segment at each time point, and selecting a target segment at each time point includes: Determine the weight of the target segment at the current time point according to the intention feature, the segment feature, and the weight of the target segment determined at at least one time point before the current time point; Based on the segment feature, the weight of the target segment determined at the current time point, and the target segment selected at at least one time point before the current time point, the target segment corresponding to the current time point is selected.

16. The method according to claim 15, It is characterized in that Generating the target video includes: At a first time point, based on the intention feature and the segment feature of the target segment, determine the weight of the target segment at the first time point; based on the weight of the target segment at the first time point, obtain the weighted segment feature; based on the weighted segment feature at the first time point, obtain the hidden state feature at the first time point; based on the hidden state feature at the first time point and the weighted segment feature, select the target segment corresponding to the first time point; At other time points other than the first time point, the weight of the target segment at the current time point is determined based on the hidden state features, intention features, and segment features of at least one time point before the current time point; weighted segment features are determined based on the weight of the target segment at the current time point; the hidden state features corresponding to the current time point are obtained based on the hidden state features of at least one time point before the current time point, the weighted segment features of the current time point, and the target segment selected at least one time point before the current time point; the target segment corresponding to the current time point is obtained based on the hidden state features of the current time point and the weighted segment features of the current time point.

17. The method according to claim 16, It is characterized in that Generating the target video includes: when the total length of the target segments selected until the most recent time point is not less than the target length, stopping the selection of the target segments.

18. The method according to any one of claims 1 to 13, It is characterized in that Also includes at least one of the following: displaying the target segment by distinguishing the target segment according to the action label of the target segment; A target video is displayed, wherein a target segment in the target video has an action type.

19. The method according to any one of claims 1 to 13, It is characterized in that Selecting a level as a target level from a plurality of levels assigned to the plurality of action segments comprises: Based on the target length and a length threshold corresponding to each of the levels, a level is selected from the multiple levels of the action clip as a target level.

20. The method according to any one of claims 1 to 13, It is characterized in that The allocating a plurality of levels to the plurality of action segments according to the time lengths of the plurality of action segments comprises at least one of the following: For each action segment, assigning a level corresponding to a length interval to which the time length of the action segment belongs among the length intervals corresponding to the multiple levels as the level of the action segment; For each action segment, the level corresponding to the length threshold closest to the time length of the action segment among the length thresholds corresponding to the multiple levels is assigned as the level of the action segment.

21. The method according to claim 20, It is characterized in that The plurality of action clips are assigned a plurality of levels, including: If the duration of an action segment belongs to a transition duration interval of an adjacent level among the multiple levels, the adjacent level is allocated as the level of the action segment.

22. The method according to any one of claims 1 to 13, It is characterized in that Select a target level from a variety of levels, including: Based on the target length, determining a limit length of the target video; According to the restricted length and the length thresholds corresponding to the various levels, a level is selected from the multiple levels as the target level.

23. The method according to claim 22, It is characterized in that The step of selecting a level from a plurality of levels as a target level includes at least one of the following: When comparing the time limit and the length thresholds of the multiple levels in descending order among the levels, selecting the level whose length threshold is smaller than the time limit as the target level; If the length threshold of the first level is less than the limit time, the first level is determined as the target level; if the length threshold of the first level is not less than the limit time, a first number of action clips with a time length not greater than the limit time in the action clips assigned to the first level and a second number of action clips with a time length not greater than the limit time in the action clips assigned to the second level are compared, and the first level is determined as the target level based on the comparison result, or the second level is determined as the target level when it is the last level.

24. The method according to claim 23, It is characterized in that Determine the target level based on the comparison results, including: If the first number is not less than the second number, determining the first level as the target level; If the first number is smaller than the second number, and the second level is the last level, the second level is determined as the target level.

25. The method according to claim 3, It is characterized in that Selecting each of the candidate action segments based on the intention feature to obtain each target segment includes: Obtaining a segment feature of each of the candidate action segments; Determine the weight of each of the video segments to be processed based on the intention feature and the segment features of each of the video segments to be processed; wherein each of the video segments to be processed is the candidate action segment, or is each action segment after each of the candidate action segments is selected based on the correlation between the intention feature and the segment features of each of the candidate action segments; Based on the segment features and weights of the video segments to be processed, each target segment is selected.

26. The method according to claim 25, It is characterized in that Determining the weight of each of the to-be-processed video segments based on the intention feature and the segment feature of each to-be-processed video segment, and selecting each target segment based on the segment feature and the weight of each of the to-be-processed video segments, including: Based on the intention feature and the segment features of each of the to-be-processed video segments, the following operations are performed in sequence to obtain the target segment corresponding to each operation: Determine the weight of each of the video segments to be processed in the current operation based on the intention feature, the segment feature of each of the video segments to be processed, and the weight of each of the video segments to be processed determined in at least one operation before the current operation; Based on the segment features of each of the to-be-processed video segments, the weights of each of the to-be-processed video segments of the current operation, and the target segment determined by at least one operation before the current operation, the target segment corresponding to the current operation is selected.

27. The method according to any one of claims 1 to 13, It is characterized in that The step of generating a target video by merging at least part of the target segments comprises: Selecting each target segment based on the correlation between the video segments in each target segment; The target video is generated by merging the selected target segments.

28. A video generation method, It is characterized in that The method comprises: By performing action recognition on the source video, a plurality of action clips are obtained after the source video is segmented; selecting a target segment from the plurality of action segments according to a correlation between segment features of at least part of the action segments and an intention feature extracted from the video generation request; generating a target video by combining at least some of the target segments; The target video is generated, including: Based on the segment features and the intention features of the target segments, a target video is generated by merging the target segments selected sequentially from the target segments; Wherein, generating the target video includes: performing selection of the target segment at each time point; The step of selecting the target segment at each time point includes: Determine the weight of the target segment at the current time point according to the intention feature, the segment feature, and the weight of the target segment determined at the previous time point; and The target segment corresponding to the current time point is selected according to the segment features, the weight of the target segment determined at the current time point, and the target segment selected at the previous time point.

29. A video generating device, It is characterized in that The device comprises: The video generation module is used to perform the following steps: A video generation request for generating a target video from a source video is received, the video generation request including user input indicating a target action of the target video and a target length of the target video; a plurality of action segments after the source video is segmented are obtained by performing action recognition on the source video; a plurality of levels are assigned to the plurality of action segments according to the time lengths of the plurality of action segments, the plurality of levels including a first level and a second level, the time length of the first level being greater than the time length of the second level; a plurality of action types indicating the contents of the plurality of action segments are assigned to the plurality of action segments based on segment features of the plurality of action segments; a level is selected as a target level from a plurality of levels assigned to the plurality of action segments based on the target length of the target video; a target segment is selected from one or more action segments corresponding to the target level based on the target action and target length of the target video; a target video is generated by merging at least part of the target segments.

30. An electronic device, It is characterized in that including memory and processor; The memory stores a computer program; The processor is configured to execute the method according to any one of claims 1 to 28 when running the computer program.

31. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 28 is executed.

Citation Information

Patent Citations

  • Recommendation method and device of video data and server

    CN108509465A

  • Systems and methods for creating video summaries

    US10509966B1

Cited By

  • Video generation method and device, storage medium and product

    CN121262389A