Low-complexity iteration CU rapid division method based on decision tree, electronic equipment and storage medium
By introducing a low-complexity CU fast division method based on decision tree in the video encoding standard, the problems of high complexity of CU division algorithms and inaccurate judgment of decision tree in the prior art are solved, and more efficient coding speed and better coding quality are achieved.
Patent Information
- Application Number
- CN202411869270.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-11
AI Technical Summary
In the existing video encoding standards, the CU division algorithm is complex and difficult to meet the needs of low or zero delay. At the same time, the decision tree model may lead to coding quality loss in the case of errors in discrimination.
A low-complexity iterative CU fast division method based on decision tree is proposed. By extracting the intra and inter-frame CU features of the standard sequence in the video encoding standard, the training set is constructed and the binary and three-class decision trees are trained, and the CU division and three-class decision trees are embedded in the encoder for CU division judgment, reducing the computational complexity and improving the discrimination accuracy.
It effectively reduces the complexity of the CU division algorithm, improves the encoding speed, reduces the encoding quality loss caused by inaccurate decision tree judgment, and balances the encoding performance and speed by adjusting the confidence threshold and the number of training iterations.
Smart Images

Figure CN119815000A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image and video processing, and in particular relates to a low-complexity iterative CU fast partitioning method based on a decision tree, an electronic device and a storage medium. Background Art
[0002] In the new media era, the development of media technology has led the world into the digital omnimedia era, thus opening up a new media communication pattern of "global, universal, and omnimedia". "Short, flat, and fast" have become new characteristics of information dissemination. With the emergence and rapid development of self-media, individuals can also use the platform to produce, edit, and publish information. With its advantages of rich information, intuitive images, easy understanding, and strong interactivity, video has become the mainstream form of information dissemination in the new media era. Video encoding provides indispensable technical support for the transmission of video information.
[0003] At present, in order to meet the demand for low or even zero latency in scenarios such as live broadcast and video conferencing in the industry, video encoding must balance quality (reducing distortion) and efficiency (saving bandwidth) while paying attention to the complexity of the algorithm to reduce the time spent on encoding (increasing speed).
[0004] In various existing video coding standards, video frames need to be divided into coding units of various sizes, and coding operations such as prediction and transformation are performed with coding units as the basic units. Video coding standards specify different sizes for coding units to adapt to different image contents in the video. Taking H.265 as an example, the sizes of coding units include 64×64, 32×32, 16×16 and 8×8. Video frames are first divided into 64×64 CUs, and then each 64×64 CU will be judged whether to be further divided into CUs of smaller sizes. Many existing open source codecs including HM and X265 use a recursive algorithm based on rate-distortion cost to implement CU division judgment, that is, each 64×64 CU undergoes a complete 85 CU-based RD cost calculation. This method has too high computational complexity and is difficult to meet the real-time requirements of some application scenarios.
[0005] In order to reduce coding complexity and save coding time, some existing algorithms use decision trees to make early decisions on whether to divide a CU to skip various mode traversals. However, due to the limited training data and the model's own fitting ability, decision trees / random forest models are bound to have judgment errors. Using wrong division results may cause loss of coding quality and decrease in coding speed. Summary of the invention
[0006] The problem to be solved by the present invention is to optimize the CU division algorithm of the encoder in the video standard, and propose a low-complexity iterative CU fast division method based on a decision tree, an electronic device and a storage medium.
[0007] To achieve the above object, the present invention is implemented through the following technical solutions:
[0008] A low-complexity iterative CU fast partitioning method based on a decision tree comprises the following steps:
[0009] S1. Select a standard sequence in the video coding standard, extract intra-frame CU features and inter-frame CU features of the coding unit CU, and construct a training set and a test set;
[0010] S2. Use the training set obtained in step S1 to train a binary classification decision tree. After training, test the classification accuracy on the test set and fine-tune the decision tree parameters. Then use the trained binary classification decision tree to clean the training set to obtain a data-cleaned training set.
[0011] S3. Use the data cleansing training set obtained in step S2 to train a three-classification decision tree, and obtain a three-classification decision tree with output categories including division, non-division, and indistinguishable;
[0012] S4. The decision tree is embedded into the encoder, and then the features of the collected CU are extracted. Then, binary and three-class decision tree predictions are performed to obtain the discrimination results. For the CU whose discrimination result is division, the current layer prediction mode traversal is skipped. For the CU whose discrimination result is non-division, the subsequent layer prediction mode traversal is skipped. For the CU whose discrimination result is undistinguished, the discrimination is performed according to the recursive strategy of the original encoder, and the low-complexity iterative CU fast division based on the decision tree is completed.
[0013] Furthermore, the specific implementation method of step S1 includes the following steps:
[0014] S1.1. Extract intra CU features of a coding unit;
[0015] S1.1.1. Extract the sum of pixel gradients of the CU: For each pixel in the CU, use the Sobel operator to calculate the x-direction gradient G x and the y-direction gradient G y , the expression is:
[0016]
[0017] Among them, * represents the convolution operation, P represents the original CU, and the sum of the pixel gradients in the current CU is G cu Calculated by the following formula:
[0018]
[0019] Among them, (i, j) represents the pixel position coordinates;
[0020] S1.1.2. Extract the maximum pixel gradient value G of CU max , the expression is:
[0021] G max =max(G x 2 (i,j)+G y 2 (i,j))
[0022] Among them, max is the maximum value function;
[0023] S1.1.3. Extract the pixel mean of CU, expressed as:
[0024]
[0025] Where m and n represent the length and width of the CU respectively, and p(i, j) represents the pixel value;
[0026] S1.1.4. Extracting pixel variance σ of CU 2 , the expression is:
[0027] σ 2 =(p(i, j)-mean) 2 ;
[0028] S1.1.5. Extract the quantization parameter QP of CU;
[0029] S1.2. Extract inter-frame CU features of the coding unit, including the division information of adjacent CUs in the spatial and temporal domains, the coding information of the previous coding mode, and the texture information of the current CU;
[0030] S1.3. Select a standard sequence in the video coding standard, extract the intra-frame CU features and inter-frame CU features of the coding unit CU based on the methods of steps S1.1 and S1.2, construct a training set and a test set, use the original encoder to encode the data in the training set and the test set to obtain the training set and the test set for each size of CU, and count the features and labels of each size of CU during the encoding process. The labels are divided into two types: divided and not divided.
[0031] Furthermore, the specific implementation method of step S2 includes the following steps:
[0032] S2.1. Use information gain or Gini index to select split features, and select the features that have the greatest impact on CU division decision as the split features of the decision tree;
[0033] S2.2. Construct splitting rules: Split the training set into two subsets based on the selected splitting features. The splitting rule is the feature value threshold or feature value range.
[0034] S2.3. Recursive splitting: Repeat the feature selection and splitting rule steps for each subset until the stopping condition is met;
[0035] S2.4. Decision tree generation: Generate a decision tree based on the results of recursive splitting. Each leaf node of the decision tree represents a prediction result, including 0 or 1;
[0036] S2.5. Use the training set obtained in step S1 to train a binary classification decision tree, and preset the number of iterations. In each iteration, the decision tree generates a confidence value for the division judgment of the CU. If the confidence value is lower than the preset confidence threshold T, the CU is classified as undeterminable. Otherwise, the division judgment continues until the training is completed. The expression of the confidence value is:
[0037] Confidence = number of correct divisions / total number of divisions
[0038] Among them, the number of correct divisions refers to the number of times the decision tree correctly judges the CU division, and the total number of divisions refers to the total number of times the decision tree judges the CU division;
[0039] S2.6. Use the preliminarily trained decision tree to perform data cleaning on the training samples. For training samples with low confidence, set the label to be unidentifiable. The labels of the training set after data cleaning are divided into three categories, including division, non-division, and unidentifiable.
[0040] Furthermore, the specific implementation method of step S3 includes the following steps:
[0041] S3.1. Use information gain or Gini index to select split features, and select the features that have the greatest impact on CU division decision as the split features of the decision tree;
[0042] S3.2. Construct splitting rules: Split the training set into three subsets based on the selected splitting features. The splitting rules are the feature value threshold or feature value range.
[0043] S3.3. Recursive splitting: Repeat the feature selection and splitting rule steps for each subset until the stopping condition is met;
[0044] S3.4. Decision tree generation: Generate a decision tree based on the results of recursive splitting. Each leaf node of the decision tree represents a prediction result, including 0, 1, or 2;
[0045] S3.5. Use the data cleansing training set obtained in step S2 to train a three-category decision tree. The three-category decision tree is used to further refine the CU division decision and divide the CU into three situations, including no need to traverse the prediction mode of the current layer, need to traverse the prediction mode of the current layer, and need to traverse the prediction mode of the next layer.
[0046] Furthermore, the specific implementation method of step S4 includes the following steps:
[0047] S4.1.CU feature extraction, including CU size, brightness and chrominance information, motion information, texture complexity and prediction mode;
[0048] S4.2. Input the extracted CU features into the trained binary classification decision tree to predict whether the CU needs to perform the prediction mode traversal of the current layer. If the prediction result is division, skip the prediction mode traversal of the current layer and directly perform the CU division of the next layer; if the prediction result is no division, perform the prediction mode traversal of the current layer;
[0049] S4.3. For the CU whose prediction result is 1, it is further input into the trained three-classification decision tree to predict whether the CU needs to perform the prediction mode traversal of the current layer or the prediction mode traversal of the next layer. If the prediction result is division, the prediction mode traversal of the current layer is skipped and the CU division of the next layer is performed directly; if the prediction result is no division, the prediction mode traversal of the current layer is performed; if the prediction result is undeterminable, the CU is judged according to the recursive strategy of the original encoder;
[0050] CU division is performed according to the prediction results of the decision tree. For the CU that needs to perform prediction mode traversal, all possible prediction modes are traversed and the optimal mode is selected; for the CU that does not need to perform prediction mode traversal, the next layer of CU division is performed directly.
[0051] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a low-complexity iterative CU fast partitioning method based on a decision tree when executing the computer program.
[0052] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements a low-complexity iterative CU fast partitioning method based on a decision tree.
[0053] Beneficial effects of the present invention:
[0054] The low-complexity iterative CU fast division method based on a decision tree described in the present invention proposes an iterative training method based on confidence discrimination to address the problem of coding performance loss caused by incorrect CU division judgment by the decision tree. The trained decision tree can classify CUs that are uncertain whether to divide as "unable to be discriminated", thereby reducing coding performance loss.
[0055] The low-complexity iterative CU fast partitioning method based on a decision tree described in the present invention extracts CU features with low computational complexity as training samples of the decision tree, and trains the decision tree with an iterative training method based on confidence discrimination, thereby reducing the coding quality loss caused by inaccurate judgment of the decision tree, and can balance the impact of the algorithm on coding performance and coding speed by adjusting the confidence threshold and the number of training iterations.
[0056] The low-complexity iterative CU fast partitioning method based on a decision tree described in the present invention is a feature extraction method with low computational complexity, which reduces the time required for feature extraction while ensuring a high partitioning and discrimination accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 The present invention provides a flowchart of a low-complexity iterative CU fast partitioning method based on a decision tree. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the specific embodiments described are only part of the embodiments of the present invention, rather than all of the specific embodiments. The components of the specific embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations, and the present invention can also have other embodiments.
[0059] Therefore, the following detailed description of the specific embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected specific embodiments of the present invention. Based on the specific embodiments of the present invention, all other specific embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0060] In order to further understand the content, features and effects of the present invention, the following specific implementation methods are given as examples, and the attached Figure 1 The detailed instructions are as follows:
[0061] Embodiment 1:
[0062] A low-complexity iterative CU fast partitioning method based on a decision tree comprises the following steps:
[0063] S1. Select a standard sequence in the video coding standard, extract intra-frame CU features and inter-frame CU features of the coding unit CU, and construct a training set and a test set;
[0064] Furthermore, the specific implementation method of step S1 includes the following steps:
[0065] S1.1. Extract intra CU features of a coding unit;
[0066] S1.1.1. Extract the sum of pixel gradients of the CU: For each pixel in the CU, use the Sobel operator to calculate the x-direction gradient G x and the y-direction gradient G y , the expression is:
[0067]
[0068] Among them, * represents the convolution operation, P represents the original CU, and the sum of the pixel gradients in the current CU is G cu Calculated by the following formula:
[0069]
[0070] Among them, (i, j) represents the pixel position coordinates;
[0071] S1.1.2. Extract the maximum pixel gradient value G of CU max , the expression is:
[0072] G max =max(G x 2 (i,j)+G y 2 (i,j))
[0073] Among them, max is the maximum value function;
[0074] S1.1.3. Extract the pixel mean of CU, expressed as:
[0075]
[0076] Where m and n represent the length and width of the CU respectively, and p(i, j) represents the pixel value;
[0077] S1.1.4. Extracting pixel variance σ of CU 2 , the expression is:
[0078] σ 2 =(p(i, j)-mean) 2;;
[0079] S1.1.5. Extract the quantization parameter QP of CU;
[0080] S1.2. Extract inter-frame CU features of the coding unit, including the division information of adjacent CUs in the spatial and temporal domains, the coding information of the previous coding mode, and the texture information of the current CU;
[0081] Furthermore, the specific contents include the following:
[0082] The depth information of the CUs adjacent to the current CU in the space-time domain. The CUs adjacent to the current CU in the space-time domain often have a high degree of partition correlation, so this method extracts the depth of the CUs above, above left, above right, and left of the current CU, as well as the depth of the CUs in the same position in the same CTU of the previous frame;
[0083] RD cost in current CU Merge mode;
[0084] The number of encoding bits in the current CU Merge mode;
[0085] The optimal MV information in the current CU Merge mode: Assuming the optimal MV in Merge mode is (x, y), the square sum of the offset coordinate values x 2 +y 2 As a MV feature;
[0086] SATD value in current CU Merge mode;
[0087] The pixel mean of the current CU;
[0088] Pixel variance of the current CU;
[0089] The quantization parameter of the current CU;
[0090] S1.3. Select a standard sequence in the video coding standard, extract the intra-frame CU features and inter-frame CU features of the coding unit CU based on the methods of steps S1.1 and S1.2, construct a training set and a test set, use the original encoder to encode the data in the training set and the test set to obtain the training set and the test set for each size of CU, and count the features and labels of each size of CU during the encoding process. The labels are divided into two types: divided and not divided.
[0091] S2. Use the training set obtained in step S1 to train a binary classification decision tree. After training, test the classification accuracy on the test set and fine-tune the decision tree parameters. Then use the trained binary classification decision tree to clean the training set to obtain a data-cleaned training set.
[0092] Furthermore, the specific implementation method of step S2 includes the following steps:
[0093] S2.1. Use information gain or Gini index to select split features, and select the features that have the greatest impact on CU division decision as the split features of the decision tree;
[0094] S2.2. Construct splitting rules: Split the training set into two subsets based on the selected splitting features. The splitting rule is the feature value threshold or feature value range.
[0095] S2.3. Recursive splitting: Repeat the feature selection and splitting rule steps for each subset until the stopping condition is met;
[0096] S2.4. Decision tree generation: Generate a decision tree based on the results of recursive splitting. Each leaf node of the decision tree represents a prediction result, including 0 or 1;
[0097] S2.5. Use the training set obtained in step S1 to train a binary classification decision tree, and preset the number of iterations. In each iteration, the decision tree generates a confidence value for the division judgment of the CU. If the confidence value is lower than the preset confidence threshold T, the CU is classified as undeterminable. Otherwise, the division judgment continues until the training is completed. The expression of the confidence value is:
[0098] Confidence = number of correct divisions / total number of divisions
[0099] Among them, the number of correct divisions refers to the number of times the decision tree correctly judges the CU division, and the total number of divisions refers to the total number of times the decision tree judges the CU division;
[0100] S2.6. Use the preliminarily trained decision tree to perform data cleaning on the training samples. For training samples with low confidence, set the label to be unidentifiable. The labels of the training set after data cleaning are divided into three categories, including division, non-division, and unidentifiable.
[0101] Furthermore, the training process of the intra-frame decision tree is taken as an example. A binary classification decision tree is trained on the training set. The feature selection standard of the decision tree is the Gini coefficient, and the maximum depth of the tree is set to 7. After training, the classification accuracy is tested on the test set and the decision tree parameters are fine-tuned;
[0102] S3. Use the data cleansing training set obtained in step S2 to train a three-classification decision tree, and obtain a three-classification decision tree with output categories including division, non-division, and indistinguishable;
[0103] Furthermore, the specific implementation method of step S3 includes the following steps:
[0104] S3.1. Use information gain or Gini index to select split features, and select the features that have the greatest impact on CU division decision as the split features of the decision tree;
[0105] S3.2. Construct splitting rules: Split the training set into three subsets based on the selected splitting features. The splitting rules are the feature value threshold or feature value range.
[0106] S3.3. Recursive splitting: Repeat the feature selection and splitting rule steps for each subset until the stopping condition is met;
[0107] S3.4. Decision tree generation: Generate a decision tree based on the results of recursive splitting. Each leaf node of the decision tree represents a prediction result, including 0, 1, or 2;
[0108] S3.5. Use the data cleansing training set obtained in step S2 to train a three-category decision tree. The three-category decision tree is used to further refine the CU division decision and divide the CU into three situations, including no need to traverse the prediction mode of the current layer, need to traverse the prediction mode of the current layer, and need to traverse the prediction mode of the next layer.
[0109] S4. Embed the decision tree into the encoder, then extract features from the collected CU, and then perform binary and ternary decision tree predictions to obtain a discrimination result. For a CU with a discrimination result of division, skip the current layer prediction mode traversal. For a CU with a discrimination result of non-division, skip the subsequent layer prediction mode traversal. For a CU with a discrimination result of being unable to be distinguished, distinguish it according to the recursive strategy of the original encoder, and complete the low-complexity iterative CU fast division based on the decision tree.
[0110] Furthermore, the specific implementation method of step S4 includes the following steps:
[0111] S4.1.CU feature extraction, including CU size, brightness and chrominance information, motion information, texture complexity and prediction mode;
[0112] S4.2. Input the extracted CU features into the trained binary classification decision tree to predict whether the CU needs to perform the prediction mode traversal of the current layer. If the prediction result is division, skip the prediction mode traversal of the current layer and directly perform the CU division of the next layer; if the prediction result is no division, perform the prediction mode traversal of the current layer;
[0113] S4.3. For the CU whose prediction result is 1, it is further input into the trained three-classification decision tree to predict whether the CU needs to perform the prediction mode traversal of the current layer or the prediction mode traversal of the next layer. If the prediction result is division, the prediction mode traversal of the current layer is skipped and the CU division of the next layer is performed directly; if the prediction result is no division, the prediction mode traversal of the current layer is performed; if the prediction result is undeterminable, the CU is judged according to the recursive strategy of the original encoder;
[0114] CU division is performed according to the prediction results of the decision tree. For the CU that needs to perform prediction mode traversal, all possible prediction modes are traversed and the optimal mode is selected; for the CU that does not need to perform prediction mode traversal, the next layer of CU division is performed directly.
[0115] The low-complexity iterative CU fast partitioning method based on a decision tree described in this embodiment proposes a feature extraction method with low computational complexity to address the problem that the encoder speed is reduced due to the long time required for feature extraction during decision tree reasoning. The features used to determine whether the intra-frame CU is divided include the sum of pixel gradients within the CU, the maximum value of pixel gradients within the CU, the CU pixel mean, the CU pixel variance, and the quantization parameter; the features used to determine whether the inter-frame CU is divided include the depth information of the space-time adjacent CU, the RD cost in the Merge mode, the number of coding bits in the Merge mode, the MV information in the Merge mode, the SATD value in the Merge mode, the pixel mean, the pixel variance, and the quantization parameter. The extracted features either have low computational complexity or are coding information that already exists in the encoder and can be directly extracted, which reduces the time required for feature extraction while ensuring a high accuracy of division judgment. A decision tree iterative discrimination method with configurable parameters is proposed for different requirements for coding speed and coding quality in different application scenarios. During the decision tree training process, the confidence threshold and the number of training iterations can be adjusted to balance the encoding speed and encoding quality. The smaller the confidence threshold and the fewer the iterations, the greater the encoding speed improvement and the greater the corresponding decrease in encoding quality. The larger the confidence threshold and the more the iterations, the smaller the encoding speed improvement and the smaller the corresponding decrease in encoding quality.
[0116] Embodiment 2:
[0117] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a low-complexity iterative CU fast partitioning method based on a decision tree described in Example 1 are implemented.
[0118] The computer device of the present invention may be a device including a processor and a memory, such as a single chip microcomputer including a central processing unit, etc. Moreover, the processor is used to implement the steps of the above-mentioned low-complexity iterative CU fast partitioning method based on a decision tree when executing the computer program stored in the memory.
[0119] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0120] The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, 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), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0121] Embodiment 3:
[0122] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements a low-complexity iterative CU fast partitioning method based on a decision tree as described in Example 1.
[0123] The computer-readable storage medium of the present invention can be any form of storage medium that can be read by a processor of a computer device, including but not limited to non-volatile memory, volatile memory, ferroelectric memory, etc. A computer program is stored on the computer-readable storage medium. When the processor of the computer device reads and executes the computer program stored in the memory, the steps of the above-mentioned low-complexity iterative CU fast partitioning method based on a decision tree can be implemented.
[0124] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer readable media do not include electric carrier signals and telecommunication signals.
[0125] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants 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, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0126] Although the present application has been described above with reference to specific embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present application. In particular, as long as there is no structural conflict, the various features in the specific embodiments disclosed in the present application may be used in combination with each other in any manner, and the fact that these combinations are not exhaustively described in this specification is only for the sake of omitting space and saving resources. Therefore, the present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
Claims
1. A low-complexity iterative CU fast partitioning method based on decision tree, characterized in that: The steps include: S1. Select a standard sequence in the video coding standard, extract intra-frame CU features and inter-frame CU features of the coding unit CU, and construct a training set and a test set; S2. Use the training set obtained in step S1 to train a binary classification decision tree. After training, test the classification accuracy on the test set and fine-tune the decision tree parameters. Then use the trained binary classification decision tree to clean the training set to obtain a data-cleaned training set. S3. Use the data cleansing training set obtained in step S2 to train a three-classification decision tree, and obtain a three-classification decision tree with output categories including division, non-division, and indistinguishable; S4. The decision tree is embedded into the encoder, and then the features of the collected CU are extracted. Then, binary and three-class decision tree predictions are performed to obtain the discrimination results. For the CU whose discrimination result is division, the current layer prediction mode traversal is skipped. For the CU whose discrimination result is non-division, the subsequent layer prediction mode traversal is skipped. For the CU whose discrimination result is undistinguished, the discrimination is performed according to the recursive strategy of the original encoder, and the low-complexity iterative CU fast division based on the decision tree is completed.
2. The low-complexity iterative CU fast partitioning method based on decision tree according to claim 1, characterized in that: The specific implementation method of step S1 includes the following steps: S1.
1. Extract intra CU features of a coding unit; S1.1.
1. Extract the sum of pixel gradients of the CU: For each pixel in the CU, use the Sobel operator to calculate the x-direction gradient G x and the y-direction gradient G y , the expression is: Among them, * represents the convolution operation, P represents the original CU, and the sum of the pixel gradients in the current CU is G cu Calculated by the following formula: Among them, (i, j) represents the pixel position coordinates; S1.1.
2. Extract the maximum pixel gradient value G of CU max , the expression is: G max =max(G x 2 (i,j)+G y 2 (i,j)) Among them, max is the maximum value function; S1.1.
3. Extract the pixel mean of CU, expressed as: Where m and n represent the length and width of the CU respectively, and p(i, j) represents the pixel value; S1.1.
4. Extracting pixel variance σ of CU 2 , the expression is: σ 2 =(p(i,j)-mean) 2 ; S1.1.
5. Extract the quantization parameter QP of CU; S1.
2. Extract inter-frame CU features of the coding unit, including the division information of adjacent CUs in the spatial and temporal domains, the coding information of the previous coding mode, and the texture information of the current CU; S1.
3. Select a standard sequence in the video coding standard, extract the intra-frame CU features and inter-frame CU features of the coding unit CU based on the methods of steps S1.1 and S1.2, construct a training set and a test set, use the original encoder to encode the data in the training set and the test set to obtain the training set and the test set for each size of CU, and count the features and labels of each size of CU during the encoding process. The labels are divided into two types: divided and not divided.
3. The low-complexity iterative CU fast partitioning method based on a decision tree according to claim 1 or 2, characterized in that: The specific implementation method of step S2 includes the following steps: S2.
1. Use information gain or Gini index to select split features, and select the features that have the greatest impact on CU division decision as the split features of the decision tree; S2.
2. Construct splitting rules: Split the training set into two subsets based on the selected splitting features. The splitting rule is the feature value threshold or feature value range. S2.
3. Recursive splitting: Repeat the feature selection and splitting rule steps for each subset until the stopping condition is met; S2.
4. Decision tree generation: Generate a decision tree based on the results of recursive splitting. Each leaf node of the decision tree represents a prediction result, including 0 or 1; S2.
5. Use the training set obtained in step S1 to train a binary classification decision tree, and preset the number of iterations. In each iteration, the decision tree generates a confidence value for the division judgment of the CU. If the confidence value is lower than the preset confidence threshold T, the CU is classified as undeterminable. Otherwise, the division judgment continues until the training is completed. The expression of the confidence value is: Confidence = number of correct divisions / total number of divisions Among them, the number of correct divisions refers to the number of times the decision tree correctly judges the CU division, and the total number of divisions refers to the total number of times the decision tree judges the CU division; S2.
6. Use the preliminarily trained decision tree to perform data cleaning on the training samples. For training samples with low confidence, set the label to be unidentifiable. The labels of the training set after data cleaning are divided into three categories, including division, non-division, and unidentifiable.
4. The low-complexity iterative CU fast partitioning method based on decision tree according to claim 3, characterized in that: The specific implementation method of step S3 includes the following steps: S3.
1. Use information gain or Gini index to select split features, and select the features that have the greatest impact on CU division decision as the split features of the decision tree; S3.
2. Construct splitting rules: Split the training set into three subsets based on the selected splitting features. The splitting rules are the feature value threshold or feature value range. S3.
3. Recursive splitting: Repeat the feature selection and splitting rule steps for each subset until the stopping condition is met; S3.
4. Decision tree generation: Generate a decision tree based on the results of recursive splitting. Each leaf node of the decision tree represents a prediction result, including 0, 1, or 2; S3.
5. Use the data cleansing training set obtained in step S2 to train a three-category decision tree. The three-category decision tree is used to further refine the CU division decision and divide the CU into three situations, including no need to traverse the prediction mode of the current layer, need to traverse the prediction mode of the current layer, and need to traverse the prediction mode of the next layer.
5. The low-complexity iterative CU fast partitioning method based on decision tree according to claim 4, characterized in that: The specific implementation method of step S4 includes the following steps: S4.1.CU feature extraction, including CU size, brightness and chrominance information, motion information, texture complexity and prediction mode; S4.
2. Input the extracted CU features into the trained binary classification decision tree to predict whether the CU needs to perform the prediction mode traversal of the current layer. If the prediction result is division, skip the prediction mode traversal of the current layer and directly perform the CU division of the next layer; if the prediction result is no division, perform the prediction mode traversal of the current layer; S4.
3. For the CU whose prediction result is 1, it is further input into the trained three-classification decision tree to predict whether the CU needs to perform the prediction mode traversal of the current layer or the prediction mode traversal of the next layer. If the prediction result is division, the prediction mode traversal of the current layer is skipped and the CU division of the next layer is performed directly; if the prediction result is no division, the prediction mode traversal of the current layer is performed; if the prediction result is undeterminable, the CU is judged according to the recursive strategy of the original encoder; CU division is performed according to the prediction results of the decision tree. For the CU that needs to perform prediction mode traversal, all possible prediction modes are traversed and the optimal mode is selected; for the CU that does not need to perform prediction mode traversal, the next layer of CU division is performed directly.
6. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a low-complexity iterative CU fast partitioning method based on a decision tree as described in any one of claims 1 to 5 when executing the computer program.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the low-complexity iterative CU fast partitioning method based on a decision tree is implemented.
Citation Information
Patent Citations
Video coding method capable of deciding sizes of coding blocks by means of classification
CN105430396A
VVC intra-frame coding rapid CU division decision method based on random forest
CN112437310A
Multi-level Machine Learning-based Early Termination in Partition Search for Video Encoding
US20180227585A1
Video coding unit division method and apparatus, and computer device and computer-readable storage medium
WO2023051583A1