Video type determination method, device, equipment and storage medium
By combining the initial image features of the video frame and the image segmentation sample features to train the video type prediction model, the problem of low accuracy of video type determination in the existing technology is solved, and higher video type prediction accuracy and applicability are achieved.
Patent Information
- Application Number
- CN202210226169.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-09
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-03-09
AI Technical Summary
The existing technology is easily affected by the background and style when determining the video type, resulting in low video type accuracy. Existing methods are limited by video frame image types and cannot be accurately classified.
By determining the initial image features of each video frame of the video to be predicted and inputting them into the video type prediction model, combining the image segmentation sample features and the initial image sample features, the video type prediction model is trained to reduce the impact of background and color on model training. Improve prediction performance.
It achieves learning as much video frame image information as possible without destroying the original information of the video frame, improving the accuracy and applicability of video type prediction, and enhancing the generalization ability of the model.
Smart Images

Figure CN114581833B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method, apparatus, device and storage medium for determining a video type. Background Art
[0002] In the fields of video recommendation, video retrieval, video advertising, etc., video classification is one of the most basic ways to express video content features, with advantages such as strong interpretability and easy scalability. For example, in the field of video recommendation, videos of interest can be recommended to the target object based on the video types of the videos the target object has browsed. In the field of video retrieval, retrieval based on video types can improve the accuracy of retrieval results.
[0003] The existing technology often determines the video type by identifying the most frequently appearing objects in the video, but it is easily affected by the background or style, resulting in differences between the determined video type and the actual type. For example, a sitting person may correspond to different video types when the person appears in an office, a restaurant, a study, a car, or even a seaside resort. The existing technology also determines the image type of some video frames in the video frame, and then derives the video type of the video based on the image type of some video frames. However, this method is greatly limited by the image type of the video frame, resulting in low accuracy of the final determined video type.
[0004] Therefore, how to accurately classify videos becomes an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present application provide a video type determination method, apparatus, device, and storage medium, which can accurately determine the video type of a video and have high applicability.
[0006] On the one hand, an embodiment of the present application provides a method for determining a video type, the method comprising:
[0007] Determining initial image features of each video frame of the video to be predicted;
[0008] Inputting each of the above initial image features into a video type prediction model to obtain the target type of the above video to be predicted;
[0009] The above video type prediction model is trained based on the following method:
[0010] Determine a training sample set, wherein the training sample set includes at least one sample video;
[0011] Determine each sample video frame of each of the sample videos, determine the initial image sample features and the image segmentation sample features of each of the sample video frames, and determine the target image sample features of the sample video frame based on the initial image sample features and the image segmentation sample features;
[0012] Determine at least one first video frame from each sample video frame of each sample video, and determine a first video sample feature corresponding to the sample video based on a target image sample feature of each first video frame, wherein the first video sample feature represents a probability that an image type of each first video frame belongs to at least one preset image type;
[0013] Inputting each target image sample feature and the first video sample feature corresponding to each of the sample videos into the initial model to obtain a predicted type for each of the sample videos;
[0014] The total training loss is determined based on the actual type and predicted type of each of the above sample videos, and the above initial model is iteratively trained based on the above total training loss and the above training sample set until the training is stopped when the above total training loss meets the training end condition, and the model at the time of stopping the training is determined as the above video type prediction model.
[0015] On the other hand, an embodiment of the present application provides a video type determination device, the device comprising:
[0016] A feature determination module, used to determine the initial image features of each video frame of the video to be predicted;
[0017] A type prediction module, used to input each of the above initial image features into a video type prediction model to obtain the target type of the above video to be predicted;
[0018] The video type prediction model is obtained by training with a model training device, and the model training device is used to:
[0019] Determine a training sample set, wherein the training sample set includes at least one sample video;
[0020] Determine each sample video frame of each of the sample videos, determine the initial image sample features and the image segmentation sample features of each of the sample video frames, and determine the target image sample features of the sample video frame based on the initial image sample features and the image segmentation sample features;
[0021] Determine at least one first video frame from each sample video frame of each sample video, and determine a first video sample feature corresponding to the sample video based on a target image sample feature of each first video frame, wherein the first video sample feature represents a probability that an image type of each first video frame belongs to at least one preset image type;
[0022] Inputting each target image sample feature and the first video sample feature corresponding to each of the sample videos into the initial model to obtain a predicted type for each of the sample videos;
[0023] The total training loss is determined based on the actual type and predicted type of each of the above sample videos, and the above initial model is iteratively trained based on the above total training loss and the above training sample set until the training is stopped when the above total training loss meets the training end condition, and the model at the time of stopping the training is determined as the above video type prediction model.
[0024] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the processor and the memory are connected to each other;
[0025] The memory is used to store computer programs;
[0026] The processor is configured to execute the video type determination method provided in the embodiment of the present application when calling the computer program.
[0027] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the video type determination method provided by the embodiment of the present application.
[0028] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program. When the above computer program is executed by a processor, the video type determination method provided by the embodiment of the present application is implemented.
[0029] In an embodiment of the present application, a target image sample video frame of each sample video frame is obtained based on the image segmentation sample features and the initial image sample features of each sample video frame, so that in the process of training the initial model based on each target sample video frame, the initial model can learn to obtain as much image information of each sample video frame as possible without destroying the original image information of the sample video frame. For each sample video, by involving the first video sample feature of the sample video frame in the training process of the initial model, the initial model can further refer to the probability that the image type of some video frames in the corresponding sample video belongs to at least one preset image type when predicting the video type of each sample video, thereby further improving the effect and accuracy of the video type of the initial model. Therefore, the target type of the video to be predicted can be accurately determined based on the video type prediction model obtained through training, and the applicability is high. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 It is a flowchart of a method for training a video type prediction model provided in an embodiment of the present application;
[0032] Figure 2 is a schematic diagram of a scenario for determining features of an initial image sample provided by an embodiment of the present application;
[0033] Figure 3a This is a schematic diagram of a scenario for determining image segmentation sample features provided by an embodiment of the present application;
[0034] Figure 3b This is another schematic diagram of a scenario for determining image segmentation sample features provided by an embodiment of the present application;
[0035] Figure 4a is a schematic diagram of a scenario for determining target image sample features provided by an embodiment of the present application;
[0036] Figure 4b is another schematic diagram of a scenario for determining target image sample features provided by an embodiment of the present application;
[0037] Figure 5a is a schematic diagram of a scenario for determining features of a first video sample provided by an embodiment of the present application;
[0038] Figure 5b is another schematic diagram of a scenario for determining features of a first video sample provided in an embodiment of the present application;
[0039] Figure 6 It is a structural schematic diagram of the initial model provided in the embodiment of the present application;
[0040] Figure 7 is a flowchart of a method for determining a video type provided in an embodiment of the present application;
[0041] Figure 8 Schematic diagram of the process framework of the video type determination method provided in the embodiment of the present application;
[0042] Fig. 9 is a structural diagram of a video type determination device provided in an embodiment of the present application;
[0043] Fig.10 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] The embodiment of the present application can determine the target type of the video to be predicted based on the video type prediction model. Among them, the video type prediction model in the embodiment of the present application can be applied to various application fields based on the type of video. For example, in the field of video recommendation, the type of videos browsed by the target object can be determined based on the trained video type prediction model, and according to the type of videos browsed by the target object, the target object can be recommended with the same type of videos that may be of interest. For example, the type of each video in the video library can be pre-determined based on the trained video type prediction model, and then when retrieving videos from the video library, the search can be performed according to the video type, thereby improving the efficiency of retrieval accuracy. For example, in the field of video advertising, the type of video advertising can be determined based on the trained video type prediction model, and then advertising videos can be delivered to objects associated with the type, thereby achieving precise and personalized advertising delivery.
[0046] Among them, the video type prediction model and video type determination method provided in the embodiments of the present application can be implemented based on relevant technologies in the fields of artificial intelligence, cloud computing, image processing, etc. For example, the video type prediction model can be obtained by training the machine learning technology in the field of artificial intelligence and the computer vision technology in the field of image processing as the technical basis, and then the video type is predicted based on the video type prediction model.
[0047] Among them, machine learning is a multi-disciplinary interdisciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills, such as training classification models based on machine learning technology. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning and other technologies.
[0048] Among them, computer vision technology generally includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, autonomous driving, smart transportation and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0049] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of a method for training a video type prediction model provided in an embodiment of the present application. Figure 1 As shown, the training method of the video type prediction model provided in the embodiment of the present application may include the following steps:
[0050] Step S11: determine a training sample set, where the training sample set includes at least one sample video.
[0051] In some feasible implementations, short videos on the short video platform can be used as sample videos to construct a training sample set, or multiple film and television dramas can be determined and each film and television drama can be divided into multiple sample videos. The training sample set can also be constructed based on a public video data set. The specific requirements can be determined based on the actual application scenario and are not limited here.
[0052] Each sample video in the training sample set is annotated with a sample label, and each sample label is used to characterize the actual type of the corresponding sample video.
[0053] Among them, the training sample set in the embodiment of the present application can be stored in a server, a database, a cloud storage space or a blockchain, which can be determined based on the actual application scenario requirements and is not limited here. In short, the database can be regarded as an electronic file cabinet-a place for storing electronic files, which can be used to store training sample sets in this application. Blockchain is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, which is a string of data blocks generated by cryptographic methods. In this application, each data block in the blockchain can store a training sample set. Cloud storage is a new concept extended and developed from the concept of cloud computing. It refers to the use of cluster applications, grid technology, and distributed storage file systems. Functions such as file systems bring together a large number of different types of storage devices (storage devices are also called storage nodes) in the network through application software or application interfaces to work together to store training sample sets.
[0054] Step S12: determine each sample video frame of each sample video, determine the initial image sample features and image segmentation sample features of each sample video frame, and determine the target image sample features of the sample video frame based on the initial image sample features and the image segmentation sample features.
[0055] In some feasible implementations, before training based on each training sample in the training sample set, for each sample video, each sample video frame of the sample video may be determined, that is, all video frames in the sample video may be determined as each sample video frame of the sample video. Then, the initial image sample features and image segmentation sample features of each sample video frame may be determined, so as to determine the target image sample features of the sample video frame based on the initial image sample features and the image segmentation sample features.
[0056] That is, when the initial model is trained, the initial model can be trained based on the image segmentation sample features of each sample video frame and the target image sample features of each sample video, and finally a video type prediction model that can predict the type of any video is obtained.
[0057] In some feasible implementations, for each sample video frame, when determining the initial image sample features of the sample video frame, the color features corresponding to each color channel of the sample video frame may be determined. Each sample video frame may include color features corresponding to three color channels: R (red), G (green), and B (blue).
[0058] Furthermore, for each sample video frame, the color features corresponding to each color channel of the sample video frame can be replaced by the color features of the sample video frame corresponding to any other color channel except the color channel, thereby obtaining the initial image sample features of the sample video frame.
[0059] When replacing the color features of the sample video frame corresponding to each color channel, the color features of the sample video frame corresponding to any other color channel can be randomly used to replace the color features of the sample video frame corresponding to the color channel, or the color features of the sample video frame corresponding to the previous color channel can be used to replace the color features corresponding to the next color channel based on a preset order (such as R→B→G).
[0060] It should be noted that the above implementation method of replacing the color feature of any sample video frame corresponding to any color channel is only an example, and the specific method can be determined based on the actual application scenario requirements and is not limited here.
[0061] like Figure 2 As shown, Figure 2 FIG. 1 is a schematic diagram of a scenario for determining features of an initial image sample provided by an embodiment of the present application. Figure 2As shown, if the color features of a sample video frame corresponding to the three color channels of R, G, and B are R1, G1, and B1 respectively, the color feature corresponding to B1 can be used to replace the color feature corresponding to G1 to obtain the color feature G2 of the sample video frame corresponding to the G color channel, the color feature corresponding to G1 can be used to replace the color feature corresponding to R1 to obtain the color feature R2 of the sample video frame corresponding to the R color channel, and the color feature corresponding to R1 can be used to replace the color feature corresponding to B1 to obtain the color feature B2 of the sample video frame corresponding to the B color channel.
[0062] Further, based on the fact that the color features of the sample video frame corresponding to the three color channels of R, G, and B are R2, G2, and B2 respectively, the initial image sample features of the sample video frame can be obtained.
[0063] Optionally, for each sample video frame, when determining the initial image sample features of the sample video frame, the color features of the sample video frame corresponding to any two color channels may be interchanged, and then the initial image sample features of the sample video frame may be obtained based on the color features of the sample video frame that ultimately correspond to each color channel.
[0064] The process of determining the initial image sample features of each sample video frame may also be performed based on the RandomRGB image enhancement mechanism, which will not be described in detail here.
[0065] Based on the initial image sample features obtained in the above manner, the dependence of each element in the sample video frame (such as background elements) on color can be weakened. While changing the color expression of each element in the sample video frame, the information of each element does not change, thereby reducing the impact of color on the model training effect during the model training process and improving the model prediction effect.
[0066] In some feasible implementations, for each sample video frame, when determining the image segmentation sample features of the sample video frame, image segmentation processing can be performed on the sample video frame to obtain an image segmentation result, and then the image segmentation result is determined as the image segmentation sample features of the sample video frame.
[0067] Among them, when performing image segmentation processing on each sample video frame, it can be implemented based on a pre-trained image segmentation model. The pre-trained image segmentation model can be a PointRend model or other models. The specific model can be determined based on the actual application scenario requirements and is not limited here.
[0068] Optionally, for each sample video frame, after performing image segmentation processing on the sample video frame to obtain an image segmentation result, the background elements in the sample video frame can be determined based on the image segmentation result, and then the feature values of each pixel point corresponding to the background elements in the image segmentation result can be replaced with the first value, so that the image segmentation sample features of the sample video frame can be determined based on the first values and the feature values of each pixel point corresponding to the non-background elements in the image segmentation result.
[0069] The first value is a preset value, such as 1, and is not limited here.
[0070] See also Figure 3a , Figure 3a : is a schematic diagram of a scene for determining image segmentation sample features provided by an embodiment of the present application. If an image segmentation result obtained after image segmentation processing is performed on a sample video frame is as follows Figure 3a As shown, when the characteristic value corresponding to each pixel is 0, it indicates that the pixel belongs to the background element in the sample video frame, and when the characteristic value corresponding to each pixel is not 0, it indicates that the pixel belongs to the non-background element in the sample video frame. In this case, the characteristic value (0) of each pixel corresponding to the background element in the sample video frame can be replaced with the first value (such as 1), so that the replaced image segmentation result is determined as the image segmentation sample feature of the sample video frame.
[0071] Optionally, for each sample video frame, after performing image segmentation processing on the sample video frame to obtain an image segmentation result, the background elements in the sample video frame can be determined based on the image segmentation result, and then the feature values of each pixel point corresponding to the background element in the image segmentation result can be replaced with a first value, and the feature values of each pixel point corresponding to the non-background element in the image segmentation result can be replaced with a second value, thereby obtaining the image segmentation sample features of the sample video frame.
[0072] The second value is another preset value that is smaller than the first value, such as 0.5, which is not limited here.
[0073] See also Figure 3b , Figure 3b This is another schematic diagram of a scene for determining image segmentation sample features provided by an embodiment of the present application. For a sample video frame of size H×W×3, the sample video frame is segmented and combed to obtain an image segmentation result of size H×W. Among them, H and W are the height and width of the sample video frame, respectively, and the number of color channels of the sample video frame is 3.
[0074] If the value of each pixel point may be 0, 1, 2 and 3, it means that the pixel point belongs to the background element, human element, object element and text element in the sample video frame respectively. In this case, the feature value 0 in the image segmentation result can be replaced by the first value (such as 1), and the other feature values can be replaced by the second value (such as 0.5), so as to obtain the image segmentation sample features of the sample video frame.
[0075] Based on the above implementation, the image segmentation sample features of each sample video frame are determined, which can enhance the feature values of the pixels belonging to the background elements in the sample video frame and suppress the feature values of the pixels belonging to the non-background elements in the sample video frame.
[0076] Among them, when determining the image segmentation sample features of each sample video frame, each sample video frame can be subjected to image segmentation processing directly based on the color features of each sample video frame corresponding to each color channel, or each sample video frame can be subjected to image segmentation processing based on the initial image sample features of each sample video frame, and then the image segmentation sample features of each sample video frame are determined based on the image segmentation processing results.
[0077] In some feasible implementations, for each sample video frame, after determining the initial image sample features and image segmentation sample features of the sample video frame, data augmentation can be performed on the initial image sample features of the sample video frame based on the image segmentation sample features to obtain the target image sample features of the sample video frame.
[0078] Specifically, for each pixel in each sample video frame, the color feature corresponding to the pixel in the initial image sample feature and the feature value corresponding to the pixel in the image segmentation sample feature may be multiplied to obtain the target sample feature corresponding to the pixel. After determining the target sample feature corresponding to each pixel in the sample video frame, the target image sample feature of the sample video frame may be determined based on the target sample feature corresponding to each pixel in the sample video frame.
[0079] That is, based on the above method, the feature value of each pixel corresponding to the image segmentation sample feature is multiplied by the color feature of each color channel corresponding to the initial image sample feature, and the final result is determined as the target image sample feature of the sample video frame.
[0080] Optionally, for each sample video frame, when multiplying the feature value of each pixel corresponding to the image segmentation sample feature with the color feature of each color channel corresponding to the initial image sample feature, each pixel can also be multiplied by a preset weight, thereby achieving image perturbation of non-background elements and improving training efficiency.
[0081] The preset weights may be determined based on actual application scenario requirements, such as any value in the range of 0.3 to 0.7, and the preset weights corresponding to the pixels of each non-background element in each sample video frame are the same.
[0082] See also Figure 4a , Figure 4a is a schematic diagram of a scenario for determining target image sample features provided by an embodiment of the present application. The initial image sample features and image segmentation sample features of a sample video frame are as follows: Figure 4a If the feature value of the image segmentation sample feature corresponding to the sample video frame is 1, it means that the pixel point belongs to the background element in the sample video frame, and the feature value is 0.5, it means that the pixel point belongs to the non-background element in the sample video frame. Figure 4a In the initial image sample features shown, the color features corresponding to the pixel points belonging to the background elements in the sample video frame are (4, 5, 3), and the color features corresponding to the pixel points belonging to the non-background elements in the sample video frame are (2, 4, 6).
[0083] Furthermore, for each pixel point in the sample video frame that is a background element, the color feature corresponding to the pixel point in the initial image sample feature can be multiplied by 1 to obtain (4, 5, 3). For each pixel point in the sample video frame that is a non-background element, the color feature corresponding to the pixel point in the initial image sample feature can be multiplied by 0.5 to obtain (1, 2, 3). Thus, based on the new color features corresponding to each pixel point in the sample video frame, the target image sample feature corresponding to the sample video frame can be obtained.
[0084] Based on the above implementation method, the background elements in the sample video frame can be strengthened and the non-background elements can be weakened based on the image segmentation sample features, thereby reducing the model's dependence on non-background elements during the training process.
[0085] Optionally, for each sample video frame, when determining the target image sample features of the sample video frame, the initial image sample features and the image segmentation sample features of the sample video frame may be spliced to obtain a first splicing feature, and then the first splicing feature may be determined as the target image sample feature of the sample video frame.
[0086] That is, for each pixel of a sample video frame, the color feature of the initial image sample feature corresponding to the pixel and the feature value of the image segmentation sample feature corresponding to the pixel can be spliced to obtain the spliced feature corresponding to the pixel. Then, the target image sample feature of the sample video frame can be obtained based on the spliced features of each pixel.
[0087] For example, if the number of channels of the initial image sample feature of a sample video frame is 3 (corresponding to three color channels of R, G, and B), and the image segmentation sample feature of the sample video frame is a single channel, then the initial image sample feature and the image segmentation sample feature of the sample video frame are spliced to obtain a first spliced feature of 4 channels, and the first spliced feature is used as the target image sample feature of the sample video frame.
[0088] See also Figure 4b , Figure 4b is another schematic diagram of a scenario for determining target image sample features provided by an embodiment of the present application. For example, the initial image sample features and image segmentation sample features of a video frame are as follows: Figure 4b If the feature value of the image segmentation sample feature corresponding to the sample video frame is 1, it means that the pixel point belongs to the background element in the sample video frame, and the feature value is 0.5, it means that the pixel point belongs to the non-background element in the sample video frame. Figure 4b In the initial image sample features shown, the color features corresponding to the pixel points belonging to the background elements in the sample video frame are (4, 5, 3), and the color features corresponding to the pixel points belonging to the non-background elements in the sample video frame are (2, 4, 6).
[0089] Furthermore, for each pixel point in the sample video frame that is a background element, the color feature corresponding to the pixel point in the initial image sample feature and the feature value 1 can be concatenated to obtain (4,5,3,1). For each pixel point in the sample video frame that is a non-background element, the color feature corresponding to the pixel point in the initial image sample feature and the feature value 0.5 can be concatenated to obtain (2,4,6,0.5). Thus, based on the new features corresponding to each pixel point in the sample video frame, the target image sample features corresponding to the sample video frame can be obtained.
[0090] Step S13: determining at least one first video frame from each sample video frame of each sample video, and determining first video sample features corresponding to the sample video based on target image sample features of each first video frame.
[0091] In some feasible implementations, after determining the initial image sample features and image segmentation sample features of each sample video frame, for each sample video, the sample video can be subjected to frame extraction processing to determine some sample video frames (hereinafter referred to as first video frames for the convenience of description) from all the sample video frames of the sample video frame, and then based on the target image sample features of each first video frame of the sample video, the first video sample features corresponding to the sample video are determined for participating in the training process of the video type prediction model.
[0092] For each sample video, the first video sample feature corresponding to the sample video represents the probability that each first video frame in the sample video belongs to at least one preset image type.
[0093] Specifically, for each sample video, the target image sample features of each first video frame of the sample video may be input into a pre-trained image type prediction network to obtain the predicted distribution features corresponding to each first video frame.
[0094] The predicted distribution feature corresponding to each first video frame is a 1×m feature vector, where m is the number of preset image types, and one of the feature values is used to characterize the probability that the image type of the first video frame belongs to the preset image type corresponding to the feature value. The larger a certain feature value in the predicted distribution feature corresponding to the first video frame is, the greater the probability that the image type of the first video frame belongs to the preset image type corresponding to the feature is.
[0095] Furthermore, each feature value in the predicted distribution feature corresponding to each first video frame is arranged vertically according to the probability from large to small to obtain a feature value sequence, and then a preset number of feature values are intercepted from each feature value sequence as the target distribution feature corresponding to each predicted distribution feature.
[0096] That is, for each first video frame, the maximum probability of a preset number of probabilities indicating that the image type of the first video frame belongs to the corresponding preset image type in the predicted distribution feature corresponding to the first video frame can be used as the target distribution feature corresponding to the first video frame.
[0097] The target distribution feature corresponding to each first video frame is a feature vector of 1×h, where h is a preset number and h is less than m.
[0098] Furthermore, the target distribution features corresponding to the first video frames may be concatenated to obtain the first video sample features corresponding to the sample video. The first video sample features corresponding to the sample video are k×h feature vectors, where k is the number of first video frames.
[0099] See also Figure 5a , Figure 5a is a schematic diagram of a scenario for determining the features of a first video sample provided by an embodiment of the present application. Figure 5a As shown in the figure, if four first video frames are extracted from a sample video, the target image sample features of each first video frame can be output to the pre-trained image type prediction network to obtain the predicted distribution features corresponding to each first video frame. For each first video frame, the image type prediction network can process the target image sample features of the first video frame through the feature processing network, and input the processed features into the softmax layer to obtain the predicted distribution features corresponding to the first video frame.
[0100] The predicted distribution feature corresponding to each first video frame is a 1×5 feature vector, which is used to characterize the probability that the image type of the first video frame belongs to five preset image types.
[0101] Further, the eigenvalues in each predicted distribution feature (each eigenvector) are arranged vertically in descending order to obtain a new eigenvalue sequence, and a preset number (such as 3) of eigenvalues are intercepted from each eigenvalue sequence as the target distribution feature corresponding to each predicted distribution feature. Thus, each target distribution feature can be input into the fully connected layer to splice each target distribution feature to obtain the first video sample feature corresponding to the sample video.
[0102] Optionally, when determining the first video sample features corresponding to each sample video, after determining the prediction distribution features corresponding to each first video frame, the prediction distribution features may be spliced to obtain k×m prediction distribution splicing features. Then, for each column of the prediction distribution splicing features, the feature values of the column are sorted vertically from large to small, and a preset number of h feature values are selected, so as to obtain k×h target distribution features based on the k×m prediction distribution splicing features.
[0103] See also Figure 5b , Figure 5b FIG. 1 is another schematic diagram of a scenario for determining the features of a first video sample provided by an embodiment of the present application. Figure 5b As shown in the figure, if four first video frames are extracted from a sample video, the target image sample features of each first video frame can be output to the pre-trained image type prediction network to obtain the predicted distribution features corresponding to each first video frame. For each first video frame, the image type prediction network can process the target image sample features of the first video frame through the feature processing network, and input the processed features into the softmax layer to obtain the predicted distribution features corresponding to the first video frame.
[0104] The predicted distribution feature corresponding to each first video frame is a 1×5 feature vector, which is used to characterize the probability that the image type of the first video frame belongs to five preset image types.
[0105] Each predicted distribution feature is further input into the fully connected layer to splice each predicted distribution feature to obtain the predicted distribution splicing feature corresponding to the sample video. The feature values of each column in the predicted distribution splicing feature are further arranged vertically in descending order to obtain a new feature value sequence, and a preset number (such as 3) of feature values are intercepted from each feature value sequence to obtain the first video sample feature corresponding to the sample video.
[0106] Among them, the above-mentioned preset image types may include a first preset type, also called a negative type, which is used to characterize an image type of an image that does not include any scene, such as an image type of an image composed of one or more colors, an image type of an image including promotional information, etc.
[0107] For each first video frame in each sample video, the predicted distribution feature corresponding to the first video frame may include a probability that the first video frame belongs to a first preset type. When the actual image type of the first video frame is the first preset type, the target distribution feature corresponding to the first video frame may include a feature value for characterizing the probability that the first video frame belongs to the first preset type.
[0108] Based on this, for each sample video, if the first sample video includes a first video frame belonging to a first preset type, the first video sample feature corresponding to the first sample video may include a feature value used to characterize the probability that the first video frame belongs to the first preset type, thereby further improving the feature expression of the first video sample feature corresponding to the sample video, so that the first video sample feature has higher feature generalization, thereby further improving the model training effect in the process of training the initial model.
[0109] Optionally, after obtaining the first video sample feature corresponding to the sample video based on any of the above implementation methods, it can be temporarily used as the initial video sample feature, and then processed through a pooling layer (such as an average pooling layer), and the pooling result is used as the first video sample feature that finally corresponds to the sample video.
[0110] In an embodiment of the present application, the pre-trained image type prediction network can process the target image sample features of each first video frame based on the backbone network, and input the processed features into the softmax layer to obtain the predicted distribution features corresponding to the first video frame. Among them, the backbone network in the image type prediction network can be an EfficientNet-B4 network, or it can be other neural networks for predicting image types, which are not limited here.
[0111] Step S14: Input the target image sample features and the first video sample features corresponding to each sample video into the initial model to obtain the predicted type of the sample video.
[0112] In some feasible implementations, each time the initial model is trained, the target image sample features and the first video sample features of all sample video frames corresponding to each sample video can be input into the initial model, and then the target image sample features and image-level scene samples corresponding to each sample video are processed by the initial model to obtain the predicted type of the sample video.
[0113] Specifically, for each sample video, after the target image sample features of all sample video frames of the sample video and the first video sample features of the sample video are input into the initial model, the initial model can first perform feature processing on all corresponding target image sample features of the sample video to obtain the second video sample features corresponding to the sample video.
[0114] For each sample video, the second video sample feature corresponding to the sample video represents the video content of the sample video, that is, the second video sample feature corresponding to the sample video can be regarded as the video content feature of the sample video.
[0115] Among them, the initial model can be based on any feature processing network that has the function of performing feature processing on all target image sample features corresponding to the sample video to obtain second video sample features corresponding to the sample video. The specific network structure is not limited here.
[0116] Furthermore, the initial model can concatenate the second video sample features and the first video sample features corresponding to the sample video to obtain the target scene sample features corresponding to the sample video. Based on the target scene features corresponding to the sample video, the probability that the video type of the sample video belongs to each preset video type is obtained, and based on the probability that the video type of the sample video belongs to each preset video type, the predicted type of the sample video is determined.
[0117] See also Figure 6 , Figure 6 Schematic diagram of the structure of the initial model provided in the embodiment of the present application. Figure 6 As shown, for each sample video, after the target image sample features of all sample video frames of the sample video and the first video sample features of the sample video are input into the initial model, the initial model can first perform feature processing on all corresponding target image sample features of the sample video through a feature processing network to obtain the second video sample features corresponding to the sample video.
[0118] Furthermore, the initial model can concatenate the second video sample features and the first video sample features corresponding to the sample video to obtain the target scene sample features corresponding to the sample video. The initial model can process the target scene sample features based on the NeXtVLAD network, and enhance the processing results through an attention module (such as an SE gating module) to make the initial model pay more attention to the channel features with more information while obtaining the final features to be predicted, and suppress the unimportant channel features.
[0119] Among them, taking the SE gating module as an example, it can perform a Squeeze operation on the processing results of the NeXtVLAD network to obtain channel-level global features, and then perform an Excitation operation on the global features to learn the relationship between each channel and obtain the weights corresponding to different channels. Finally, it multiplies the processing results obtained by the original video classification network to obtain the final features to be predicted.
[0120] Furthermore, based on the features to be predicted that are finally obtained, the probability that the video type of the sample video belongs to each preset video type can be obtained through a multi-label classifier (Multi-labelClassification), and then based on the probability that the video type of the sample video belongs to each preset video type, the predicted type of the sample video is determined.
[0121] Step S15: determine the total training loss based on the actual type and predicted type of each sample video, iteratively train the initial model based on the total training loss and the training sample set, and stop training when the total training loss meets the training end condition, and determine the model at the time of stopping training as the video type prediction model.
[0122] In some feasible implementations, after determining the total training loss corresponding to training the initial model, the initial model can be iteratively trained based on the total training loss and the training sample set until the total training loss meets the training end condition.
[0123] Among them, the above-mentioned training end condition can be that the total training loss reaches convergence, or the total training loss for a consecutive preset number of times is less than a preset threshold, or the difference between two consecutive total training losses for a consecutive preset number of times is less than a preset threshold, etc. The specific conditions can be determined based on the actual application scenario requirements and are not limited here.
[0124] For each training, the training is stopped when the total training loss meets the training end condition, and the initial model at the end of the training is determined as the final video type prediction model. If the total training loss does not meet the training end condition during the training of the initial model, the relevant parameters of the initial model and the pre-trained convolutional network can be adjusted, and after the adjustment, training is performed again based on the above method and the total training loss is determined, until the total training loss meets the training end condition and the training is stopped.
[0125] In some feasible implementations, for each sample video frame, if the target image sample features of the sample video frame are obtained by splicing the initial image sample features and the image segmentation sample features of the sample video frame, then before inputting the target image sample features corresponding to each sample video into the initial model to train the initial model, the target image sample features corresponding to each sample video frame can be first input into a pre-trained convolutional network, and the target image sample features of each sample video frame are processed by the convolutional network to obtain the fused sample features corresponding to the sample video frame.
[0126] Based on this, without destroying the target image sample features of each sample video frame, the image segmentation sample features of the sample video frame are fused with the target image sample features, thereby further improving the model training effect.
[0127] For example, if the number of channels of the initial image sample features of a sample video frame is 3 (corresponding to the three color channels of R, G, and B), and the image segmentation sample features of the sample video frame are single-channel, then the initial image sample features and the image segmentation sample features of the sample video frame are concatenated to obtain a 4-channel target image sample feature.
[0128] The sample video frame can be further input into the pre-trained convolutional network for the fused sample features of the 4 channels, so that for each sample video, the fused sample features corresponding to all sample video frames of the sample video and the corresponding first video sample features can be input into the initial model to obtain the predicted type of the sample video.
[0129] The above-mentioned pre-trained convolutional network can be trained based on the initial model. That is, for each sample video frame, if the target image sample feature of the sample video frame is obtained by splicing the initial image sample feature and the image segmentation sample feature of the sample video frame, then before inputting the target image sample features corresponding to each sample video into the initial model to train the initial model, the target image sample features corresponding to each sample video frame can be first input into the initial convolutional network (such as a 1*1 initial convolutional layer), and the target image sample features of each sample video frame are processed by the initial convolutional network to obtain the fused sample features corresponding to the sample video frame.
[0130] Furthermore, for each sample video, the first video sample features corresponding to the sample video and the fused sample features corresponding to all sample video frames can be input into the initial model, and the prediction type of the sample video can be determined by the initial model, and the total training loss can be determined based on the prediction type and the actual type of the sample video. Therefore, the initial convolutional network can be iteratively trained based on the total training loss and the training sample set, that is, when the total training loss does not meet the training end condition, the relevant parameters of the initial convolutional network are adjusted, and when the total training loss converges, the iterative training of the initial convolutional network is stopped to obtain a pre-trained convolutional network.
[0131] In the training method of the video type prediction model provided in the embodiment of the present application, by swapping the color features of each sample video frame corresponding to each color channel and fusing the image segmentation sample features of the sample video frame with the initial image sample features, the background elements in the sample video frame can be strengthened and the non-background elements can be suppressed without destroying the original image information of the sample video frame, thereby reducing the influence of background elements and color factors on model training, so that the trained video type prediction model can improve the prediction effect and accuracy of the video type without relying on color and background, and further improve the generalization ability of the model. At the same time, based on the image segmentation sample features and initial image sample features of each sample video frame, the target image sample video frame of each sample video frame is obtained, so that in the process of training the initial model based on each target sample video frame, the initial model can learn as much as possible to obtain the image information of each sample video frame without destroying the original image information of the sample video frame. For each sample video, by involving the first video sample features and the second video sample features of the sample video frame in the training process of the initial model, the initial model can further refer to the complete video features of the corresponding sample video and the probability that the image type of some video frames belongs to at least one preset image type when predicting the video type of each sample video, thereby further improving the video type effect and accuracy of the initial model.
[0132] See also Figure 7 , Figure 7 It is a flowchart of a method for determining a video type provided in an embodiment of the present application.
[0133] like Figure 7 As shown, the video type determination method provided in the embodiment of the present application may include the following steps:
[0134] Step S71: Determine the initial image features of each video frame of the video to be predicted.
[0135] Step S72: Input each initial image feature into a video type prediction model to obtain a target type of the video to be predicted.
[0136] Among them, the above video type prediction model is based on Figure 1 The video type prediction model training method shown is trained.
[0137] Optionally, in order to obtain a more accurate video type of the video to be predicted, Figure 1 The method of determining the initial image sample features shown in step S12 determines the initial image features of each video frame, and the target image features of each video frame of the video to be predicted are determined based on the method of determining the target image sample features shown in step S12.
[0138] Further, at least one second video frame can be determined from the video to be predicted, and based on Figure 1 The method of determining the first video sample feature shown in step S13 determines the first video feature corresponding to the video to be predicted based on the target image feature of each second video frame. Thus, the target image feature of each video frame of the video to be predicted and the first video feature of the video to be predicted can be input into the video type prediction model to obtain the target type of the video to be predicted.
[0139] The specific implementation method of the video type prediction model to determine the target type of the video to be predicted can be based on Figure 1 The implementation method of determining the prediction type of any sample video by the initial model shown will not be repeated here.
[0140] Combine the following Figure 8 The video type determination method provided in the embodiment of the present application is further described. Figure 8 As shown, Figure 8 It is a schematic diagram of the process framework of the video type determination method provided in an embodiment of the present application.
[0141] exist Figure 8 In the process, the video publishing object obtains the interface address of the interface server through the mobile terminal or the back-end application programming interface (Application Programming Interface, API), and provides the video source file to the interface server. Before providing the video source file, the corresponding video content can be matched with music, optimized content, etc. The video consumption object can obtain the index information for accessing the video file from the interface server by calling the central server, such as the download address, and then obtain the video source file according to the index information to watch the video. In the process of providing the video source file and the process of the video consumption object obtaining the video source file, the video loading data (such as loading time) and object behavior data (such as click operation data, playback operation data, etc.) can be reported.
[0142] The video publishing object may be a content producer (Professional Generated Content, PGC), and the video source file may be original content, such as user generated content (User Generated Content, UCG), which is not limited here. The uploading and downloading of the video source file may be realized in the form of feeds stream.
[0143] For the interface server, it can communicate directly with the video publishing object, write the video metadata of the video file published by the video publishing object into the database, and upload the video source file to the scheduling center to realize the processing and circulation of the video content through the scheduling server of the scheduling center.
[0144] For the database, the metadata of the video source files published by all video publishing objects can be stored, such as the size of the video source files, related links (such as download links, cover image links, etc.), video bit rate, video format, video title, release time, author, originality, video classification and other related information. Among them, the relevant information of video classification may include multi-level types and corresponding label information. For example, the multi-level types of a mobile phone evaluation video may include technology, smart phones and mobile phone models.
[0145] The meta information of the video source file can be obtained by the interface server after receiving the video source file, performing a transcoding operation on the video source file, and asynchronously returning the meta information to the database after the transcoding is completed.
[0146] For the dispatch center, the dispatch center can call the reordering service to reorder the video source files with duplicate and similar content, so that the reordering results can be written into the database, and the video source files with duplicate video content can be sent to the manual review system, which will review them and return the review results to the database.
[0147] Among them, the dispatch center reviews the complete dispatch process of the video source file, such as obtaining the video source file published by the video publishing object through the interface server, and can obtain the metadata of the video source file from the database.
[0148] Among them, the dispatch center can call the manual review system to control the dispatch order and priority of the video source files, and can filter the video source files with repeated video content.
[0149] Among them, the dispatching center can distribute videos to video consumers through the relevant servers of the distribution export service based on the recommendation engine or search engine or the direct display page of the operation.
[0150] Among them, for the video source files that have not been repeatedly filtered, the dispatch center can output the content similarity and similarity relationship chain between the video source files to the relevant servers of the distribution export service for the recommendation system to break up and use;
[0151] Among them, the dispatch center can be responsible for the communication of the video type determination service and complete the video type determination and dispatch processing.
[0152] For a manual review system, the manual review system can read the original information of the video content of the video source file, and perform preliminary filtering on the video source file based on a preset screening method, such as performing preliminary filtering on the video source file including preset content and preset keywords.
[0153] Based on the preliminary filtering, the video content and type labels of the video source files can be confirmed to improve the accuracy of the type classification and type labels of the video source files.
[0154] For duplicate removal services, the video source files can be vectorized through the re-ranking server, and then a vector index is established and the similarity between the video source files is determined through the similarity between the vectors.
[0155] For the video download system, it can be a group of parallel servers or a related task scheduling and distribution cluster, which can download the original video source file from the related server of the video storage service and control the speed and progress of the download. At the same time, the sample video in the sample video can be subjected to frame extraction and other operations to determine the first video sample features corresponding to each sample video.
[0156] The sample database can be used as a database for storing sample videos during the training process of the video type prediction model. It may include target image sample features of each sample video and all video frames of each sample video, that is, target image sample features after image enhancement of each video frame, and then the initial model is trained based on the sample database to obtain the video type prediction model.
[0157] For video storage services, it can use CDN acceleration servers to perform distributed caching acceleration to store video source files published by video publishing objects through interface services. It can also provide corresponding video source files to video consumption objects based on the index information of the video source files provided by the video consumption objects, and can also provide data support for video source files for internal video processing operations.
[0158] For the video type determination service, it can serve the video type prediction model, communicate with the dispatch center to complete the determination of the video type of the video source file in the video flow link, and store the relevant results in the database as part of the metadata of the video source file.
[0159] The video type prediction model trained by the video type prediction model training method provided in the embodiment of the present application can determine the types of videos generated by self-media platforms, video streams, self-media communities, etc., and can also be applied to intelligent traffic systems (ITS) or intelligent vehicle infrastructure cooperative systems (IVICS) to determine the types of driving video clips of vehicles or pedestrians, so as to judge the driving environment or traffic safety of vehicles or pedestrians.
[0160] Among them, the intelligent transportation system, also known as the intelligent transportation system (Intelligent Transportation System), effectively and comprehensively applies advanced science and technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operations research, artificial intelligence, etc.) to transportation, service control and vehicle manufacturing, and strengthens the connection between vehicles, roads and users. Intelligent vehicle-road cooperative system, referred to as vehicle-road cooperative system, is a development direction of intelligent transportation system (ITS). The vehicle-road cooperative system adopts advanced wireless communication and new generation Internet technologies to implement dynamic real-time information interaction between vehicles and roads in all directions, and carries out active vehicle safety control and road cooperative management based on the collection and integration of dynamic traffic information in all time and space, so as to fully realize the effective coordination of people, vehicles and roads.
[0161] See also Fig. 9 , Fig. 9 : is a schematic diagram of the structure of a video type determination device provided in an embodiment of the present application. The video type determination device provided in an embodiment of the present application includes:
[0162] A feature determination module 91, used to determine the initial image features of each video frame of the video to be predicted;
[0163] A type prediction module 92, used for inputting each of the above initial image features into a video type prediction model to obtain the target type of the above video to be predicted;
[0164] The video type prediction model is obtained by training with a model training device, and the model training device is used to:
[0165] Determine a training sample set, wherein the training sample set includes at least one sample video;
[0166] Determine each sample video frame of each of the sample videos, determine the initial image sample features and the image segmentation sample features of each of the sample video frames, and determine the target image sample features of the sample video frame based on the initial image sample features and the image segmentation sample features;
[0167] Determine at least one first video frame from each sample video frame of each sample video, and determine a first video sample feature corresponding to the sample video based on a target image sample feature of each first video frame, wherein the first video sample feature represents a probability that an image type of each first video frame belongs to at least one preset image type;
[0168] Inputting each target image sample feature and the first video sample feature corresponding to each of the sample videos into the initial model to obtain a predicted type for each of the sample videos;
[0169] The total training loss is determined based on the actual type and predicted type of each of the above sample videos, and the above initial model is iteratively trained based on the above total training loss and the above training sample set until the training is stopped when the above total training loss meets the training end condition, and the model at the time of stopping the training is determined as the above video type prediction model.
[0170] In some feasible implementations, for each of the sample video frames, the model training device is used to:
[0171] Determine the color features of each color channel corresponding to the sample video frame;
[0172] The color feature of the sample video frame corresponding to each of the above color channels is replaced by the color feature of the sample video frame corresponding to any other color channel except the color channel, so as to obtain the initial image sample feature of the sample video frame.
[0173] In some feasible implementations, for each of the sample video frames, the model training device is used to:
[0174] Performing image segmentation processing on the sample video frame to obtain an image segmentation result;
[0175] The characteristic value of each pixel point corresponding to the background element in the above image segmentation result is replaced with the first value, and the image segmentation sample feature of the sample video frame is determined based on the above first values and the characteristic value of each pixel point corresponding to the non-background element in the above image segmentation result.
[0176] In some feasible implementations, for each of the sample video frames, the model training device is used to:
[0177] Replacing the feature value of each pixel point corresponding to the non-background element in the above image segmentation result with the second value;
[0178] The image segmentation sample features of the sample video frame are based on the first values and the second values.
[0179] In some feasible implementations, for each of the sample video frames, the model training device is used to:
[0180] For each pixel point of the sample video frame, multiply the color feature corresponding to the pixel point in the above-mentioned initial image sample feature by the feature value corresponding to the pixel point in the above-mentioned image segmentation sample feature to obtain the target sample feature corresponding to the pixel point, and determine the target image sample feature of the sample video frame based on the target sample features corresponding to each pixel point of the sample video frame;
[0181] The initial image sample feature and the image segmentation sample feature are spliced to obtain a first splicing feature, and the first splicing feature is determined as the target image sample feature of the sample video frame.
[0182] In some feasible implementations, the target image sample features of each of the sample video frames are obtained by concatenating the initial image sample features and the image segmentation sample features of the sample video frame, and the model training device is used to:
[0183] Processing the target image sample features of each of the sample video frames based on the pre-trained convolutional network to obtain fused sample features corresponding to each of the sample video frames;
[0184] The fused sample features and the first video sample features corresponding to each of the sample videos are input into the initial model to obtain the predicted type of each of the sample videos.
[0185] In some feasible implementations, for each of the sample videos, the model training device is used to:
[0186] Inputting the target image sample features of each first video frame corresponding to the sample video into a pre-trained image type prediction network to obtain prediction distribution features corresponding to each of the above first video frames, wherein a feature value in each of the above prediction distribution features is used to represent the probability that the image type corresponding to the first video frame belongs to the preset image type corresponding to the feature value;
[0187] The characteristic values in each of the above-mentioned predicted distribution features are arranged in order from large to small to obtain a characteristic value sequence, and a preset number of characteristic values are intercepted from the above-mentioned characteristic value sequence as the target distribution feature corresponding to the predicted distribution feature. Based on the target distribution features corresponding to each of the above-mentioned first video frames, the first video sample feature corresponding to the sample video is determined.
[0188] In some feasible implementations, the initial model determines the prediction type of each of the videos based on the following method:
[0189] Determine, based on each target image sample feature corresponding to the sample video, a second video sample feature corresponding to the sample video, wherein the second video sample feature represents the video content of the sample video;
[0190] Splicing the second video sample feature and the first video sample feature corresponding to the sample video to obtain the target scene sample feature corresponding to the sample video;
[0191] The prediction type of the sample video is determined based on the above target scene sample features.
[0192] In a specific implementation, the above-mentioned model training device can execute the above-mentioned Figure 1 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0193] See also Fig.10 , Fig.10 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Fig.10 As shown, the electronic device 1000 in this embodiment may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned electronic device 1000 may also include: an object interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the object interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the object interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1004 may be a high-speed RAM memory, or it may be a non-volatile memory (NVM), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Fig.10 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, an object interface module, and a device control application program.
[0194] exist Fig.10 In the electronic device 1000 shown, the network interface 1004 can provide a network communication function; the object interface 1003 is mainly used to provide an input interface for the object; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0195] Determining initial image features of each video frame of the video to be predicted;
[0196] Inputting each of the above initial image features into a video type prediction model to obtain the target type of the above video to be predicted;
[0197] The video type prediction model is obtained by training the processor 1001 based on the following method:
[0198] Determine a training sample set, wherein the training sample set includes at least one sample video;
[0199] Determine each sample video frame of each of the sample videos, determine the initial image sample features and the image segmentation sample features of each of the sample video frames, and determine the target image sample features of the sample video frame based on the initial image sample features and the image segmentation sample features;
[0200] Determine at least one first video frame from each sample video frame of each sample video, and determine a first video sample feature corresponding to the sample video based on a target image sample feature of each first video frame, wherein the first video sample feature represents a probability that an image type of each first video frame belongs to at least one preset image type;
[0201] Inputting each target image sample feature and the first video sample feature corresponding to each of the sample videos into the initial model to obtain a predicted type for each of the sample videos;
[0202] The total training loss is determined based on the actual type and predicted type of each of the above sample videos, and the above initial model is iteratively trained based on the above total training loss and the above training sample set until the training is stopped when the above total training loss meets the training end condition, and the model at the time of stopping the training is determined as the above video type prediction model.
[0203] In some feasible implementations, for each of the sample video frames, the processor 1001 is configured to:
[0204] Determine the color features of each color channel corresponding to the sample video frame;
[0205] The color feature of the sample video frame corresponding to each of the above color channels is replaced by the color feature of the sample video frame corresponding to any other color channel except the color channel, so as to obtain the initial image sample feature of the sample video frame.
[0206] In some feasible implementations, for each of the sample video frames, the processor 1001 is configured to:
[0207] Performing image segmentation processing on the sample video frame to obtain an image segmentation result;
[0208] The characteristic value of each pixel point corresponding to the background element in the above image segmentation result is replaced with the first value, and the image segmentation sample feature of the sample video frame is determined based on the above first values and the characteristic value of each pixel point corresponding to the non-background element in the above image segmentation result.
[0209] In some feasible implementations, for each of the sample video frames, the processor 1001 is configured to:
[0210] Replacing the feature value of each pixel point corresponding to the non-background element in the above image segmentation result with the second value;
[0211] The image segmentation sample features of the sample video frame are based on the first values and the second values.
[0212] In some feasible implementations, for each of the sample video frames, the processor 1001 is configured to:
[0213] For each pixel point of the sample video frame, multiply the color feature corresponding to the pixel point in the above-mentioned initial image sample feature by the feature value corresponding to the pixel point in the above-mentioned image segmentation sample feature to obtain the target sample feature corresponding to the pixel point, and determine the target image sample feature of the sample video frame based on the target sample features corresponding to each pixel point of the sample video frame;
[0214] The initial image sample feature and the image segmentation sample feature are spliced to obtain a first splicing feature, and the first splicing feature is determined as the target image sample feature of the sample video frame.
[0215] In some feasible implementations, the target image sample features of each of the sample video frames are obtained by concatenating the initial image sample features and the image segmentation sample features of the sample video frame, and the processor 1001 is used to:
[0216] Processing the target image sample features of each of the sample video frames based on the pre-trained convolutional network to obtain fused sample features corresponding to each of the sample video frames;
[0217] The fused sample features and the first video sample features corresponding to each of the sample videos are input into the initial model to obtain the predicted type of each of the sample videos.
[0218] In some feasible implementations, for each of the sample video frames, the processor 1001 is configured to:
[0219] Inputting the target image sample features of each first video frame corresponding to the sample video into a pre-trained image type prediction network to obtain prediction distribution features corresponding to each of the above first video frames, wherein a feature value in each of the above prediction distribution features is used to represent the probability that the image type corresponding to the first video frame belongs to the preset image type corresponding to the feature value;
[0220] The characteristic values in each of the above-mentioned predicted distribution features are arranged in order from large to small to obtain a characteristic value sequence, and a preset number of characteristic values are intercepted from the above-mentioned characteristic value sequence as the target distribution feature corresponding to the predicted distribution feature. Based on the target distribution features corresponding to each of the above-mentioned first video frames, the first video sample feature corresponding to the sample video is determined.
[0221] In some feasible implementations, the initial model determines the prediction type of each of the videos based on the following method:
[0222] Determine, based on each target image sample feature corresponding to the sample video, a second video sample feature corresponding to the sample video, wherein the second video sample feature represents the video content of the sample video;
[0223] Splicing the second video sample feature and the first video sample feature corresponding to the sample video to obtain the target scene sample feature corresponding to the sample video;
[0224] The prediction type of the sample video is determined based on the above target scene sample features.
[0225] It should be understood that in some feasible implementations, the processor 1001 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0226] In a specific implementation, the electronic device 1000 can execute the above-mentioned functions through its built-in functional modules. Figure 1 and / or Figure 7 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0227] The present application also provides a computer-readable storage medium, which stores a computer program and is executed by a processor to implement Figure 1 and / or Figure 7 For the methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0228] The computer-readable storage medium may be an internal storage unit of the device or electronic device provided in any of the aforementioned embodiments, such as a hard disk or memory of an electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the electronic device. The computer-readable storage medium may also include a magnetic disk, an optical disk, a read-only memory (read-only memory, ROM) or a random access memory (random access memory, RAM), etc. Further, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0229] The present invention provides a computer program product, which includes a computer program. The computer program is executed by a processor. Figure 1 and / or Figure 7 The methods provided in each step.
[0230] The terms "first", "second", etc. in the claims, specification and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or electronic device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or electronic devices. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. Displaying the phrase at various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and / or" used in the present application specification and the attached claims refers to any combination of one or more of the items listed in association and all possible combinations, and includes these combinations.
[0231] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0232] The above disclosure is only the preferred embodiment of the present application, which cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for determining a video type, It is characterized in that The method comprises: Determining initial image features of each video frame of the video to be predicted; Inputting each of the initial image features into a video type prediction model to obtain a target type of the video to be predicted; The video type prediction model is trained based on the following method: Determine a training sample set, wherein the training sample set includes at least one sample video; Determine each sample video frame of each of the sample videos, determine an initial image sample feature and an image segmentation sample feature of each of the sample video frames, and determine a target image sample feature of the sample video frame based on the initial image sample feature and the image segmentation sample feature; Determine at least one first video frame from each sample video frame of each sample video, and determine a first video sample feature corresponding to the sample video based on a target image sample feature of each first video frame, wherein the first video sample feature represents a probability that an image type of each first video frame belongs to at least one preset image type; Inputting each target image sample feature and the first video sample feature corresponding to each sample video into the initial model to obtain a predicted type of each sample video; The total training loss is determined based on the actual type and predicted type of each of the sample videos, and the initial model is iteratively trained based on the total training loss and the training sample set until the training is stopped when the total training loss meets the training end condition, and the model at the time of stopping the training is determined as the video type prediction model.
2. The method according to claim 1, It is characterized in that For each of the sample video frames, determining the initial image sample features of the sample video frame includes: Determine the color features of each color channel corresponding to the sample video frame; The color feature of the sample video frame corresponding to each color channel is replaced by the color feature of the sample video frame corresponding to any other color channel except the color channel, so as to obtain the initial image sample feature of the sample video frame.
3. The method according to claim 1, It is characterized in that For each of the sample video frames, determining the image segmentation sample features of the sample video frame comprises: Performing image segmentation processing on the sample video frame to obtain an image segmentation result; The characteristic value of each pixel point corresponding to the background element in the image segmentation result is replaced with a first value, and the image segmentation sample feature of the sample video frame is determined based on the first values and the characteristic value of each pixel point corresponding to the non-background element in the image segmentation result.
4. The method according to claim 3, It is characterized in that For each of the sample video frames, determining the image segmentation sample features of the sample video frame based on the first values and the feature values of the pixels corresponding to the non-background elements in the image segmentation result includes: Replacing the feature value of each pixel point corresponding to the non-background element in the image segmentation result with a second value; The image segmentation sample features of the sample video frame are obtained based on the first values and the second values.
5. The method according to claim 1, It is characterized in that For each of the sample video frames, determining the target image sample features of the sample video frame based on the initial image sample features and the image segmentation sample features includes at least one of the following: For each pixel point of the sample video frame, multiply the color feature corresponding to the pixel point in the initial image sample feature by the feature value corresponding to the pixel point in the image segmentation sample feature to obtain the target sample feature corresponding to the pixel point, and determine the target image sample feature of the sample video frame based on the target sample features corresponding to each pixel point of the sample video frame; The initial image sample feature and the image segmentation sample feature are spliced to obtain a first splicing feature, and the first splicing feature is determined as a target image sample feature of the sample video frame.
6. The method according to claim 5, It is characterized in that The target image sample features of each sample video frame are obtained by splicing the initial image sample features and the image segmentation sample features of the sample video frame, and the target image sample features and the first video sample features corresponding to each sample video are input into the initial model to obtain the prediction type of each sample video, including: Processing the target image sample features of each of the sample video frames based on a pre-trained convolutional network to obtain fused sample features corresponding to each of the sample video frames; The fused sample features and the first video sample features corresponding to each of the sample videos are input into the initial model to obtain the predicted type of each of the sample videos.
7. The method according to claim 1, It is characterized in that For each of the sample videos, based on the target image sample features of each first video frame corresponding to the sample video, determining the first video sample features corresponding to the sample video includes: Inputting the target image sample features of each first video frame corresponding to the sample video into a pre-trained image type prediction network to obtain the prediction distribution features corresponding to each first video frame, wherein the prediction distribution features corresponding to each first video frame are 1×m feature vectors, m is the number of preset image types, a feature value in each of the prediction distribution features corresponds to one of the preset image types, and a feature value in each of the prediction distribution features is used to characterize the probability that the image type corresponding to the first video frame belongs to the preset image type corresponding to the feature value; The characteristic values in each of the predicted distribution features are arranged in descending order to obtain a characteristic value sequence, a preset number of characteristic values are intercepted from the characteristic value sequence as the target distribution feature corresponding to the predicted distribution feature, and the first video sample feature corresponding to the sample video is determined based on the target distribution feature corresponding to each of the first video frames.
8. The method according to claim 1, It is characterized in that The initial model determines the prediction type of each video based on: Determine, based on each target image sample feature corresponding to the sample video, a second video sample feature corresponding to the sample video, wherein the second video sample feature represents the video content of the sample video; Splicing the second video sample feature and the first video sample feature corresponding to the sample video to obtain the target scene sample feature corresponding to the sample video; The prediction type of the sample video is determined based on the target scene sample features.
9. A video type determination device, It is characterized in that The device comprises: A feature determination module, used to determine the initial image features of each video frame of the video to be predicted; A type prediction module, used for inputting each of the initial image features into a video type prediction model to obtain a target type of the video to be predicted; The video type prediction model is obtained by training with a model training device, and the model training device is used to: Determine a training sample set, wherein the training sample set includes at least one sample video; Determine each sample video frame of each of the sample videos, determine an initial image sample feature and an image segmentation sample feature of each of the sample video frames, and determine a target image sample feature of the sample video frame based on the initial image sample feature and the image segmentation sample feature; Determine at least one first video frame from each sample video frame of each sample video, and determine a first video sample feature corresponding to the sample video based on a target image sample feature of each first video frame, wherein the first video sample feature represents a probability that an image type of each first video frame belongs to at least one preset image type; Inputting each target image sample feature and the first video sample feature corresponding to each sample video into the initial model to obtain a predicted type of each sample video; The total training loss is determined based on the actual type and predicted type of each of the sample videos, and the initial model is iteratively trained based on the total training loss and the training sample set until the training is stopped when the total training loss meets the training end condition, and the model at the time of stopping the training is determined as the video type prediction model.
10. An electronic device, It is characterized in that comprising a processor and a memory, wherein the processor and the memory are connected to each other; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 8 when calling the computer program.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 8.
12. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
