Log In Sign Up

Accelerate CU Partition in HEVC using Large-Scale Convolutional Neural Network

by   Chenying Wang, et al.
Huazhong University of Science u0026 Technology

High efficiency video coding (HEVC) suffers high encoding computational complexity, partly attributed to the rate-distortion optimization quad-tree search in CU partition decision. Therefore, we propose a novel two-stage CU partition decision approach in HEVC intra-mode. In the proposed approach, CNN-based algorithm is designed to decide CU partition mode precisely in three depths. In order to alleviate computational complexity further, an auxiliary earl-termination mechanism is also proposed to filter obvious homogeneous CUs out of the subsequent CNN-based algorithm. Experimental results show that the proposed approach achieves about 37 insignificant BD-Bitrate rise compared with the original HEVC encoder.


Reducing Complexity of HEVC: A Deep Learning Approach

High Efficiency Video Coding (HEVC) significantly reduces bit-rates over...

DeepQTMT: A Deep Learning Approach for Fast QTMT-based CU Partition of Intra-mode VVC

The latest standard Versatile Video Coding (VVC) significantly improves ...

AdjointBackMapV2: Precise Reconstruction of Arbitrary CNN Unit's Activation via Adjoint Operators

Adjoint operators have been found to be effective in the exploration of ...

Enhancing HEVC Compressed Videos with a Partition-masked Convolutional Neural Network

In this paper, we propose a partition-masked Convolution Neural Network ...

Video compression with low complexity CNN-based spatial resolution adaptation

It has recently been demonstrated that spatial resolution adaptation can...

Speeding up VP9 Intra Encoder with Hierarchical Deep Learning Based Partition Prediction

In VP9 video codec, the sizes of blocks are decided during encoding by r...

I Introduction

High efficiency video coding (HEVC) [1] is the state-of-the-art video coding standards developed by the joint collaborative team on video coding (JCT-VC). HEVC supports four depth levels of coding units (CUs) at maximum, from to , also known as CU quad-tree partition. By contrast with the fixed-size marcoblock supported in H.264 [2], this flexible partition structure leads that at the meantime of performance enhancement, CU partition decision becomes one of the most time-consuming modules in HEVC encoder. Currently, CU partition decision relies on a rate-distortion optimization (RDO) quad-tree search algorithm. Specifically HEVC encoder recursively in three depths, makes decision whether a CU split or not by comparing if the rate-distortion cost of the CU as a whole is higher than the sum of rate-distortion costs of four splited sub-CUs. In the light of this condition, so much encoding time is spent on CU partition decision that a faster approach of it is urgently required.

In the last few years, deep learning has successfully demonstrated its impressive performance on many varieties of fields. Convolutional neural networks (CNNs) specifically are able to extract features from images and then classify them to several types. Accordingly, an idea comes up that we can take advantages of CNNs to assist many decision modules in HEVC encoder. CNNs are able to boost the decision modules in HEVC encoding, such as CU partition, intra and inter prediction mode. For instance, CNNs can assist HEVC encoder to decide CU partition much faster than traditional method. At the meantime, since CNNs are able to achieve considerable accuracy of CU partition decision, RD performance of encoded video will hardly be aggravated.

Several CNN-based fast CU partition decision algorithms are emerging. Liu et al. [3] proposed a simple CNN structure to predict CU mode. Liu’s work mainly focuses on pipe-line to adapt hardware implementation, which is tough to be ported to another hardware or platform. Moreover, Li et al. [4] presented a deep CNN to decide three level CU partition, and in their CNN there are three branches with different sizes and quantities of convolution layers. On the other hand, none of feasible measure is taken during training process against the imbalance training samples issue. Xu et al. [5] raised a novel CNN structure to decide CU quad-tree partition over three depths at one time. Within a CU, Xu’s proposed CNNs utilize redundant neighbor sub-CUs to sub-CU partition decision in second and third depth.

In this paper, we propose a novel two-stage approach in order to accelerate CU partition decision. The first stage of the proposed approach is a rough early-termination algorithm based on the range of CU luma samples that directly related to CU partition mode. This early-termination algorithm will be applied before CNN-based stage to filter some evident non-split CUs out of the subsequent CNN in order to tightly restrain computational complexity. The second stage is CNNs designed and trained to precisely estimate the partition mode of ambiguous CUs that the first stage conveys. Due to the depth and width of our neural networks, our CNNs are able to accomplish much lower error rate. In a nutshell, the first stage, or the early-termination algorithm, is a rough but fast method to filter some evident homogeneous CUs, which plays an important part in complexity reduction. Then in the second stage the CNN-based CU partition algorithm is a final method with higher accuracy, which mainly concentrates on RD performance retention. As a result, the proposed two-stage approach gains the balance of time saving and RD loss.

Ii Two-Stage CU Partition Approach

CU partition mode is decided over three depths totally and CUs are determined to split or to non-split at each depth. In other word, CU partition decision at each depth is actually a binary classification problem, so we design a CU non-split/split classifier. The proposed approach measures range of CU luma samples firstly to filter homogeneous CUs to early terminate. Then CUs passed early-termination filter will be decided by three CNNs whether to split or not in each depth.

Ii-a Early-Termination Algorithm

Aside from CNNs, we craft an early-termination algorithm to improve efficiency of whole proposed approach further. Apparently, homogeneous CUs have tendency to split into four sub-CUs and vice versa. Considering that, we do a statistical analysis on every CU luma samples in our training sequence. Given feasibility and computational complexity, we choose two most possible CU classification indicators, range and standard deviation of CU luma samples. Every range and standard deviation samples of our training dataset are separated into two groups i.e. ones of non-split CUs and ones of split CUs. Then, both selected indicators are assessed by probability density.

(a) Range of CUs
(b) Std. dev. of CUs
(c) Range of CUs
(d) Std. dev. of CUs
(e) Range of CUs
(f) Std. dev. of CUs
Fig. 1: Probability density of both selected indicators

As Fig. 1 shows, the possibility densities of two selected indicators, range and standard deviation of CU luma samples, are shown respectively in each graph within non-split and split groups of three CU sizes. As we can see, split CUs basically have larger range and standard deviation than non-split CUs, which results in an truth that CUs can be classified into non-split and split by their range and standard deviation. However, the differential of range is obviously larger than standard deviation, as shown in Fig. 1, which manifests that the range is more effective to distinguish non-split/split CUs. Another advantage of range is that it is much easier and faster to calculate range than standard deviation.

Consequently, we regard the range of CU luma samples as the indicator to classify CU partition. More clearly, the threshold are configured as 20 in CUs, 25 in CUs and 30 in CUs. CUs whose range of luma samples below the threshold will be early terminated in this stage as shown in grey areas in Fig. 1.

Ii-B CNN-based CU Partition Algorithm

In pursuit of higher accuracy than current CNN-based CU partition approaches, a deeper and wider CNN structure is introduced and crafted for CU partition decision in HEVC. Nevertheless, upon the trade-off of accuracy and computation complexity, the computational complexity of CNNs has to be controlled in an acceptable limitation. Hence we cannot only seek the highest accuracy by sacrifice of computational performance and the proposed CNNs are illustrated below.

, and CU will be determined to non-split or split during encoding process. Thus, we design three large-scale CNNs to decide CU partition mode at each depth from 0 () to 3 (). In each CNN, the input layer is two-dimensional normalized luma samples of the CU, and the output layer is two softmax activation units representing the probabilities of non-split and split. Our large-scale CNN structures are enlightened by GoogLeNet [6] comprising several Inception layers.

(a) CNN for CUs
(b) CNN for CUs
(c) CNN for CUs
Fig. 2: Proposed CNN structures 111Each block indicated a layer of CNN in the form of “

Particularly, frameworks and parameters of the proposed CNNs for each size of CU are elaborated in Fig. 2. At very beginning of each CNN, there is a

convolutional layer to increase input channel from 1 to 32. Then, core framework of each CNN consists of four Inception layers for features extraction and many max pooling layer for dimension reduction. In core framework, only sequence arrangement of four Inception layers and pooling layers is different from each other CNN, and four Inception layers in each CNN have same numbers of channels. Specifically, max poling layers are followed every Inception layer for

CUs, the first and third Inception layer for CUs, and the second Inception layer for CUs. For each CNN, the output of core framework is a feature map, and there is a valid average pooling layer to flat that into a one-dimensional array. Final layer is a fully connected layer and a softmax activation.

Ii-C Self-Adaptive Weighted Loss Function

Our training dataset is extracted from original HEVC encoder, consisting of the luma samples (as feature) and the split flag (as label) of every CU in the training sequence. To prevent overlap the test sequences, the training sequence is concatenation of 1,000 raw images that are arbitrarily selected from RAISE database [7]. It should be noticed that as a matter of fact larger CUs tend to split, so our training dataset actually is a classification-imbalance dataset in which the ratio of positive and negative samples is far larger or smaller than 1 as shown in Table I. It undoubtedly results in a severe problem in the training process. That is under any circumstances CNNs, without significantly increasing loss, will always choose the partition mode of the majority of training samples.

CU Size
Non-Split 508,105 3,828,038 29,467,909
Split 1,667,895 4,875,962 5,348,091
NS/S Ratio 0.30 0.78 5.51
Total 2,176,000 8,704,000 34,816,000
TABLE I: Partition Distribution of CUs in Training Dataset

Against this classification-imbalance problem, we propose the self-adaptive weighted loss function. Based on the traditional cross-entropy loss function, our self-adaptive weighted loss function is given by


where and is weight of 0 (non-split) samples’ loss and 1 (split) samples’ loss respectively and is batch size. Parameter and will be adjusted during training process to adapt to the training results. In detail, for every steps, the next will be set to equal the weighted sum of current of proportion of amounts of 0 samples and 1 samples in test results of present CNN. When updating and , keep in order to control loss in a reasonable range. Hence the update method of loss weights is given by


where , is the amounts of 0 samples and 1 samples in test results, and

is a hyperparameter representing the weight of the proportion of two samples to update loss weights. Since loss of minority of predictions will be multiplied a relatively large penalty item, the estimations of CNN will not remain the majority. Note that

and are a self-adaptive auxiliary parameters instead of hyperparameters.

Iii Experimental Results

In our experiment, CPU is Intel Xeon CPU E5-2620 v4, GPU is NVIDIA GeForce GTX 1080 and OS is Ubuntu 16.04. Our CNNs are implemented with TensorFlow

[8] deep learning library The proposed approach is integrated with HEVC Test Model (HM) 16.18, and we use the test sequences with QP = {22, 27, 32, 37} under all intra (AI) configuration.

Sequences Resolution Liu et al. [3] Cen et al. [9] Proposed
BQTerrace 4.21 -0.10 36.71 2.26 -0.07 13.14 2.42 -0.14 43.30
BasketballDrill 5.67 -0.21 34.75 7.33 -0.10 18.35 2.36 -0.10 37.71
PartyScene 4.34 -0.12 34.83 4.00 -0.18 11.45 1.39 -0.10 31.69
RaceHorses 5.23 -0.23 32.70 0.01 -0.14 12.75 1.99 -0.13 27.03
BasketballDrillText 5.96 -0.26 37.66 0.09 -1.82 18.90 4.42 -0.22 35.52
ChinaSpeed 4.66 -0.39 34.15 1.14 -0.11 20.02 4.11 -0.38 43.05
SlideEditing 3.52 -0.50 31.69 2.42 -0.13 13.70 2.18 -0.34 38.84
Average 4.79 -0.25 34.64 2.85 -0.36 15.47 2.69 -0.22 36.74
TABLE II: BD-Bitrate(%), BD-PSNR(dB) and Time Saving(%) of the Proposed and Relative Approach

We compare our proposed approach with other relative approaches by Liu et al. [3] and Cen et al. [9] on our aforementioned experimental environment. Cen’s approach initially calculates the rarest depth (0 or 3) which will be skipped in subsequent algorithm, and then CU depth is determined from the remaining depths by the comparison algorithm with adjacent CUs. The experimental results are shown in Table II, including the Bjontegaard delta bitrate(BD-BR), Bjontegaard delta peak signal-to-noise(BD-PSNR) [10] and the encoding time saving (TS) of three approaches with original HM encoder as anchor. And the time saving is given by


where and is the encoding time of original and proposed encoder respectively.

Firstly, the proposed approach reduce 36.74% computational complexity on average, and specifically at maximum 43.40% in “BQTerrace”. As the brute-force RDO quad-tree search in original HM is skipped, the proposed approach is able to reduce such computational complexity. Because the calculation of range of CU luma samples is fast and easy, our novel early-termination algorithm also assist to mitigate compuational complexity further. Compared to the approach by Cen et al. [9], their approach reduces only 15.47% encoding time and the proposed approach saves much more encoding time.

In addition, the proposed approach reach a better RD performance with 2.69% BD-BR increment and 0.22dB BD-PSNR decrease. As our two-stage approach has considerable accuracy on CU partition mode prediction, so that RD performance can not be aggravated. The approach by Cen et al. [9] has 2.85% BD-BR increment which is higher than our approach.

Moreover, the shallow and narrow CNN-based approach by Liu et al. [3] on dedicated hardware incurs 4.79% BD-BR rise. However, our proposed approach achieves lower 2.69% BD-BR rise. Thus our large-scale CNN-based approach has stronger ability to extract and generalize CU features, but with relatively more computation burden on general hardware. And the simple early-termination algorithm based on the range of CU luma samples mitigates this issue without accuracy loss. Higher accuracy of CU partition estimation of the proposed two-stage approach makes great contribution to lower BD-BR rise.

Therefore, experimental results indicate that the proposed approach on CU partition acceleration outperforms conventional method in HM 16.18 with 36.74% encoding time saving and negligible BD-BR increment. In terms of both RD performance and encoding time saving the proposed approach is better than other approaches in [3] and [9].

Iv Conclusion

In this paper, we proposed a novel CU partition decision approach in HEVC, which has been proved to have ability to reduce encoding time without significantly impairing RD performance. As presented above, the proposed approach has two stages in which range of CU luma samples and three CNNs targeting each CU size are utilized to decide a CU partition mode. Relieving computational complexity of CU partition decision, the proposed approach reduces nearly 37% encoding time with ignorable 2.69% BD-BR rise in comparison with the original HM 16.18 encoder.