HEVC coding method and device based on semantic enhancement
The semantic enhancement of HEVC encoding is performed through deep neural networks, and the pre-trained CTU segmentation result prediction model is used to optimize the encoding process. This solves the problems of computational complexity and deployment cost in HEVC encoding technology, and achieves efficient encoding performance and low-cost deployment.
Patent Information
- Application Number
- CN202410972632.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-07-19
AI Technical Summary
Existing HEVC coding technology cannot take into account computational complexity, deployment cost, and coding performance at the same time. More complex neural networks can better extract video features but increase computational complexity, while simpler neural networks have difficulty extracting features accurately.
The semantic enhancement method based on deep neural network is used to predict the CTU segmentation of the video to be encoded through the pre-trained CTU segmentation result prediction model, optimizing the rate-distortion optimization in the encoding process and reducing encoding time and deployment costs.
Without changing the coding performance, it saves coding time and reduces deployment costs, achieving HEVC coding effects with low computational complexity and low deployment costs.
Smart Images

Figure CN118764644A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a HEVC encoding method and device based on semantic enhancement. Background Art
[0002] High Efficiency Video Coding (HEVC) is the latest video encoding and decoding standard released in 2013 as the successor to the H.264 / AVC standard. With the increasing demand for high-resolution video, HEVC introduced some new coding technologies, such as Coding Tree Unit (CTU). Due to this more complex coding technology and larger coding units, HEVC achieved a bit rate reduction of about 50% compared to the previous generation, but the computational complexity of the encoding process has greatly increased. In CTU, rate-distortion optimization needs to be traversed to determine the optimal coding unit depth and prediction unit mode, which leads to high encoding time and computational overhead, and the cost of deploying HEVC coding in real-time applications is high.
[0003] Since the release of HEVC, there have been many works to optimize different parts of encoding to reduce encoding complexity, such as dynamically adjusting encoding settings for each Group of Pictures (GOP) during the encoding process, and reducing the depth of the Largest Coding Unit (LCU) by solving a distortion-complexity equation based on the concept of subjective weights to achieve the effect of controlling encoding complexity. In HEVC, CTU segmentation technology was introduced, which significantly reduced the bit rate through more refined image segmentation, but also greatly increased the encoding complexity. In the HEVC standard reference software (HEVC test Model, HM), CTU segmentation occupies about 80% of the encoding time, so there is a lot of work aimed at simplifying the CTU segmentation process to reduce encoding complexity.
[0004] Generally speaking, the work of optimizing CTU segmentation can be divided into two categories: heuristic methods and learning-based methods. Heuristic methods refer to determining the CTU segmentation in advance based on the intermediate features of the encoding process to avoid the encoder traversing all possible segmentations.
[0005] Due to the randomness of feature selection in heuristic methods, learning-based methods have been developed to address these problems. This method can learn from the CTU segmentation data of a large number of videos and form the optimal model for predicting the CTU segmentation results in HEVC. Compared with the heuristic method, the learning-based CTU segmentation prediction method increases the computing and storage resource consumption brought by the model and neural network to a certain extent, but it also achieves higher prediction accuracy and better encoding performance.
[0006] However, existing technologies cannot take into account computational complexity, deployment cost and encoding performance at the same time. More complex neural networks can better extract features of different types of videos, but will also bring about corresponding increases in deployment costs and scale, thereby increasing training and computational complexity; simpler neural networks have lower computational complexity themselves, but may find it difficult to accurately extract features from videos. Summary of the invention
[0007] The present invention provides a HEVC encoding method and device based on semantic enhancement, which are used to solve the defect that the prior art cannot take into account the computational complexity, deployment cost and encoding performance at the same time, and realize HEVC encoding with low computational complexity, low deployment cost and good performance.
[0008] The present invention provides a HEVC encoding method based on semantic enhancement, comprising: Get the original encoded video and the video to be encoded; Inputting the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model in sequence to obtain a CTU segmentation prediction result; encoding the video to be encoded according to the original encoding; Performing a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target encoding; The CTU segmentation result prediction model is obtained by training a deep neural network using massive video file samples.
[0009] According to a semantic enhancement-based HEVC encoding method provided by the present invention, the image frames of the video to be encoded are sequentially input into a pre-trained CTU segmentation result prediction model to obtain a CTU segmentation prediction result, specifically comprising: Divide the CTU of the image frame into a preset number of CUs; Convolution and pooling are performed on the CTU to obtain a first tensor; convolution and pooling are performed on the current CU to be predicted to obtain a second tensor; Concatenate the first tensor and the second tensor to obtain a target tensor; The target tensor is input into the CTU segmentation result prediction model to obtain the CU segmentation prediction result of the current CU to be predicted, and the CTU segmentation prediction result is obtained according to all the CU segmentation prediction results.
[0010] According to a semantic enhancement-based HEVC encoding method provided by the present invention, the rate-distortion optimization process in the encoding process is performed according to the CTU segmentation prediction result to obtain the target encoding, specifically including: When encoding the current frame of the video to be encoded according to the original encoding, reading the CTU segmentation prediction result of the current frame to obtain a preset number of CU segmentation prediction results; In the process of encoding each CTU of the current frame, recording a current segmentation depth; When the current segmentation depth is less than the CU segmentation prediction result, skipping the CU rate-distortion optimization of the current segmentation depth; When the current segmentation depth is equal to the CU segmentation prediction result, calculating the CU rate-distortion optimization of the current segmentation depth, and stopping searching for the next segmentation depth; When the current segmentation depth is greater than the CU segmentation prediction result, the current CU is jumped out.
[0011] According to a semantic enhancement-based HEVC encoding method provided by the present invention, the CTU segmentation result prediction model is obtained by training a massive video file sample based on a deep neural network, specifically comprising: Get a large number of video file samples,
[0012] Modifying the original code, running the modified original code to encode the video file sample, and obtaining optimal segmentation information of the current CTU, as well as the current frame number and the current CTU number in the encoding process; Randomly extracting approximately a preset percentage of frame images from the video file sample as frame data samples, and extracting CTU optimal segmentation information of the frame data sample from a storage location of the optimal segmentation information of the current CTU as a label of the frame data sample; Obtaining a training data sample according to all the current frame numbers, the current CTU numbers, the optimal segmentation information of the current CTU, the frame data samples and the labels of the frame data samples of each of the video file samples, and then obtaining a sample data set; A prediction model is constructed based on a deep neural network, and the prediction model is trained using the sample data set until a preset end condition is reached to obtain the CTU segmentation result prediction model.
[0013] According to a semantic enhancement-based HEVC encoding method provided by the present invention, the prediction model includes 2 maximum pooling layers and 3 fully connected layers.
[0014] According to a semantic enhancement-based HEVC encoding method provided by the present invention, the preset number is 4.
[0015] The present invention also provides a HEVC encoding device based on semantic enhancement, comprising: An acquisition unit, used for acquiring original coded videos and videos to be coded; The encoding and prediction unit is used to sequentially input the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model to obtain a CTU segmentation prediction result; and encode the video to be encoded according to the original encoding; An optimization unit, configured to perform a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target encoding; The CTU segmentation result prediction model is obtained by training a deep neural network using massive video file samples.
[0016] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the HEVC encoding method based on semantic enhancement as described above is implemented.
[0017] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the HEVC encoding method based on semantic enhancement as described above is implemented.
[0018] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the HEVC encoding method based on semantic enhancement as described above is implemented.
[0019] The HEVC encoding method and device based on semantic enhancement provided by the present invention obtain the original code and the video to be encoded; input the image frames of the video to be encoded into the pre-trained CTU segmentation result prediction model in sequence to obtain the CTU segmentation prediction result; encode the video to be encoded according to the original code; perform the rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain the target code; wherein the CTU segmentation result prediction model is obtained by training a large number of video file samples based on a deep neural network. The present invention uses a deep neural network to extract semantic information to predict the CTU segmentation result, optimizes the rate-distortion optimization traversal process according to the prediction result of the neural network, thereby optimizing the encoding method and saving encoding time without changing the encoding performance. At the same time, since the present invention is combined with the existing code, it can be easily deployed and applied, saving deployment costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 This is one of the flow charts of the HEVC encoding method based on semantic enhancement provided by the present invention; Figure 2 It is a schematic diagram of the architecture of a CTU segmentation result prediction model in a HEVC encoding method based on semantic enhancement provided by the present invention; Figure 3 This is the second flow chart of the HEVC encoding method based on semantic enhancement provided by the present invention; Figure 4 It is a structural schematic diagram of a HEVC encoding device based on semantic enhancement provided by the present invention; Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention.
[0022] Reference numerals: 410: acquisition unit; 420: encoding and prediction unit; 430: optimization unit. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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.
[0024] Combine the following Figure 1-Figure 3 Describe the HEVC encoding method based on semantic enhancement of the present invention, Figure 1 It is one of the flow charts of the HEVC encoding method based on semantic enhancement provided by the present invention, such as Figure 1 As shown, the method includes: Step 110: Obtain the original encoded video and the video to be encoded.
[0025] It should be noted that the obtained original code is the original code executable by the HEVC (High Efficiency Video Coding) standard reference software (HEVC test Model, HM). The obtained video to be encoded includes the video of the video conference scene.
[0026] The present invention is combined with the code of HEVC standard software to facilitate deployment and application, thereby reducing deployment costs.
[0027] Step 120: input the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model in sequence to obtain a CTU segmentation prediction result; and encode the video to be encoded according to the original encoding.
[0028] It should be noted that the CTU segmentation result prediction model extracts features from each CTU (Coding Tree Unit) of each image frame of the input video (video to be encoded), and outputs a vector as the CTU segmentation prediction result. In some embodiments, the length of the output vector is 16. The basic architecture of the CTU segmentation result prediction model is as follows: Figure 2 shown.
[0029] In the process of performing segmentation prediction, in some embodiments, sequentially inputting the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model to obtain a CTU segmentation prediction result specifically includes: Divide the CTU of the image frame into a preset number of CUs; Convolution and pooling are performed on the CTU to obtain a first tensor; convolution and pooling are performed on the current CU to be predicted to obtain a second tensor; Concatenate the first tensor and the second tensor to obtain a target tensor; The target tensor is input into the CTU segmentation result prediction model to obtain the CU segmentation prediction result of the current CU to be predicted, and the CTU segmentation prediction result is obtained according to all the CU segmentation prediction results.
[0030] Specifically, in the prior art, in each 64×64 CTU, the HEVC encoder will continuously divide the CTU into four parts to the smallest 8×8 coding unit (CU), and calculate the rate-distortion cost for each possible division in the process. This traversal process will take a lot of time.
[0031] Based on this, this embodiment divides each CTU into a preset number of CUs that are relatively larger than those in the prior art as input through a CTU segmentation result prediction model, so that a preset number of label values are obtained each time prediction, and each label value is a CU segmentation prediction result. In the vector output by the CTU segmentation result prediction model, the CU segmentation prediction result is part of the CTU segmentation prediction result.
[0032] In a specific embodiment, the preset number is 4, that is, each CTU is divided into 4 32×32 CUs.
[0033] It should be pointed out that it is not enough to only predict the segmentation of the CU, because HM will perform rate-distortion optimization on all 64×64 CTUs. If the prediction of whether the 64×64 CTU is segmented is skipped, the coding complexity calculated by the HM is still high. In order to solve this problem, the present invention convolves and pools the entire 64×64 CTU to obtain a first tensor, and convolves and pools the current CU to be predicted to obtain a second tensor. The two tensors are concatenated for subsequent neural network processing to obtain the CU segmentation prediction result of each CU. The CTU segmentation prediction result is obtained based on all CU segmentation prediction results. In a specific embodiment, each CTU is divided into 4 32×32 CUs, and the tensor dimension obtained is 16×16.
[0034] That is to say, firstly, the 64×64 CTU is divided into 4 32×32 CTUs, and one of them is taken each time, and convolution pooled with the original CTU respectively, and then spliced to obtain 4×4, 128 channel data. After that, the above 4×4, 128 channel data is input into 3 fully connected layers to obtain a 1×4 prediction output. Secondly, the 4 32×32 CTUs obtained by segmentation are subjected to the above operations, and 4 1×4 outputs are spliced as the final 1×16 CTU segmentation prediction result.
[0035] The above processing of the input CTU not only ensures the prediction of CUs of all depths, but also makes the neural network only need to output a preset number of prediction values at a time, reducing the network complexity and training costs.
[0036] It should be noted that the CTU segmentation result prediction model is obtained based on a deep neural network trained using massive video file samples.
[0037] In some embodiments, the CTU segmentation result prediction model is obtained by training with a large number of video file samples based on a deep neural network, specifically including: Get a large number of video file samples,
[0038] Modifying the original code, running the modified original code to encode the video file sample, and obtaining optimal segmentation information of the current CTU, as well as the current frame number and the current CTU number in the encoding process; Randomly extracting approximately a preset percentage of frame images from the video file sample as frame data samples, and extracting CTU optimal segmentation information of the frame data sample from a storage location of the optimal segmentation information of the current CTU as a label of the frame data sample; Obtaining a training data sample according to all the current frame numbers, the current CTU numbers, the optimal segmentation information of the current CTU, the frame data samples and the labels of the frame data samples of each of the video file samples, and then obtaining a sample data set; A prediction model is constructed based on a deep neural network, and the prediction model is trained using the sample data set until a preset end condition is reached to obtain the CTU segmentation result prediction model.
[0039] Specifically, a sample data set is first constructed. It can be understood that the compressCtu() function in the HM code performs optimal segmentation calculation on the CTU. In the process of the optimal segmentation calculation, the optimal CTU segmentation is saved in a variable. Then, the optimal segmentation information of the current CTU can be obtained by outputting the variable to a file, and the information is expressed as a segmentation matrix. In a specific embodiment, the information is expressed as a 16×16 segmentation matrix. Similarly, the current frame number and the current CTU number can be output to a text file. After obtaining the optimal segmentation file of the CTU, the segmentation matrix is processed to form a label value for neural network training. In a specific embodiment, the data processing includes converting a 16×16 matrix into a 1×16 vector.
[0040] In the specific implementation process, a video file sample is first obtained. The video file sample can be video file data collected on the spot according to the training target, or it can be video file data obtained from a database, and the present invention does not limit this. Accordingly, the format of the video file sample can also be selected according to actual needs. In a specific embodiment, the format of the video file sample is a yuv video file.
[0041] Furthermore, in some embodiments, the massive video file samples are divided into three folders: training, testing, and verification, so as to construct the training set, the test set, and the verification set. In some embodiments, the file name can be named [video name]_[video width] [Video height]_[frame rate].yuv.
[0042] After obtaining the video file sample, modify the original encoding to extract information. Specifically, modify the library function of the HM software so that it can output the current frame number, current CTU number, and optimal segmentation information of the current CTU saved during the encoding process. For a video file sample, use the modified HM to encode it to obtain the optimal segmentation information file, then randomly extract frame images from the video file sample as data, and extract the CTU segmentation information of the corresponding frame from the optimal segmentation information file and save it as a label.
[0043] Specifically, the modified HM is run, the video file samples are input in sequence, and the input video file sample videos are encoded, and the CTU optimal partition matrix in the process is saved to Partitiontxt. After that, each frame of the current video file sample is cropped and numbered to obtain the frame number. In some embodiments, ffmpeg is called to crop each frame of the current video file sample.
[0044] Afterwards, a preset percentage of frames are randomly selected from all the cropped frame images as frame data samples and saved, and the frame number and the number of CTUs contained in the frame are saved. In a specific embodiment, press v_[video number]_[number]_[number of CTUs].jpg to save to the corresponding subfolder in the image folder for final output. In a specific embodiment, the preset percentage is 10%.
[0045] Further, the frame image name saved in is read, and the corresponding CTU partition information in Partition.txt is searched accordingly, the CTU partition matrix is converted into a vector, and it is saved as a label of the frame data sample. In some embodiments, the CTU partition matrix is 16 16 matrix, convert it to 1 The vector of 16 is saved to the corresponding subfolder in the pkl folder for final output.
[0046] The final output is the saved frame data sample and the label of the frame data sample. The frame data sample includes the frame number and the number of CTUs contained in the frame, and the label of the frame data sample includes the CTU optimal segmentation information.
[0047] As the encoding proceeds, the current frame numbers of all frames of each video file sample, the current CTU numbers of all CTUs in each frame, and the optimal segmentation information of the current CTU are obtained.
[0048] The constructed sample data set is input into the CNN neural network for training, and a model capable of predicting the CTU segmentation result in video encoding under the HEVC standard can be obtained until a preset end condition is reached. In a specific embodiment, the preset end condition includes stable convergence of training loss.
[0049] In some embodiments, the prediction model includes 2 maximum pooling layers and 3 fully connected layers. In addition, it should be noted that the present invention does not limit the training and parameter optimization process of the CTU segmentation result prediction model, and training can be performed according to actual conditions.
[0050] Further, it should be emphasized that, while the CTU segmentation result prediction model performs CTU segmentation result prediction, the to-be-encoded video is encoded according to the original encoding.
[0051] Step 130: performing a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target encoding; After obtaining the CTU segmentation prediction result, it is still necessary to use the CTU segmentation prediction result to optimize and replace the rate-distortion optimization process in HEVC, so as to achieve the effect of skipping traversal and saving encoding time.
[0052] Specifically, since the CTU segmentation result prediction model is encoding the video to be encoded according to the original encoding while predicting the CTU segmentation result, during the encoding process, when the modified original encoding is run, a python file will be called first to crop each frame of the input video to be encoded, save it in a temporary folder, and input each frame image into the CTU segmentation result prediction model, call the trained model for prediction, and the prediction result will also be saved in the temporary folder in the format of a txt file.
[0053] At the same time, the original code starts to segment the current CTU, obtains the number of the current frame through the added member variables and member functions, and the original code itself saves the number of the current CTU. Through the current frame number and the current CTU number, try to read the CTU segmentation prediction result saved in the temporary file output by the CTU segmentation result prediction model. If the reading is successful, start the next segmentation. If the reading is unsuccessful, wait until the reading is successful. It should be noted that the waiting design is because the original code and the CTU segmentation result prediction model prediction are run in parallel.
[0054] After the CTU segmentation prediction result is read successfully, the CTU segmentation rate-distortion optimization function in the original encoding will compare the current CU depth with the predicted depth in the CU segmentation prediction result of the current CU included in the CTU segmentation prediction result, and perform optimization replacement according to the comparison result to obtain the target encoding.
[0055] In some embodiments, performing the rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain the target encoding specifically includes: When encoding the current frame of the video to be encoded according to the original encoding, reading the CTU segmentation prediction result of the current frame to obtain a preset number of CU segmentation prediction results; In the process of encoding each CTU of the current frame, recording a current segmentation depth; When the current segmentation depth is less than the CU segmentation prediction result, skipping the CU rate-distortion optimization of the current segmentation depth; When the current segmentation depth is equal to the CU segmentation prediction result, calculating the CU rate-distortion optimization of the current segmentation depth, and stopping searching for the next segmentation depth; When the current segmentation depth is greater than the CU segmentation prediction result, the current CU is jumped out.
[0056] Specifically, after the CTU segmentation prediction result is read successfully, each CTU segmentation prediction result includes a preset number of CU segmentation prediction results. The current CU segmentation depth is compared with the prediction depth in the CU segmentation prediction result corresponding to the current CU.
[0057] If the current depth < predicted depth, skip the distortion calculation for the current depth and directly perform segmentation. If the current depth = predicted depth, directly calculate the distortion measure for the current depth and stop searching for the next depth. If the current depth > predicted depth, skip the calculation for the current depth and stop searching for the next depth (i.e., consider that segmentation has been completed).
[0058] It can be understood that when the current depth ≤ the predicted depth, distortion calculation is still performed. This is because after the CTU is segmented and the CU mode is determined, rate-distortion optimization is still required for each CU to determine the optimal PU and TU modes.
[0059] In some embodiments, a horizontal comparison is made between the encoding results of the present invention and the prior art based on the same quantization parameter QP on different video sequences. The results show that the method proposed in the present invention significantly shortens the encoding time in HEVC encoding of video conferencing type videos at the cost of a slight increase in bit rate and a negligible decrease in PSNR.
[0060] The HEVC encoding method based on semantic enhancement provided by the present invention obtains the original code and the video to be encoded; inputs the image frames of the video to be encoded into the pre-trained CTU segmentation result prediction model in sequence to obtain the CTU segmentation prediction result; encodes the video to be encoded according to the original code; executes the rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain the target code; wherein the CTU segmentation result prediction model is obtained by training a large number of video file samples based on a deep neural network. The present invention uses a deep neural network to extract semantic information to predict the CTU segmentation result, optimizes the rate-distortion optimization traversal process according to the prediction result of the neural network, thereby optimizing the encoding method and saving encoding time without changing the encoding performance. At the same time, since the present invention is combined with the existing code, it can be easily deployed and applied, saving deployment costs.
[0061] The HEVC encoding device based on semantic enhancement provided by the present invention is described below. The HEVC encoding device based on semantic enhancement described below and the HEVC encoding method based on semantic enhancement described above can refer to each other. Figure 4 is a structural schematic diagram of a HEVC encoding device based on semantic enhancement provided by the present invention, such as Figure 4 As shown, the device comprises: The acquisition unit 410 is used to acquire the original encoded video and the video to be encoded; The encoding and prediction unit 420 is used to sequentially input the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model to obtain a CTU segmentation prediction result; and encode the video to be encoded according to the original encoding; The optimization unit 430 is used to perform a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target encoding; The CTU segmentation result prediction model is obtained by training a deep neural network using massive video file samples.
[0062] According to a semantic enhancement-based HEVC encoding device provided by the present invention, the image frames of the video to be encoded are sequentially input into a pre-trained CTU segmentation result prediction model to obtain a CTU segmentation prediction result, specifically including: Divide the CTU of the image frame into a preset number of CUs; Convolution and pooling are performed on the CTU to obtain a first tensor; convolution and pooling are performed on the current CU to be predicted to obtain a second tensor; Concatenate the first tensor and the second tensor to obtain a target tensor; The target tensor is input into the CTU segmentation result prediction model to obtain the CU segmentation prediction result of the current CU to be predicted, and the CTU segmentation prediction result is obtained according to all the CU segmentation prediction results.
[0063] According to a HEVC encoding device based on semantic enhancement provided by the present invention, the rate-distortion optimization process in the encoding process is performed according to the CTU segmentation prediction result to obtain the target encoding, which specifically includes: When encoding the current frame of the video to be encoded according to the original encoding, reading the CTU segmentation prediction result of the current frame to obtain a preset number of CU segmentation prediction results; In the process of encoding each CTU of the current frame, recording a current segmentation depth; When the current segmentation depth is less than the CU segmentation prediction result, skipping the CU rate-distortion optimization of the current segmentation depth; When the current segmentation depth is equal to the CU segmentation prediction result, calculating the CU rate-distortion optimization of the current segmentation depth, and stopping searching for the next segmentation depth; When the current segmentation depth is greater than the CU segmentation prediction result, the current CU is jumped out.
[0064] According to a semantic enhancement-based HEVC encoding device provided by the present invention, the CTU segmentation result prediction model is obtained by training with massive video file samples based on a deep neural network, specifically comprising: Get a large number of video file samples,
[0065] Modifying the original code, running the modified original code to encode the video file sample, and obtaining optimal segmentation information of the current CTU, as well as the current frame number and the current CTU number in the encoding process; Randomly extracting approximately a preset percentage of frame images from the video file sample as frame data samples, and extracting CTU optimal segmentation information of the frame data sample from a storage location of the optimal segmentation information of the current CTU as a label of the frame data sample; Obtaining a training data sample according to all the current frame numbers, the current CTU numbers, the optimal segmentation information of the current CTU, the frame data samples and the labels of the frame data samples of each of the video file samples, and then obtaining a sample data set; A prediction model is constructed based on a deep neural network, and the prediction model is trained using the sample data set until a preset end condition is reached to obtain the CTU segmentation result prediction model.
[0066] According to a semantic enhancement-based HEVC encoding device provided by the present invention, the prediction model includes 2 maximum pooling layers and 3 fully connected layers.
[0067] According to a semantically enhanced HEVC encoding device provided by the present invention, the preset number is 4.
[0068] The HEVC encoding device based on semantic enhancement provided by the present invention obtains the original code and the video to be encoded; inputs the image frames of the video to be encoded into the pre-trained CTU segmentation result prediction model in sequence to obtain the CTU segmentation prediction result; encodes the video to be encoded according to the original code; executes the rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain the target code; wherein the CTU segmentation result prediction model is obtained by training a large number of video file samples based on a deep neural network. The present invention uses a deep neural network to extract semantic information to predict the CTU segmentation result, optimizes the rate-distortion optimization traversal process according to the prediction result of the neural network, thereby optimizing the encoding method and saving encoding time without changing the encoding performance. At the same time, since the present invention is combined with the existing code, it can be easily deployed and applied, saving deployment costs.
[0069] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the HEVC encoding method based on semantic enhancement, the method comprising: obtaining the original code and the video to be encoded; inputting the image frames of the video to be encoded into the pre-trained CTU segmentation result prediction model in sequence to obtain the CTU segmentation prediction result; encoding the video to be encoded according to the original code; performing the rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain the target code; wherein the CTU segmentation result prediction model is obtained by training a deep neural network using a large number of video file samples.
[0070] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0071] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the semantically enhanced HEVC encoding method provided by the above methods, the method including: obtaining the original code and the video to be encoded; inputting the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model in sequence to obtain a CTU segmentation prediction result; encoding the video to be encoded according to the original code; performing a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target code; wherein the CTU segmentation result prediction model is obtained based on a deep neural network trained using massive video file samples.
[0072] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the semantically enhanced HEVC encoding method provided by the above-mentioned methods, the method comprising: obtaining the original code and the video to be encoded; inputting the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model in sequence to obtain a CTU segmentation prediction result; encoding the video to be encoded according to the original code; performing a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target code; wherein the CTU segmentation result prediction model is obtained based on a deep neural network trained using massive video file samples.
[0073] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0074] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0075] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A HEVC encoding method based on semantic enhancement, characterized in that: include: Get the original encoded video and the video to be encoded; Inputting the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model in sequence to obtain a CTU segmentation prediction result; Encoding the video to be encoded according to the original encoding; Performing a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target encoding; The CTU segmentation result prediction model is obtained by training a deep neural network using massive video file samples.
2. The HEVC encoding method based on semantic enhancement according to claim 1, characterized in that The step of sequentially inputting the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model to obtain a CTU segmentation prediction result specifically includes: Divide the CTU of the image frame into a preset number of CUs; Convolution and pooling are performed on the CTU to obtain a first tensor; convolution and pooling are performed on the current CU to be predicted to obtain a second tensor; Concatenate the first tensor and the second tensor to obtain a target tensor; The target tensor is input into the CTU segmentation result prediction model to obtain the CU segmentation prediction result of the current CU to be predicted, and the CTU segmentation prediction result is obtained according to all the CU segmentation prediction results.
3. The HEVC encoding method based on semantic enhancement according to claim 2, characterized in that: The performing the rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain the target encoding specifically includes: When encoding the current frame of the video to be encoded according to the original encoding, reading the CTU segmentation prediction result of the current frame to obtain a preset number of CU segmentation prediction results; In the process of encoding each CTU of the current frame, recording a current segmentation depth; When the current segmentation depth is less than the CU segmentation prediction result, skipping the CU rate-distortion optimization of the current segmentation depth; When the current segmentation depth is equal to the CU segmentation prediction result, calculating the CU rate-distortion optimization of the current segmentation depth, and stopping searching for the next segmentation depth; When the current segmentation depth is greater than the CU segmentation prediction result, the current CU is jumped out.
4. The HEVC encoding method based on semantic enhancement according to claim 1, characterized in that: The CTU segmentation result prediction model is obtained by training a large number of video file samples based on a deep neural network, specifically including: Get a large number of video file samples, Modifying the original code, running the modified original code to encode the video file sample, and obtaining optimal segmentation information of the current CTU, as well as the current frame number and the current CTU number in the encoding process; Randomly extracting approximately a preset percentage of frame images from the video file sample as frame data samples, and extracting CTU optimal segmentation information of the frame data sample from a storage location of the optimal segmentation information of the current CTU as a label of the frame data sample; Obtaining a training data sample according to all the current frame numbers, the current CTU numbers, the optimal segmentation information of the current CTU, the frame data samples and the labels of the frame data samples of each of the video file samples, and then obtaining a sample data set; A prediction model is constructed based on a deep neural network, and the prediction model is trained using the sample data set until a preset end condition is reached to obtain the CTU segmentation result prediction model.
5. The HEVC encoding method based on semantic enhancement according to claim 1, characterized in that: The prediction model includes 2 maximum pooling layers and 3 fully connected layers.
6. The HEVC encoding method based on semantic enhancement according to claim 2, characterized in that: The preset number is 4.
7. A HEVC encoding device based on semantic enhancement, characterized in that: include: An acquisition unit, used for acquiring original coded videos and videos to be coded; The encoding and prediction unit is used to sequentially input the image frames of the video to be encoded into a pre-trained CTU segmentation result prediction model to obtain a CTU segmentation prediction result; and encode the video to be encoded according to the original encoding; An optimization unit, configured to perform a rate-distortion optimization process in the encoding process according to the CTU segmentation prediction result to obtain a target encoding; The CTU segmentation result prediction model is obtained by training a deep neural network using massive video file samples.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the HEVC encoding method based on semantic enhancement as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the HEVC encoding method based on semantic enhancement as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the HEVC encoding method based on semantic enhancement as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Block partitioning coding complexity optimization method and device based on deep learning method
CN108495129A
HEVC intra-frame coding fast mode decision algorithm based on ResNet
CN109905712A
H.266VVC screen content intra-frame CU rapid division method and device based on multi-task learning
CN117014610A
Ai prediction for video compression
US20220345715A1
