VVC CU prediction method based on Transform and CNN structures
By introducing a T-CNN model based on Transformer and CNN in the VVC encoder, the CU partitioning mode is predicted and threshold decisions are combined to solve the problem of high VVC encoding complexity and efficient video encoding is achieved.
Patent Information
- Application Number
- CN202410661876.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-11-01
AI Technical Summary
The new generation of video encoding standard VVC has a high rate distortion optimization (RDO) brute force search problem in coding complexity, resulting in more than 90% of the encoding time, affecting efficiency.
The hybrid neural network T-CNN model based on Transformer and CNN structure is adopted to predict the CU partitioning mode by training and integration into the VVC encoder, and combined with the threshold decision strategy, avoid the traditional RDO search process and reduce the coding complexity.
The calculation complexity of VVC intra-coding is significantly reduced, while maintaining a high encoding efficiency, and the trade-off between encoding time and efficiency is achieved by setting thresholds.
Smart Images

Figure CN118890481A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video coding technology, and in particular to a CU prediction method of a VVC based on a Transformer and CNN structure. Background Art
[0002] The development of video coding and decoding technology is mainly to achieve efficient video data compression and transmission under limited bandwidth and storage space. Compared with the previous generation HEVC / H.265, the new generation video coding standard VVC / H.266 introduces a more flexible quadtree plus multi-type tree (QTMT) partition structure to split CU, thereby improving coding efficiency, but at the same time greatly increasing coding complexity.
[0003] In the VVC encoder, it is necessary to perform a complex rate-distortion optimization (RDO) brute force search on each CU, traverse all possible partitioning modes, calculate the rate-distortion cost of each mode, and select the one with the lowest cost as the optimal mode. This process occupies more than 90% of the VVC encoding time and becomes the main source of encoding complexity. Therefore, how to reduce the complexity of VVC encoding while maintaining high encoding efficiency has become an important issue that needs to be solved urgently. Summary of the invention
[0004] To solve the above problems, the present invention provides a CU prediction method for VVC based on Transformer and CNN structures. The present invention can avoid the traditional RDO brute force search process and greatly reduce the computational complexity of VVC intra-frame coding. At the same time, through the innovative T-CNN model structure and threshold decision strategy, a high coding efficiency is maintained.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] A CU prediction method for VVC based on Transformer and CNN structure, comprising:
[0007] Obtain a VVC test video sequence from a public data set, perform full-frame intra-coding on the test video sequence using a VTM source code, and obtain an original image frame from the encoding result;
[0008] Extracting CU partition data and corresponding image blocks from the original image frame, classifying CUs according to CU sizes, extracting 32x32 CUs, and constructing a sample set of 32x32 CU partition modes;
[0009] A hybrid neural network T-CNN model that integrates a deep learning model and a convolutional neural network is selected, the T-CNN model is trained using the sample set, and the CU partition mode is predicted by the trained T-CNN model.
[0010] Preferably, after predicting the CU partition mode by the trained T-CNN model, the method further includes:
[0011] Integrate the T-CNN model into the reasoning module of VTM to obtain the prediction result and similarity score of the CU partition mode;
[0012] Setting a threshold to score the CU partition mode predicted by the T-CNN model;
[0013] If the similarity score is higher than the set threshold, the partition mode predicted by the T-CNN model is adopted, otherwise the traditional RDO search is performed to redetermine the 32x32 size CU partition mode.
[0014] Preferably, the T-CNN model includes an Inv Res Block, a Mobile Vit Block and a prediction head, the Mobile Vit Block includes a Mobile-ViT Block, and the Mobile-ViT Block includes a Transformer encoder module.
[0015] Preferably, predicting the CU partition mode by using the trained T-CNN model includes:
[0016] Input CU brightness channel image of size 32x32 to the T-CNN model;
[0017] The Inv Res Block extracts local texture features of the CU brightness channel image, and the Transformer encoder module extracts global texture features of the CU brightness channel image;
[0018] The local texture features and the global texture features are fused through the Mobile Vit Block, and a fused feature representation is output;
[0019] Performing a 1×1 convolution on the fused feature representation, wherein the number of channels of the 1×1 convolution is mapped to the number of partition pattern types;
[0020] Predicting a CU partition mode through the output of the 1×1 convolution;
[0021] The prediction head outputs a result of the predicted CU partition mode.
[0022] Preferably, the method of training the T-CNN model using the sample set includes: using a cross entropy loss function with label smoothing regularization during training, and the cross entropy loss function formula is:
[0023] L=(1-ε)H(p, q)+εH(p, u);
[0024] Where p is the model predicted logits output, q is the true one-hot label, u is the uniform distribution, ε is the smoothing coefficient, and H(p, q) is the standard cross entropy loss.
[0025] Preferably, the types of CU partition modes include no partitioning, quadtree partitioning, horizontal binary tree partitioning, vertical binary tree partitioning, horizontal ternary tree partitioning, and vertical ternary tree partitioning.
[0026] Preferably, after training the T-CNN model using the sample set, the method further comprises:
[0027] Compressing and streamlining the trained T-CNN model, and converting the T-CNN model into a hardware-friendly format;
[0028] After conversion into a hardware-friendly format, the weight parameters of the T-CNN model are converted into a format loadable by the VTM reasoning module.
[0029] Preferably, before using the sample set to train the T-CNN model, a data enhancement operation is performed on the sample set in the 32x32 size CU partition mode.
[0030] Preferably, the Transformer encoder module comprises a plurality of encoder layers, wherein the encoder layers comprise a plurality of channels, multi-head attention heads and a feed-forward network channel dimension.
[0031] A video encoding device includes a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the CU prediction method of VVC based on Transformer and CNN structure is implemented.
[0032] The beneficial effects of the present invention are:
[0033] 1. The present invention sets a threshold to score the CU partition mode predicted by the T-CNN model, and selects the CU partition mode predicted by T-CNN or performs a traditional RDO search through the score to determine the final 32x32 CU partition mode. By setting different thresholds, a trade-off can be achieved between the encoding time saving rate and the encoding efficiency. This method can reduce the VVC encoding complexity while maintaining a high encoding efficiency.
[0034] 2. The present invention transplants and integrates the T-CNN model into the codec framework of the VVC reference software VTM, and uses the T-CNN model for encoding in the VTM codec framework to realize model reasoning and CU decision-making functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a schematic diagram of the flow chart of the video coding unit partition mode prediction method in an embodiment of the present application;
[0036] Figure 2 It is a statistical distribution diagram of different partition modes in the 32x32 CU partition mode sample data set constructed in Example 2 of the present application;
[0037] Figure 3 It is the overall network architecture diagram of the T-CNN model in the embodiment of the present application.
[0039] Explanation of the figure numbers: 1. No segmentation; 2. Quadtree segmentation; 3. Horizontal binary tree segmentation; 4. Vertical binary tree segmentation; 5. Horizontal ternary tree segmentation; 6. Vertical ternary tree segmentation. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] See also Figure 1-Figure 3 As shown, the present invention relates to a CU prediction method of VVC based on Transformer and CNN structure.
[0042] Example 1
[0043] A CU prediction method for VVC based on Transformer and CNN structure, comprising:
[0044] Obtain a VVC test video sequence from a public data set, perform full-frame intra-coding on the test video sequence using a VTM source code, and obtain an original image frame from the encoding result;
[0045] CU partition data and corresponding image blocks are extracted from the original image frame, CUs are classified according to CU size, 32x32 CUs are extracted, and a sample set of 32x32 CU partition mode is constructed. Data enhancement operations (such as rotation, flipping, etc.) are performed on the constructed 32x32 CU partition mode sample set to expand the sample size and enhance the generalization ability of the model.
[0046] Select a suitable deep learning network architecture (such as CNN, etc.) as the backbone network, improve and optimize the network architecture according to the needs, design a hybrid neural network model T-CNN that integrates Transformer and CNN structures, use the enhanced CU sample set to train the T-CNN model, and use the sample set to train the T-CNN model. During training, a cross entropy loss function with label smoothing regularization is used. The formula of the cross entropy loss function is:
[0047] L=(1-ε)H(p, q)+εH(p, u);
[0048] Where p is the model predicted logits output, q is the true one-hot label, u is the uniform distribution, ε is the smoothing coefficient, and H(p, q) is the standard cross entropy loss.
[0049] refer to Figure 3 As shown, the CU partition mode is predicted by the T-CNN model, and the CU partition mode is predicted by the T-CNN model including:
[0050] Input CU brightness channel image of size 32x32 to the T-CNN model;
[0051] The Inv Res Block extracts local texture features of the CU brightness channel image, and the Transformer encoder module extracts global texture features of the CU brightness channel image;
[0052] The global context and long-range dependency of the CU are captured by the Mobile Vit Block, and high-level semantic feature representation is learned. The local texture and global semantic features are fused by the Mobile Vit Block, and the fused feature representation is output;
[0053] Performing a 1×1 convolution on the fused feature representation, wherein the number of channels of the 1×1 convolution is mapped to the number of partition pattern types;
[0054] The prediction head predicts the CU partition mode through the output of 1×1 convolution, and the types of CU partition modes include non-partitioning 1, quadtree partitioning 2, horizontal binary tree partitioning 3, vertical binary tree partitioning 4, horizontal ternary tree partitioning 5, and vertical ternary tree partitioning 6.
[0055] The prediction head outputs the predicted CU partition mode. After predicting the CU partition mode, the trained T-CNN model needs to be compressed and streamlined to reduce the model size; the compressed T-CNN model weights and other parameters are converted into a format that can be loaded by the VTM reasoning framework;
[0056] The converted T-CNN model is transplanted and integrated into the reasoning module of the VVC reference software VTM to realize model reasoning and CU decision-making functions.
[0057] After predicting the CU partitioning mode, the T-CNN model is integrated into the encoding and decoding framework of the VTM reasoning module to realize model reasoning and CU decision functions.
[0058] In the VTM source code, the transplanted T-CNN model is used to infer the input video sequence to obtain the partition prediction results and similarity scores of the 32x32 CU; according to the set single threshold decision mechanism, it is determined whether to use the T-CNN prediction results or perform traditional RDO search; if the similarity score is higher than the single threshold, the partition information predicted by the T-CNN model is used, otherwise the traditional RDO search is performed to determine the final partition mode of the 32x32 CU. Test the encoding performance (such as encoding time, bit rate-distortion curve, etc.), compare with the original VTM, and analyze the improvement of encoding efficiency.
[0059] As shown in Table 1, by setting different single thresholds, a trade-off can be achieved between encoding time saving rate and encoding efficiency. This method can significantly reduce the complexity of VVC encoding while maintaining high encoding efficiency.
[0060]
[0061]
[0062] Among them, FT: Fast Threshold, FsT: Faster Threshold, ATR (Average True Range) and BDDR (bit rate).
[0063] Example 2
[0064] Based on the above-mentioned embodiment 1, the CU prediction method of VVC based on Transformer and CNN structure proposed in this application includes the following steps:
[0065] S1 collects video data and constructs a dataset containing rich 32x32 CU partition pattern samples from it; the specific approach is: obtain video sequences from public datasets, use VTM source code to decode the video sequences, and obtain original image frames.
[0066] S2 preprocesses data and constructs a CU partition pattern sample set: extracts 32x32 CU partition data and corresponding image blocks from the decoded image frame, performs preprocessing (such as channel conversion, cutting, etc.), classifies samples according to CU size, and constructs a sample set containing rich 32x32 CU partition patterns. Figure 2 As shown in the figure, in the dataset constructed through statistical analysis, the partition mode of 32x32 CU includes 6 possible cases: no partition (0), quadtree partition (1), horizontal binary tree partition (2), vertical binary tree partition (3), horizontal ternary tree partition (4), vertical ternary tree partition (5). The proportion of each mode varies under different QP settings, which provides good data support for subsequent modeling.
[0067] S3 data enhancement: Perform data enhancement operations (such as rotation, flipping, etc.) on the constructed 32x32 size CU partition mode sample set to expand the sample size and enhance the model generalization ability.
[0068] S4 Model design and training: Select a suitable deep learning network architecture (such as CNN, etc.) as the backbone network, improve and optimize the network architecture according to the needs, design a hybrid neural network model T-CNN that integrates Transformer and CNN structures, and use the enhanced CU sample set to train the T-CNN model to predict all partition information of 32x32 size CU. Figure 3 As shown in the figure, the overall architecture of the T-CNN model includes: the input is a 32x32 CU brightness channel image; the convolutional layer network extracts the local texture features of the CU; the Transformer encoder module captures the global context and long-range dependencies of the CU and learns high-level semantic feature representations; the fusion module fuses local texture and global semantic features; the prediction head outputs the predicted CU partition pattern.
[0069] S5 model compression and conversion: compress and streamline the trained T-CNN model to reduce the model size; convert the compressed T-CNN model weights and other parameters into a format that can be loaded by the VTM reasoning framework.
[0070] S6 Model transplantation and integration: Transplant and integrate the converted T-CNN model into the reasoning module of the VVC reference software VTM to realize model reasoning and CU decision-making functions.
[0071] S7 system test and performance evaluation: In the VTM source code, the transplanted T-CNN model is used to infer the input video sequence to obtain the partition prediction results and similarity scores of the 32x32 CU; according to the set single threshold decision mechanism, it is determined whether to use the T-CNN prediction results or perform traditional RDO search; if the similarity score is higher than the single threshold, the partition information predicted by the T-CNN model is used, otherwise the traditional RDO search is performed to determine the final partition mode of the 32x32 CU. Test the encoding performance (such as encoding time, bit rate-distortion curve, etc.), compare with the original VTM, and analyze the improvement of encoding efficiency.
[0072] This application innovatively applies deep learning technology to the field of video coding, aiming to solve the key problems of VVC high-complexity coding. By building a high-quality dataset, an innovative T-CNN model structure, and a threshold decision strategy, the coding complexity can be greatly reduced while maintaining a high coding efficiency.
[0073] Example 2
[0074] Based on the above-mentioned embodiment 1, the T-CNN model includes Inv Res Block and Mobile Vit Block. Combining the two different modules, Inv Res Block and MobileViT, has the following advantages:
[0075] 1. Feature-level fusion: Inv Res Block extracts low-level local texture features, while MobileViT learns high-level semantic features. By fusing the two, the model can obtain local details and global context information at the same time, thereby improving the quality and diversity of feature representation.
[0076] 2. Computational control: Although MobileViT has powerful modeling capabilities, its computational complexity is relatively large. Combining it with the efficient Inv Res Block can reduce the computational complexity of the overall model while maintaining the global modeling capabilities of MobileViT.
[0077] 3. Multi-scale feature fusion: Inv Res Block tends to capture smaller-scale texture features, while MobileViT focuses more on larger-scale semantic information. The combination of the two enables the model to learn feature representations at multiple scales, enhancing the ability to fully model the target.
[0078] 4. Model flexibility: By adjusting the number and ratio of Inv Res Block and MobileViT modules and other hyperparameters, we can flexibly balance the amount of computation, model size and performance to meet the needs of different application scenarios.
[0079] The above implementation modes are merely descriptions of the preferred implementation modes of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary engineering and technical personnel in the field shall fall within the protection scope determined by the claims of the present invention.
Claims
1. A CU prediction method for VVC based on Transformer and CNN structure, It is characterized in that include: Obtain a VVC test video sequence from a public data set, perform full-frame intra-coding on the test video sequence using a VTM source code, and obtain an original image frame from the encoding result; Extracting CU partition data and corresponding image blocks from the original image frame, classifying CUs according to CU sizes, extracting 32x32 CUs, and constructing a sample set of 32x32 CU partition modes; A hybrid neural network T-CNN model that integrates a deep learning model and a convolutional neural network is selected, the T-CNN model is trained using the sample set, and the CU partition mode is predicted by the trained T-CNN model.
2. The CU prediction method of VVC based on Transformer and CNN structure according to claim 1, It is characterized in that After predicting the CU partition mode by the trained T-CNN model, the method further includes: Integrate the T-CNN model into the reasoning module of VTM to obtain the prediction result and similarity score of the CU partition mode; Setting a threshold to score the CU partition mode predicted by the T-CNN model; If the similarity score is higher than the set threshold, the partition mode predicted by the T-CNN model is adopted, otherwise the traditional RDO search is performed to redetermine the 32x32 size CU partition mode.
3. The CU prediction method of VVC based on Transformer and CNN structure according to claim 1, It is characterized in that The T-CNN model includes an Inv Res Block, a Mobile Vit Block and a prediction head, the Mobile VitBlock includes a Mobile-ViT Block, and the Mobile-ViT Block includes a Transformer encoder module.
4. The CU prediction method of VVC based on Transformer and CNN structure according to claim 3, It is characterized in that Predicting the CU partition mode by the trained T-CNN model includes: Input CU brightness channel image of size 32x32 to the T-CNN model; The Inv Res Block extracts local texture features of the CU brightness channel image, and the Transformer encoder module extracts global texture features of the CU brightness channel image; The local texture features and the global texture features are fused through the Mobile Vit Block, and a fused feature representation is output; Performing a 1×1 convolution on the fused feature representation, wherein the number of channels of the 1×1 convolution is mapped to the number of partition pattern types; Predicting a CU partition mode through the output of the 1×1 convolution; The prediction head outputs a result of the predicted CU partition mode.
5. The CU prediction method of VVC based on Transformer and CNN structure according to claim 1, It is characterized in that The method of training the T-CNN model using the sample set includes: using a cross entropy loss function with label smoothing regularization during training, wherein the cross entropy loss function formula is: L=(1-ε)H(p, q)+εH(p, u); Where p is the model predicted logits output, q is the true one-hot label, u is the uniform distribution, ε is the smoothing coefficient, and H(p, q) is the standard cross entropy loss.
6. The CU prediction method of VVC based on Transformer and CNN structure according to claim 1, It is characterized in that The types of CU partition modes include no partition, quadtree partition, horizontal binary tree partition, vertical binary tree partition, horizontal ternary tree partition, and vertical ternary tree partition.
7. The CU prediction method of VVC based on Transformer and CNN structure according to claim 2, It is characterized in that After the T-CNN model is trained using the sample set, the method further comprises: Compressing and streamlining the trained T-CNN model, and converting the T-CNN model into a hardware-friendly format; After conversion into a hardware-friendly format, the weight parameters of the T-CNN model are converted into a format loadable by the inference module.
8. The CU prediction method of VVC based on Transformer and CNN structure according to claim 1, It is characterized in that Before using the sample set to train the T-CNN model, a data enhancement operation is performed on the sample set in the 32x32 CU partition mode.
9. The CU prediction method of VVC based on Transformer and CNN structure according to claim 3, It is characterized in that The Transformer encoder module includes several encoder layers, which include several channels, multi-head attention heads, and feed-forward network channel dimensions.
10. A video encoding device, comprising a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, a CU prediction method of a VVC based on a Transformer and CNN structure as described in any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Method for detecting grain number per ear, row number per ear and grain number per row per ear of corn
CN120298713A
