A method and device for detecting screen content during encoding
Using a deep learning model to detect information related to the screen content of video frames solves the problem in the existing technology of relying on the client for screen content detection, achieves more efficient video encoding, and improves image quality and encoding efficiency.
Patent Information
- Application Number
- CN202111055152.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-09
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-09
AI Technical Summary
In the existing technology, the detection of screen content in video encoding relies on client support, and it is difficult to accurately determine the source of the video content, resulting in insufficient coding efficiency and bit rate optimization.
Using deep learning methods, pre-trained machine learning models are used to analyze video data, detect and determine information related to the screen content of video frames, so as to perform targeted encoding during the encoding process and get rid of dependence on the client.
It improves image quality, reduces bit rate, improves encoding efficiency, and can achieve optimal encoding effects without relying on client support.
Smart Images

Figure CN113949870B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for detecting screen content during an encoding process. Background Art
[0002] With the popularity of remote conferencing, cloud office, cloud gaming and other services, a large amount of video content is no longer captured by cameras in natural environments, but is often generated by computers. These images are called screen content (SC), that is, the images are captured directly from the image display units of various devices (computers, mobile terminals, etc.). Common screen content includes computer graphics and text images, images mixed with natural video and graphics / text, and computer-generated animated images. Screen images are prevalent in various scenarios such as desktop collaboration, desktop sharing, second screen, cloud gaming, etc.
[0003] Since screen content is significantly different from images in natural scenes, advanced video coding standards have special processing methods for screen content (for example, AV1, HEVC-SCC: screen content coding), which can greatly improve the image quality of screen content while reducing the bit rate / bit rate and bandwidth used. This is very important for applications such as remote conferencing and cloud office.
[0004] There is a clear difference between computer-generated screen images and natural images captured by cameras - computer-generated images such as graphics and text are usually noise-free, discrete in tone, with fine lines and sharp edges; while videos shot by cameras are usually noisy, continuous in tone, and have complex textures.
[0005] In order to improve the effect of encoding screen content images, the industry has proposed many targeted new technologies, among which intra-frame copy and palette mode have the greatest impact on performance.
[0006] Intra Block Copy (IBC): In addition to the traditional intra and inter prediction modes, HEVC-SCC introduces a new coding mode IBC, in which the PU uses the reconstructed block of the current frame as the prediction block. IBC can be considered as motion compensation within the current coded image.
[0007] Palette Mode: For screen content images, the number of colors in many coding blocks is limited. The palette mode enumerates these color values to generate a color table, and then passes an index for each sample to indicate which color in the color table it belongs to. Compared with traditional encoding methods based on prediction-transform, the palette mode is often more effective for screen content images with a relatively concentrated number of colors.
[0008] In the applications of remote office and remote conferencing, although the IBC and palette modes have high compression efficiency, their encoding complexity is also very high.
[0009] Although existing technologies can roughly understand the properties of video images by understanding the source of video information through special clients, they have many disadvantages:
[0010] It requires client support, which may not be possible in many application scenarios. For example, during the transcoding process, if the original video does not use SCC, it is impossible to determine which content is SC. Here, the original video may be a high-bitrate 4K video, which works well without SCC. It is hoped that it will be converted to a low-bitrate 720P video to save space and bandwidth.
[0011] Judging SC by the source of the video is not accurate. For example, when sharing pictures and video content in a video conference, although the information comes from a computer, the content actually comes from a camera (natural scene). Simply based on whether the source of the sharing is a computer, it cannot be determined that the content of the picture / video is generated by a computer.
[0012] Using only one encoding mode will not produce the best results in terms of image quality, resource consumption and compression ratio. Summary of the invention
[0013] The embodiments of the present invention provide a method and device for detecting screen content during the encoding process, which uses a deep learning method to analyze the content of the image itself and detect the screen content, thereby getting rid of the dependence on the client during the video encoding process, improving the image quality to the greatest extent, reducing the bit rate, and improving the encoding efficiency.
[0014] An embodiment of the present disclosure provides a method for detecting screen content during encoding, including:
[0015] Get video data;
[0016] Based on the video data, using a pre-trained machine learning model to perform prediction to determine screen content related information of video frames in the video data;
[0017] Video encoding is performed based on the screen content related information of the video frame and the original video data.
[0018] In some embodiments, the machine learning model includes a binary classification model, and using the pre-trained machine learning model to make predictions includes:
[0019] When the classification result of the binary classification model detects that the video frame contains screen content (SC), screen content related information is determined based on the detected SC for use in video encoding.
[0020] In some embodiments, a preset threshold of the binary classification model is adjusted to adjust the false positive rate of the classification result output by the binary classification model.
[0021] In some embodiments, the machine learning model includes a target detection model, and using a pre-trained machine learning model to make predictions further includes:
[0022] The object detection model is used to detect a bounding box containing screen content (SC) position information in the video data based on the original video data.
[0023] In some embodiments, after acquiring the video data, the screen content detection method further includes:
[0024] The video data is preprocessed and scaled to match the input requirements of the machine learning model.
[0025] In some embodiments, using a pre-trained machine learning model to make predictions also includes: based on the detected bounding box, restoring a previous scaling operation so that the detected position information matches the position in the corresponding video frame.
[0026] In some embodiments, after determining the screen content related information of the video frame in the video data, the screen content detection method further includes:
[0027] The screen content related information is converted into a target format for use in video encoding.
[0028] In some embodiments, performing video encoding based on the screen content related information of the video frame and the original video data includes:
[0029] The content within the boundary box corresponding to each SC is divided into several slices, and each slice is video encoded using the corresponding SC encoding method. The content outside the boundary box is encoded using a common method.
[0030] The embodiment of the present disclosure further provides a device for detecting screen content during encoding, including a processor configured as follows:
[0031] Get video data;
[0032] Based on the video data, using a pre-trained machine learning model to perform prediction to determine screen content related information of video frames in the video data;
[0033] Video encoding is performed based on the screen content related information of the video frame and the original video data.
[0034] An embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for detecting screen content in the encoding process described in each embodiment of the present disclosure are implemented.
[0035] The embodiment of the present invention uses a pre-trained machine learning model to perform predictions and determine the screen content-related information of the video frame in the video data. During the encoding process, encoding can be performed based on the detected screen content-related information, thereby getting rid of dependence on the client during the video encoding process, improving image quality to the greatest extent, reducing bit rate, and improving encoding efficiency.
[0036] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0038] Figure 1 It is a basic flow chart of an embodiment of the present disclosure.
[0039] Figure 2 It is a schematic diagram of the overall process of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0040] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0041] In video conferencing, there are often sharing modes and video modes. Using SCC often requires client support. In sharing mode, the client knows that the shared content comes from the computer, so it can use a special encoding mode, such as SCC. In video mode, the client knows that the video content comes from the camera, so it uses the general mode encoding. Of course, it is also possible to use only one encoding mode, but the effect produced may not be optimal.
[0042] The embodiment of the present disclosure proposes a method for detecting screen content during encoding, such as Figure 1 As shown, including:
[0043] S101, obtaining video data, specifically the obtained video data may be original video data to be encoded, the video data includes a number of video frames. The original video data may come from a camera, a computer, a video decoder, etc., which are not specifically limited here.
[0044] S102. Based on the video data, a pre-trained machine learning model is used to make predictions to determine the information related to the screen content of the video frame in the video data. The machine learning model (or deep learning model) disclosed in the present invention can be MobileNet, ResNet, Inception, SSD, Yolo, etc., which can be selected according to actual needs. The training process of the machine learning model can be completed by the training set data and the corresponding training labels, which are not specifically limited here. By making predictions through the trained machine learning model, a good detection effect can be achieved. At the same time, the parameters in the training process can be adjusted according to the actual usage scenario, so as to better match the usage scenario. After determining the information related to the screen content of the video frame in the video data, the output result of the machine learning model can be converted into a format corresponding to the video encoder.
[0045] S103, performing video encoding based on the screen content related information of the video frame and the original video data. Figure 2 As shown, the video encoder can achieve encoding using the original video data (video frames) and the output results of the machine learning model (information related to the screen content), and the encoding method can be performed using SCC and / or normal mode as needed.
[0046] The embodiment of the present invention uses a pre-trained machine learning model to perform predictions to determine the screen content-related information of the video frame in the video data. During the encoding process, encoding can be performed based on the detected screen content-related information, thereby getting rid of dependence on the client during the video encoding process, maximizing image quality, reducing bit rate, and improving encoding efficiency.
[0047] In some embodiments, the machine learning model includes a binary classification model, and using the pre-trained machine learning model to make predictions includes:
[0048] When the classification result of the binary classification model detects that the video frame contains screen content (SC), screen content related information is determined based on the detected SC for use in video encoding.
[0049] like Figure 2As shown, in some embodiments, the machine learning model may include a binary classification model, which is relatively simple in structure and generally has low computational complexity. Since its purpose is to determine whether the current frame is screen content (SC), a binary classification model with accuracy exceeding that of the human eye can be trained by collecting and annotating pictures in video conferencing, cloud desktops, and other scenarios. The method of the present invention does not limit the model structure and training framework used, and the model structures that can be used include MobileNet, ResNet, Inception, etc. The training frameworks include Tensorflow, PyTorch, etc. In addition to the requirements for accuracy, the computational complexity of the binary classification model needs to be within a preset range to meet the needs of real-time performance.
[0050] In some embodiments, the preset threshold of the binary classification model is adjusted to adjust the false positive rate of the classification result output by the binary classification model. In this embodiment, for the binary classification model, the result directly determines the encoding mode (SCC / normal). By setting the threshold for the prediction result, the false negative rate / false positive rate of the output of the model can be adjusted to achieve the desired effect.
[0051] In some embodiments, the machine learning model includes a target detection model, and using a pre-trained machine learning model for prediction also includes: using the target detection model to detect a bounding box containing screen content (SC) location information in the video data based on the original video data.
[0052] Independently or additionally, the machine learning model may also include a target detection model, and the complexity of the target detection model may be high, so that the specific position of the screen content (SC) can be accurately located. The advantages of SCC encoding can be maximized through the target detection model. The model structure of the target detection model may include SSD, Yolo, etc. Similarly, the trained target detection model needs to meet the requirements of both accuracy and real-time performance. Target tracking can also be achieved using methods such as motion information to predict the position of the target in each frame.
[0053] In some embodiments, after acquiring the video data, the method for detecting screen content further includes: preprocessing the video data and scaling the video data to match the input requirements of the machine learning model. Specifically, the core function of preprocessing is to reduce the original frame of the video data to reduce the amount of calculation of the classification / target detection model. According to the needs of the specific model, the reduced video frame may also be subjected to necessary format conversion (e.g., YUV to RGB).
[0054] In some embodiments, using a pre-trained machine learning model for prediction further includes: based on the detected bounding box, restoring the previous scaling operation so that the detected position information matches the position in the corresponding video frame. That is, the output of the object detection model can be a bounding box containing the screen content (SC). Since the original frame has undergone a reduction operation before outputting the model, a post-processing operation may be required before output to make the output result of the model correspond to the position of the original frame.
[0055] In some embodiments, after determining the screen content related information of the video frame in the video data, the screen content detection method further includes: converting the screen content related information into a target format for use in video encoding. Figure 2 As shown, the output results of the classification / target detection model can also be post-processed. For example, the post-processing can convert the output results of the model into a format that can be used by the encoder, thereby ensuring that the output of the model can be used for mixed encoding with the original video frame. The size and number of the output bounding boxes can also be limited during the post-processing process. For example, only a maximum of 3 bounding boxes with the highest credibility are output, or the area of the output bounding box must be greater than a certain threshold to filter out too small screen content (SC) areas. Other parameters that control the output results of the model include the confidence of the prediction and the allowed overlap between the prediction rectangular boxes.
[0056] In some embodiments, video encoding based on screen content related information of the video frame and the original video data includes: dividing the content within the boundary box corresponding to each SC into several slices, encoding each slice using the corresponding SC encoding method, and encoding the content outside the boundary box using a normal method.
[0057] The video encoder receives the original frame and the parameters related to the screen content generated by the machine learning model, and performs hybrid encoding on the original frame. Its operation mode is determined by the internal implementation of the encoder. In specific operations, the bounding box corresponding to the screen content can be defined as a slice (TILE). Each TILE may also contain several CTUs (coding tree units), which can be encoded using SCC alone. Each slice within the bounding box can be encoded using the corresponding SC encoding method. For the content outside the bounding box, the ordinary method can be used for encoding. If the entire frame is screen content (SC), the frame is encoded using SCC as a whole, and the other parts can use the ordinary encoding mode.
[0058] In application scenarios such as video conferencing and cloud desktops, the switching frequency of screen content is not high (switching between presentation mode and video mode), and it is usually not necessary to predict the screen content (SC) for each frame. In some embodiments, the amount of computation can be reduced by setting the detection frequency, for example, detecting once per second, which can save 96% of the computation (calculated at 30FPS). For frames that are not detected, since the position of the screen content is relatively fixed, the result of the last detection (yes / no, position) can be used as the input of the video encoder. The detection frequency is related to the type of application and the computing resources available.
[0059] The method disclosed in the present invention adopts a deep learning method to determine whether the content in the video is screen content (SC), thereby improving the picture quality, reducing the consumption of computing resources, and reducing the bit rate. The deep learning method can be a simple two-classification model to determine whether it is screen content (SC). This can achieve similar effects to the traditional method of using client information. However, this method does not require the support of special clients. The deep learning method can be target detection, which can more accurately locate the position of the screen content (SC) in the frame. The encoder uses these positions to encode in different ways in a targeted manner. The method disclosed in the present invention can be used in any encoding method that supports SCC, and can be regarded as a part of video encoding preprocessing, which is easy to implement. Supports software / hardware encoding. When judging, the original picture can be reduced and then predicted to be classified, or the position can be predicted (the position needs to be enlarged at the same ratio before use), which effectively reduces the amount of calculation.
[0060] An embodiment of the present disclosure also proposes a device for screen content detection during an encoding process, including a processor configured to: obtain video data; based on the video data, use a pre-trained machine learning model to perform predictions to determine screen content-related information of video frames in the video data; and perform video encoding based on the screen content-related information of the video frames and the original video data.
[0061] An embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for detecting screen content in the encoding process described in each embodiment of the present disclosure are implemented.
[0062] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0063] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0064] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for a terminal (which can be a mobile phone, computer, server or network equipment, etc.) to execute the methods described in each embodiment of the present invention.
[0065] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A method for detecting screen content during encoding, characterized in that: include: Get video data; Based on the video data, using a pre-trained machine learning model to perform prediction to determine screen content related information of video frames in the video data; Performing video encoding based on the screen content related information of the video frame and the video data; The machine learning model includes a binary classification model, and prediction using a pre-trained machine learning model includes: When the classification result of the binary classification model detects that the video frame contains screen content SC, the screen content related information is determined based on the detected SC to determine whether the video encoding method adopts SC encoding; The machine learning model also includes a target detection model, and prediction using a pre-trained machine learning model also includes: Using the object detection model, based on the video data, a bounding box containing position information of screen content SC in the video data is detected; Video encoding based on the screen content related information of the video frame and the video data includes: The content within the boundary box corresponding to each SC is divided into several slices, and each slice is video encoded using the corresponding SC encoding method. The content outside the boundary box is encoded using a common method.
2. The method for detecting screen content during encoding as claimed in claim 1, characterized in that: The preset threshold of the binary classification model is adjusted to adjust the false positive rate of the classification result output by the binary classification model.
3. The method for detecting screen content during encoding as claimed in claim 1, characterized in that: After acquiring the video data, the screen content detection method further includes: The video data is pre-processed by scaling the video data to match the input requirements of the machine learning model.
4. The method for detecting screen content during encoding as claimed in claim 3, characterized in that: Using a pre-trained machine learning model to make predictions also includes: based on the detected bounding box, restoring the previous scaling operation so that the detected position information matches the position in the corresponding video frame.
5. The method for detecting screen content during encoding as claimed in claim 1, characterized in that: After determining the screen content related information of the video frame in the video data, the screen content detection method further includes: The screen content related information is converted into a target format for use in video encoding.
6. A device for detecting screen content during encoding, characterized in that: comprising a processor configured to: Get video data; Based on the video data, using a pre-trained machine learning model to perform prediction to determine screen content related information of video frames in the video data; Performing video encoding based on the screen content related information of the video frame and the video data; The machine learning model includes a binary classification model, and prediction using a pre-trained machine learning model includes: When the classification result of the binary classification model detects that the video frame contains screen content SC, the screen content related information is determined based on the detected SC to determine whether the video encoding method adopts SC encoding; The machine learning model also includes a target detection model, and prediction using a pre-trained machine learning model also includes: Using the object detection model, based on the video data, a bounding box containing position information of screen content SC in the video data is detected; Video encoding based on the screen content related information of the video frame and the video data includes: The content within the boundary box corresponding to each SC is divided into several slices, and each slice is video encoded using the corresponding SC encoding method. The content outside the boundary box is encoded using a common method.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for detecting screen content in an encoding process as claimed in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Screen video coding method based on image processing and machine learning
CN110312134A
Video coding method and device, computer equipment and storage medium
CN112399176A
