Model training method, video coding method, electronic equipment and storage medium

By training the initial quantization parameter control model and the initial reward model, the target quantization parameter control model is obtained using proximal strategy optimization, and the quantization parameter control is performed on the video to be encoded, which solves the problem of video quality degradation at low bit rates and achieves high-quality video Coding, suitable for a variety of application scenarios.

CN118540476APending Publication Date: 2024-08-23ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410455472.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-15
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

It is difficult for the existing technology to maintain the high quality and details of the encoded video at a low bit rate, especially to ensure the high quality of the video content while saving storage space and transmission bandwidth.

Method used

By training the initial quantization parameter control model and the initial reward model, the target quantization parameter control model is obtained using proximal strategy optimization, and the quantization parameter control is performed on the video to be encoded to ensure that the encoded video has a lower bit rate and the decoded video has high quality.

Benefits of technology

It achieves reducing the amount of video data while maintaining high-quality and detailed video content, improving the stability and reliability of encoded videos, and is suitable for live video and vehicle video encoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540476A
    Figure CN118540476A
Patent Text Reader

Abstract

The invention provides a model training method, a video coding method, electronic equipment and a storage medium, and relates to the technical field of computer vision. The model training method comprises the following steps: training to obtain at least one initial quantization parameter control model and an initial reward model; and for each initial quantization parameter control model, taking input data of the initial quantization parameter control model as state data, taking output data of the initial quantization parameter control model as action data, taking output data of the initial reward model as reward data, and performing near-end strategy optimization on the initial quantization parameter control model to obtain the initial quantization parameter control model. And obtaining a corresponding target quantization parameter control model. According to the technical scheme, some difficult situations in reinforcement learning can be better handled, and the target quantization parameter control model can have better stability and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to model training, video encoding methods, electronic devices and storage media. Background Art

[0002] While reducing the amount of data in the encoded video to save storage space and transmission bandwidth, maintaining the high quality and details of the video content decoded after encoding as much as possible has always been the goal pursued by relevant technical personnel. In order to achieve this goal, it is necessary to ensure that the video decoded after encoding has a higher video quality when the encoded video has a lower bit rate.

[0003] In order to make the encoded video have a lower bit rate and the decoded video have a higher video quality, it is often necessary to control the quantization parameters of each video in the encoded video. Therefore, how to control the quantization parameters of each video in the encoded video has become a technical problem that needs to be solved urgently by relevant technicians. Summary of the invention

[0004] The embodiments of the present application provide model training, video encoding methods, electronic devices and storage media to solve one or more of the above-mentioned technical problems.

[0005] In a first aspect, an embodiment of the present application provides a model training method, comprising:

[0006] Train to obtain at least one initial quantization parameter control model and an initial reward model;

[0007] For each initial quantization parameter control model, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data. The initial quantization parameter control model is subjected to proximal strategy optimization to obtain the corresponding target quantization parameter control model.

[0008] In a second aspect, an embodiment of the present application provides a video encoding method, including:

[0009] Get the target video to be encoded;

[0010] Inputting a target video to be encoded and a set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtaining a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on proximal strategy optimization of a pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes input data of the initial quantization parameter control model, the action data includes output data of the initial quantization parameter control model, and the reward data includes output data of the pre-trained initial reward model;

[0011] According to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

[0012] In a third aspect, an embodiment of the present application provides a video encoding method, including:

[0013] The live video collected by the anchor end is determined as the target video to be encoded;

[0014] Inputting a target video to be encoded and a set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtaining a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on proximal strategy optimization of a pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes input data of the initial quantization parameter control model, the action data includes output data of the initial quantization parameter control model, and the reward data includes output data of the pre-trained initial reward model;

[0015] According to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

[0016] In a fourth aspect, an embodiment of the present application provides a video encoding method, including:

[0017] The vehicle surrounding environment video collected by the vehicle-mounted video collection device is determined as the target video to be encoded;

[0018] Inputting a target video to be encoded and a set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtaining a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on proximal strategy optimization of a pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes input data of the initial quantization parameter control model, the action data includes output data of the initial quantization parameter control model, and the reward data includes output data of the pre-trained initial reward model;

[0019] According to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

[0020] In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, and the processor implements the method provided in any embodiment of the present application when executing the computer program.

[0021] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method provided in any embodiment of the present application is implemented.

[0022] Compared with the prior art, this application has the following advantages:

[0023] The technical solution of the present application, after training to obtain at least one initial quantization parameter control model and an initial reward model, will further optimize the proximal strategy of each initial quantization parameter control model by using the input data of the initial quantization parameter control model as state data, the output data of the initial quantization parameter control model as action data, and the output data of the initial reward model as reward data for each initial quantization parameter control model, so as to obtain the corresponding target quantization parameter control model. The target quantization parameter control model obtained by proximal strategy optimization can control the quantization parameters of each video in the video to be encoded, thereby ensuring that the video decoded after encoding has a high video quality when the encoded video has a low bit rate, and thus can reduce the amount of data of the encoded video to save storage space and transmission bandwidth while maintaining the high quality and details of the video content decoded after encoding as much as possible.

[0024] At the same time, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data to perform proximal strategy optimization on each initial quantization parameter control model to obtain the corresponding target quantization parameter control model, which can not only better cope with some difficult situations in reinforcement learning, but also make the target quantization parameter control model have better stability and reliability.

[0025] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.

[0027] Figure 1 A schematic diagram of a live video encoding process provided in an embodiment of the present application is shown;

[0028] Figure 2 A flow chart of a model training method provided in an embodiment of the present application is shown;

[0029] Figure 3 A flowchart of a video encoding method provided in an embodiment of the present application is shown;

[0030] Figure 4 A flowchart of another video encoding method provided in an embodiment of the present application is shown;

[0031] Figure 5 A flowchart of another video encoding method provided in an embodiment of the present application is shown;

[0032] Figure 6 A schematic diagram of a model training device provided in an embodiment of the present application is shown;

[0033] Figure 7 A schematic diagram of a video encoding device provided in an embodiment of the present application is shown; and

[0034] Figure 8 A block diagram of an electronic device used to implement an embodiment of the present application is shown. DETAILED DESCRIPTION

[0035] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other forms different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific implementation disclosed below.

[0036] To facilitate understanding of the technical solutions of the embodiments of the present application, the related technologies of the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application. The embodiments of the present application involve model training schemes and video encoding schemes. Among them, the model training scheme will first train to obtain at least one initial quantization parameter control model and an initial reward model, and then, for each initial quantization parameter control model, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data, and the initial quantization parameter control model is optimized for proximal strategy to obtain the corresponding target quantization parameter control model.

[0037] In the embodiment of the present application, the input data of the quantization parameter control model (including the initial quantization parameter control model and the target quantization parameter control model) involved is the video to be encoded and the set bit rate pre-configured for the encoded video, and the output data includes the specific quantization parameter corresponding to each video frame in the video to be encoded. The encoded video is obtained by performing video encoding on the video to be encoded according to the specific quantization parameter corresponding to each video frame in the video to be encoded.

[0038] Specifically, for the initial quantization parameter control model, the input data of the initial quantization parameter control model includes a sample video to be encoded and a set bit rate pre-configured for a specific encoded video, and the output data of the initial quantization parameter control model includes a specific quantization parameter corresponding to each video frame in the sample video to be encoded. The specific encoded video is obtained by encoding the sample video to be encoded according to the specific quantization parameter corresponding to each video frame in the sample video to be encoded.

[0039] Correspondingly, for the target quantization parameter control model, the input data of the target quantization parameter control model includes the target video to be encoded and the set bit rate pre-configured for the target encoded video, and the output data of the target quantization parameter control model includes the specific quantization parameters corresponding to each video frame in the target video to be encoded. The target encoded video is the encoded video obtained by performing video encoding on the target video to be encoded.

[0040] It should be noted that, in the embodiment of the present application, the quantization parameter (QP) is a coding parameter used for bit rate control. In addition, the state data in the embodiment of the present application also includes: the number of bits used before the current video frame to be encoded in the encoding target video to be encoded, and the image features corresponding to the current video frame to be encoded, etc. Among them, the image features corresponding to the current video frame to be encoded include the grayscale value and variance corresponding to the current video frame to be encoded, etc.

[0041] In an embodiment of the present application, multiple initial quantization parameter control models can be trained separately, or only one initial quantization parameter control model can be trained. In the case of training multiple initial quantization parameter control models, it is necessary to use the input data of the initial quantization parameter control model as state data, the output data of the initial quantization parameter control model as action data, and the output data of the initial reward model as reward data for each initial quantization parameter control model, perform proximal strategy optimization on the initial quantization parameter control model, and obtain the corresponding target quantization parameter control model. That is to say, in the case of training multiple initial quantization parameter control models, the proximal strategy optimization will be performed on the multiple initial quantization parameter control models to obtain the target quantization parameter control model corresponding to each initial quantization parameter control model.

[0042] When multiple target quantization parameter control models are obtained through training, the target quantization parameters corresponding to each video frame in the target video to be encoded can be determined by integrating the output data of the multiple target quantization parameter control models, so as to perform video encoding on the target video to be encoded to obtain the target encoded video.

[0043] In the embodiment of the present application, the initial quantization parameter control model generally refers to: a model trained based on a Dual-Critic (dual evaluator) reinforcement learning (RL) algorithm for determining specific quantization parameters corresponding to each video frame in the video to be encoded. It should be noted that in the embodiment of the present application, other methods can also be used to train the initial quantization parameter control model.

[0044] In the embodiment of the present application, the input data of the initial reward model includes a specific decoded video and a set bit rate and an actual bit rate corresponding to a specific encoded video, and the output data of the initial reward model includes a specific video score corresponding to the specific decoded video. The specific decoded video is obtained based on video decoding of the specific encoded video.

[0045] When using PPO (Proximal Policy Optimization) to optimize the policy model, multiple iterations are involved until the optimized policy model can meet the preset performance standards, or the iteration process has reached the preset number of iterations. In each iteration, multiple episodes are generally executed to collect state data, action data, reward data, and other related information data. Specifically, the state data, action data, reward data, and other related information data collected in each episode will constitute a trajectory, and each trajectory represents a complete episode from start to end.

[0046] After collecting a certain amount of data (state data, action data, reward data, and other relevant information data), the collected data will be used to calculate the advantage estimate of each state-action pair by comparing the actual reward received and the prediction of the value function. Among them, in the process of calculating the advantage estimate, GAE (Generalized Advantage Estimation) can be used to implement the calculation of the advantage estimate. After the advantage estimate is calculated, the advantage estimate is used to update the policy model. Specifically, in PPO, the policy model update usually includes using gradient ascent to maximize the objective function, which combines the policy probability ratio and the advantage function, and uses a clip mechanism to limit the amplitude of the policy model update.

[0047] After completing the update of the policy model, it is generally necessary to use the data collected during this iteration (state data, action data, reward data, and other relevant information data) to update the value function and use the updated value function to implement the next iteration process.

[0048] In the PPO implementation process, in the first iteration, the initial policy model will be used as the policy model to be optimized, and the input data of the initial policy model will be collected as state data, the output data of the initial policy model will be collected as action data, and the output data of the initial reward model will be collected as reward data. After the second iteration, the policy model optimized in the first iteration will be used as the policy model to be optimized, and the input data of the policy model to be optimized will be collected as state data, the output data of the policy model to be optimized will be collected as action data, and the output data of the reward model to be optimized will be collected as reward data. In subsequent iterations, the policy model optimized in the previous iteration will be used as the policy model to be optimized, and the input data of the policy model to be optimized will be collected as state data, the output data of the policy model to be optimized will be collected as action data, and the output data of the reward model to be optimized will be collected as reward data.

[0049] In the process of optimizing the initial quantization parameter control model through proximal policy optimization to obtain the target quantization parameter control model, the quantization parameter control model to be optimized is the policy model to be optimized, and the initial policy model in the first iteration process is the initial quantization parameter control model obtained by training. In this case, in the process of optimizing the initial quantization parameter control model through proximal policy optimization to obtain the target quantization parameter control model, the input data of the initial quantization parameter control model is collected as state data, the output data of the initial quantization parameter control model is collected as action data, and the output data of the initial reward model is collected as reward data, and the proximal policy optimization is performed on the initial quantization parameter control model. That is to say, in the process of optimizing the initial quantization parameter control model through proximal policy optimization to obtain the target quantization parameter control model, the quantization parameter control model to be optimized in the first iteration process is the initial quantization parameter control model, and the input data of the initial quantization parameter control model is collected as state data, the output data of the initial quantization parameter control model is collected as action data, and the output data of the initial reward model is collected as reward data in the first iteration process.

[0050] In an embodiment of the present application, the input data of the initial reward model includes a specific decoded video and a set bit rate and an actual bit rate corresponding to the specific encoded video, and the output data of the initial reward model includes a specific video score corresponding to the specific decoded video.

[0051] In the embodiment of the present application, the video to be encoded is a video that needs to be video encoded, the encoded video is a video obtained after video encoding the video to be encoded, and the decoded video is a video obtained after video decoding the encoded video. In order to facilitate the distinction between the video to be encoded and the decoded video in different scenarios, different names are used for the video to be encoded and the decoded video in different scenarios. Specifically, in the process of training the reward model to be trained to obtain the initial reward model, the decoded video input into the reward model to be trained is named as a sample decoded video, the sample decoded video is obtained based on video decoding of the specified encoded video, and the specified encoded video is obtained based on video encoding of the specified video to be encoded. In the process of performing proximal strategy optimization on the initial quantization parameter control model, the video to be decoded input into the initial quantization parameter control model is named as a sample video to be encoded, the video obtained after video encoding the sample video to be encoded is called a specific encoded video, and the video obtained after video decoding the specific encoded video is called a specific decoded video. When using at least one trained target quantization parameter control model to encode the video to be encoded, the video to be encoded is called a target video to be encoded, and the encoded video obtained after video encoding the target video to be encoded is called a target encoded video.

[0052] The video encoding scheme involved in this application first inputs the target video to be encoded and the set bit rate pre-configured for the target encoded video into at least one target quantization parameter control model, obtains the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, and then, based on the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, performs video encoding on the target video to obtain the target encoded video. The target video to be encoded includes the live video collected by the anchor terminal or the vehicle surrounding environment video collected by the vehicle-mounted video acquisition device.

[0053] In order to more clearly demonstrate the model training scheme and video encoding scheme provided in the embodiments of the present application, an application example of the model training scheme and video encoding scheme provided in the embodiments of the present application is first introduced. Figure 1 As shown, in this application example, PPO optimization is used to obtain at least one target quantization parameter control model, and at least one target quantization parameter control model obtained through training is used to perform video encoding on the live video collected by the anchor end.

[0054] Specifically, in a live broadcast scenario, after the host collects the live video, it will upload the live video to the server through the real-time transmission protocol, and then the server will distribute the live video to the audience. In order to reduce the bandwidth consumed by transmitting the live video, it is generally necessary to first use the live video as the target video to be encoded, and perform video encoding on the target video to obtain the target encoded video, and then transmit the target encoded video to the server. In order to reduce the data volume of the target encoded video to save storage space and transmission bandwidth, while maintaining the high quality and details of the video content decoded after encoding as much as possible, it is necessary to ensure that the video decoded after encoding has a high video quality when the target encoded video has a low bit rate.

[0055] In this case, at least one initial quantization parameter control model and an initial reward model can be trained first, and then, for each initial quantization parameter control model, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data, and the initial quantization parameter control model is optimized for proximal strategy to obtain the corresponding target quantization parameter control model. After at least one target quantization parameter control model is trained, in the case of the live video collected by the anchor end and the live video collected by the anchor end is determined as the target video to be encoded, the target video to be encoded and the set bit rate pre-configured for the target encoded video can be input into at least one target quantization parameter control model to obtain the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, and then, according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain the target encoded video.

[0056] After the live broadcast end encodes the target video to be encoded and obtains the target encoded video, it will upload the target encoded video to the server through the real-time transport protocol. When the server receives the target encoded video, it will decode the target encoded video to obtain a decoded video, and after transcoding the decoded video, it will distribute the transcoded video to the audience end.

[0057] It should be noted that the above-mentioned application examples of the model training scheme and the video encoding scheme provided in the embodiments of the present application are for ease of understanding and are not used to limit the model training scheme and the video encoding scheme provided in the embodiments of the present application. Specifically, the application scenarios of the model training scheme and the video encoding scheme provided in the embodiments of the present application are not specifically limited. For example, in addition to being applicable to the application scenario of video encoding of live video, the model training scheme and the video encoding scheme provided in the embodiments of the present application can also be applied to the application scenario of video encoding of the vehicle surrounding environment video collected by the vehicle-mounted video.

[0058] In addition, the model training scheme and video encoding scheme involved in this application, the corresponding execution subject can be an application, service, instance, software-based functional module, virtual machine (VM) or cloud server, etc., or a hardware device (such as a server, terminal device) or hardware chip with a resource instance deployment function, and the hardware chip can be a CPU (Central Processing Unit), GPU (Graphics Processing), FPGA (Field Programmable Gate Array), NPU (Neural-network Processing Unit), AI (Artificial Intelligence) accelerator card or DPU (Data Processing Unit), etc. Among them, the devices for implementing the model training scheme and the video encoding scheme can be deployed on a local computing device or a cloud computing platform that provides computing power, storage and network resources. The mode of providing services to the outside world by the cloud computing platform can be IaaS (Infrastructure as a Service), PaaS (Platform as a Service), SaaS (Software-as-a-service) or DaaS (Data-as-a-service). Taking the platform providing SaaS software as a service (Software-as-a-Service) as an example, the cloud computing platform can use its own computing resources to provide resource instance deployment functions, and the specific application architecture can be built according to service requirements.

[0059] In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose or edit authorization or rejection.

[0060] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following related technologies can be combined arbitrarily with the technical solution of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application. The same or similar concepts or processes may not be repeated in some embodiments.

[0061] Figure 2 A flowchart of a resource instance deployment method 200 provided in an embodiment of the present application is shown. The method may include steps S201-S202.

[0062] In step S201, at least one initial quantization parameter control model and an initial reward model are obtained through training.

[0063] In the embodiment of the present application, the initial quantization parameter control model generally refers to: a model obtained by training based on the Dual-Critic reinforcement learning algorithm and used to determine the specific quantization parameter corresponding to each video frame in the video to be encoded, or a model obtained by training using other model training strategies. In addition, in the process of training the initial quantization parameter control model, multiple initial quantization parameter control models may be trained separately, or only one initial quantization parameter control model may be trained.

[0064] The input data of the initial quantization parameter control model include the sample video to be encoded and the set bit rate pre-configured for the specific encoded video, and the output data of the initial quantization parameter control model include the specific quantization parameters corresponding to each video frame in the sample video to be encoded. The specific encoded video is obtained by encoding the sample video to be encoded according to the specific quantization parameters corresponding to each video frame in the sample video to be encoded.

[0065] In the embodiment of the present application, the input data of the initial reward model includes a specific decoded video and a set bit rate and an actual bit rate corresponding to a specific encoded video, and the output data of the initial reward model includes a specific video score corresponding to the specific decoded video. The specific decoded video is obtained based on video decoding of the specific encoded video.

[0066] In the process of training to obtain the initial reward model, a sample decoded video and a reference video score annotated for the sample decoded video may be obtained first, and then the reward model to be trained may be trained based on the sample decoded video and the reference video score to obtain the initial reward model. The sample decoded video is obtained based on video decoding of a specified encoded video, and the specified encoded video is obtained based on video encoding of a specified video to be encoded.

[0067] In an embodiment of the present application, when obtaining a reference video score, the video quality score corresponding to the sample decoded video is generally obtained first, and then the actual bit rate corresponding to the specified encoded video and the set bit rate pre-configured for the specified encoded video are obtained. After that, the video quality score is adjusted according to the actual bit rate corresponding to the specified encoded video and the set bit rate to obtain the reference video score.

[0068] The video quality score is used to reflect the video quality of the sample decoded video. In one example, the video quality score can be set to 0-10 points, and the higher the video quality of the sample decoded video, the higher the video quality score.

[0069] After obtaining the video quality score, it is necessary to further compare the actual bit rate corresponding to the specified encoded video and the set bit rate, and adjust the video quality score based on the comparison result to obtain a reference video score. In one example, if the video quality score is 4, and the actual bit rate corresponding to the specified encoded video is greater than the set bit rate, the video quality score can be adjusted to 0. That is to say, when the video quality score is 4 and the actual bit rate corresponding to the specified encoded video is greater than the set bit rate, the reference video score is 0. In another example, if the video quality score is 5, and the actual bit rate corresponding to the specified encoded video is not greater than the set bit rate, the video quality score can be determined as 5. That is to say, when the video quality score is 5 and the actual bit rate corresponding to the specified encoded video is not greater than the set bit rate, the reference video score is 5. Specifically, when adjusting the video quality score based on the actual bit rate corresponding to the specified encoded video and the set bit rate to obtain the reference video score, if the actual bit rate corresponding to the specified encoded video is not greater than the set bit rate, the video quality score is adjusted to 0 to obtain the reference video score; and if the actual bit rate corresponding to the specified encoded video is not greater than the set bit rate, the video quality score is directly used as the reference video score.

[0070] In the process of training the reward model to be trained, the video quality score is generally obtained by manually evaluating the video quality of the sample decoded video. In the process of training the initial reward model, the video quality score is obtained by manually evaluating the video quality of the sample decoded video, which can make the evaluation of the decoded video by the trained initial reward model more in line with the human evaluation standard for video quality. And because human evaluators can comprehensively identify and evaluate various types of video quality issues, in the process of training the initial reward model, the video quality score is obtained by manually evaluating the video quality of the sample decoded video, which can enable the initial reward model to perform a comprehensive video evaluation on the sample decoded video, thereby making the evaluation of the decoded video by the initial reward model more accurate.

[0071] In an embodiment of the present application, when obtaining a designated coded video, the designated video to be coded and the set bit rate corresponding to the designated coded video can be first input into the initial quantization parameter control model to obtain specific quantization parameters corresponding to each video frame in the designated video to be coded. Then, based on the specific quantization parameters corresponding to each video frame in the designated video to be coded, the designated video to be coded is video-encoded to obtain the designated coded video. That is to say, in the process of performing video encoding on the designated video to obtain the designated coded video, the trained initial quantization parameter control model can be used to obtain specific quantization parameters corresponding to each video frame in the designated video to be coded.

[0072] In the embodiment of the present application, after training to obtain at least one initial quantization parameter control model and an initial reward model, it is necessary to further perform step S202. In step S202, for each initial quantization parameter control model, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data, and the initial quantization parameter control model is subjected to proximal strategy optimization to obtain a corresponding target quantization parameter control model.

[0073] In the embodiment of the present application, when multiple initial quantization parameter control models are trained, it is necessary to use the input data of the initial quantization parameter control model as state data, the output data of the initial quantization parameter control model as action data, and the output data of the initial reward model as reward data for each initial quantization parameter control model, perform proximal strategy optimization on the initial quantization parameter control model, and obtain the corresponding target quantization parameter control model. That is to say, when multiple initial quantization parameter control models are obtained through training, the proximal strategy optimization will be performed on the multiple initial quantization parameter control models respectively to obtain the target quantization parameter control model corresponding to each initial quantization parameter control model.

[0074] In addition, it should be noted that in the embodiment of the present application, in the process of performing video encoding on the designated video to be encoded and obtaining the designated encoded video, if the initial quantization parameter control model obtains the specific quantization parameter corresponding to each video frame in the designated video to be encoded, then the specific quantization parameter corresponding to each video frame in the designated video to be encoded can be used to perform image encoding on each video frame to obtain the corresponding data stream, and the data stream corresponding to each video frame in the designated video to be encoded can be recorded in the log. In this way, when the actual bit rate corresponding to the designated encoded video is subsequently obtained, the data stream corresponding to each video frame in the designated video to be encoded can be obtained by reading the log, and the actual bit rate corresponding to the designated encoded video can be calculated by the data stream corresponding to each video frame in the designated video to be encoded.

[0075] Accordingly, in the embodiment of the present application, when determining the actual bit rate corresponding to a specific coded video, the data stream corresponding to each video frame in the sample video to be coded can be obtained by first reading the log, and then, based on the data stream corresponding to each video frame in the sample video to be coded, the actual bit rate corresponding to the specific coded video is calculated. The data stream is obtained by performing image coding on the corresponding video frame according to the specific quantization parameter corresponding to each video frame in the sample video to be coded.

[0076] The model training method provided in the embodiment of the present application, after training to obtain at least one initial quantization parameter control model and an initial reward model, will further optimize the proximal strategy of each initial quantization parameter control model by using the input data of the initial quantization parameter control model as state data, the output data of the initial quantization parameter control model as action data, and the output data of the initial reward model as reward data for each initial quantization parameter control model to obtain a corresponding target quantization parameter control model. The target quantization parameter control model obtained by proximal strategy optimization can control the quantization parameters of each video in the video to be encoded, thereby ensuring that the video decoded after encoding has a higher video quality when the encoded video has a lower bit rate, thereby reducing the amount of data of the encoded video to save storage space and transmission bandwidth while maintaining the high quality and details of the video content decoded after encoding as much as possible.

[0077] At the same time, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data to perform proximal strategy optimization on each initial quantization parameter control model to obtain the corresponding target quantization parameter control model, which can not only better cope with some difficult situations in reinforcement learning, but also make the target quantization parameter control model have better stability and reliability.

[0078] Corresponding to the application example of the method provided in the embodiment of the present application and the model training method provided in the embodiment of the present application, a video encoding method is also provided in the embodiment of the present application. Figure 3 As shown, the video encoding method may include:

[0079] Step S301, obtaining a target video to be encoded.

[0080] Step S302, input the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtain the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on the proximal strategy optimization of the pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes the input data of the initial quantization parameter control model, the action data includes the output data of the initial quantization parameter control model, and the reward data includes the output data of the pre-trained initial reward model.

[0081] Step S303 , according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

[0082] When multiple target quantization parameter control models are obtained through training, the target quantization parameters corresponding to each video frame in the target video to be encoded can be determined by integrating the output data of the multiple target quantization parameter control models, so as to perform video encoding on the target video to be encoded to obtain the target encoded video.

[0083] In one example, the target quantization parameter corresponding to each video frame in the target video to be encoded can be determined based on the specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model. Then, based on the target quantization parameter corresponding to each video frame in the target video to be encoded, the target video to be encoded is encoded to obtain a target encoded video.

[0084] When determining the target quantization parameter corresponding to each video frame in the target video to be encoded based on the specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, for each video frame in the target video to be encoded, the smallest specific quantization parameter can be selected as the target quantization parameter corresponding to each video frame in the target video to be encoded among the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, or the target quantization parameter corresponding to each video frame in the target video to be encoded can be obtained by calculating the average value of the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model.

[0085] The video encoding method provided in the embodiment of the present application can control the quantization parameters of each video in the target video to be encoded through a target quantization parameter control model, thereby ensuring that when the target encoded video has a lower bit rate, the video decoded after encoding has a higher video quality, thereby reducing the data amount of the target encoded video to save storage space and transmission bandwidth while maintaining the high quality and details of the video content decoded after encoding as much as possible.

[0086] At the same time, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data to perform proximal strategy optimization on each initial quantization parameter control model to obtain the corresponding target quantization parameter control model, which can not only better cope with some difficult situations in reinforcement learning, but also make the target quantization parameter control model have better stability and reliability.

[0087] Corresponding to the application example of the method provided in the embodiment of the present application and the above method provided in the embodiment of the present application, another video encoding method is also provided in the embodiment of the present application. Figure 4 As shown, the video encoding method may include:

[0088] Step S401: determine the live video collected by the anchor end as the target video to be encoded.

[0089] Step S402, input the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtain the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on the proximal strategy optimization of the pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes the input data of the initial quantization parameter control model, the action data includes the output data of the initial quantization parameter control model, and the reward data includes the output data of the pre-trained initial reward model.

[0090] Step S403 , according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

[0091] The video encoding method provided in the embodiment of the present application can control the quantization parameters of each video in the target video to be encoded through a target quantization parameter control model, thereby ensuring that when the target encoded video has a lower bit rate, the video decoded after encoding has a higher video quality, thereby reducing the data amount of the target encoded video to save storage space and transmission bandwidth while maintaining the high quality and details of the video content decoded after encoding as much as possible.

[0092] At the same time, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data to perform proximal strategy optimization on each initial quantization parameter control model to obtain the corresponding target quantization parameter control model, which can not only better cope with some difficult situations in reinforcement learning, but also make the target quantization parameter control model have better stability and reliability.

[0093] Corresponding to the application example of the method provided in the embodiment of the present application and the above method provided in the embodiment of the present application, another video encoding method is also provided in the embodiment of the present application. Figure 5 As shown, the video encoding method may include:

[0094] Step S501: determine the vehicle surrounding environment video captured by the vehicle-mounted video capture device as the target video to be encoded.

[0095] Step S502, input the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtain the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on the proximal strategy optimization of the pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes the input data of the initial quantization parameter control model, the action data includes the output data of the initial quantization parameter control model, and the reward data includes the output data of the pre-trained initial reward model.

[0096] Step S503 , according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

[0097] The video encoding method provided in the embodiment of the present application can control the quantization parameters of each video in the target video to be encoded through a target quantization parameter control model, thereby ensuring that when the target encoded video has a lower bit rate, the video decoded after encoding has a higher video quality, thereby reducing the data amount of the target encoded video to save storage space and transmission bandwidth while maintaining the high quality and details of the video content decoded after encoding as much as possible.

[0098] At the same time, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data to perform proximal strategy optimization on each initial quantization parameter control model to obtain the corresponding target quantization parameter control model, which can not only better cope with some difficult situations in reinforcement learning, but also make the target quantization parameter control model have better stability and reliability.

[0099] Corresponding to the application example of the method provided in the embodiment of the present application and the model training method provided in the embodiment of the present application, a model training device is also provided in the embodiment of the present application. Figure 6 As shown, the model training device may include:

[0100] A model training module 601 is used to train and obtain at least one initial quantization parameter control model and an initial reward model;

[0101] The proximal strategy optimization module 602 is used to optimize the proximal strategy of each initial quantization parameter control model by taking the input data of the initial quantization parameter control model as state data, the output data of the initial quantization parameter control model as action data, and the output data of the initial reward model as reward data to obtain the corresponding target quantization parameter control model.

[0102] In a possible implementation, the model training module 601 includes:

[0103] The training data acquisition submodule is used to obtain a sample decoded video and a reference video score annotated for the sample decoded video; the sample decoded video is obtained by decoding a specified encoded video; the specified encoded video is obtained by encoding a specified video to be encoded;

[0104] The model training submodule is used to train the reward model to be trained based on the sample decoded video and the reference video score to obtain the initial reward model.

[0105] In a possible implementation, the training data acquisition submodule includes:

[0106] A video quality score acquisition submodule is used to obtain a video quality score corresponding to a sample decoded video;

[0107] The bit rate acquisition submodule is used to acquire the actual bit rate corresponding to the specified coded video and the set bit rate pre-configured for the specified coded video;

[0108] The reference video score determination submodule is used to adjust the video quality score according to the actual bit rate and the set bit rate corresponding to the specified encoded video to obtain the reference video score.

[0109] In a possible implementation, the video quality score is obtained by manually evaluating the video quality of a sample decoded video.

[0110] In a possible implementation, the device further includes:

[0111] A specific quantization parameter acquisition module is used to input the specified video to be encoded and the set bit rate corresponding to the specified encoded video into the initial quantization parameter control model to obtain the specific quantization parameter corresponding to each video frame in the specified video to be encoded;

[0112] The designated coded video acquisition module is used to perform video coding on the designated video to be coded according to the specific quantization parameters corresponding to each video frame in the designated video to be coded, so as to obtain the designated coded video.

[0113] In one possible implementation, the input data of the initial quantization parameter control model includes a sample video to be encoded and a set bit rate pre-configured for a specific encoded video; the output data of the initial quantization parameter control model includes specific quantization parameters corresponding to each video frame in the sample video to be encoded; and the specific encoded video is obtained by performing video encoding on the sample video to be encoded based on the specific quantization parameters corresponding to each video frame in the sample video to be encoded.

[0114] In one possible implementation, the input data of the initial reward model includes a specific decoded video and a set bit rate and an actual bit rate corresponding to a specific encoded video; the output data of the initial reward model includes a specific video score corresponding to the specific decoded video; and the specific decoded video is obtained based on video decoding of the specific encoded video.

[0115] In a possible implementation, the device further includes:

[0116] The data stream acquisition module is used to acquire the data stream corresponding to each video frame in the sample video to be encoded; the data stream is obtained by performing image encoding on the corresponding video frame according to the specific quantization parameter corresponding to each video frame in the sample video to be encoded;

[0117] The actual bit rate calculation module is used to calculate the actual bit rate corresponding to a specific coded video according to the data stream corresponding to each video frame in the sample to-be-coded video.

[0118] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.

[0119] Corresponding to the application example of the method provided in the embodiment of the present application and the first video encoding method provided in the embodiment of the present application, the embodiment of the present application also provides a video encoding device. Figure 7 As shown, the video encoding device may include:

[0120] The target video to be encoded acquisition module 701 is used to acquire the target video to be encoded;

[0121] The quantization parameter acquisition module 702 is used to input the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtain the specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on the proximal strategy optimization of the pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes the input data of the initial quantization parameter control model, the action data includes the output data of the initial quantization parameter control model, and the reward data includes the output data of the pre-trained initial reward model;

[0122] The video encoding module 703 is used to perform video encoding on the target video to be encoded according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model to obtain a target encoded video.

[0123] In a possible implementation, the video encoding module 703 includes:

[0124] A quantization parameter determination submodule, used to determine a target quantization parameter corresponding to each video frame in the target video to be encoded according to a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model;

[0125] The video encoding submodule is used to perform video encoding on the target video to be encoded according to the target quantization parameter corresponding to each video frame in the target video to be encoded, so as to obtain a target encoded video.

[0126] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.

[0127] Corresponding to the application example of the method provided in the embodiment of the present application and the second video encoding method provided in the embodiment of the present application, another video encoding device is also provided in the embodiment of the present application. Figure 7 , the video encoding device may include:

[0128] The target video to be encoded acquisition module 701 is used to determine the live video collected by the anchor terminal as the target video to be encoded;

[0129] The quantization parameter acquisition module 702 is used to input the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtain the specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on the proximal strategy optimization of the pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes the input data of the initial quantization parameter control model, the action data includes the output data of the initial quantization parameter control model, and the reward data includes the output data of the pre-trained initial reward model;

[0130] The video encoding module 703 is used to perform video encoding on the target video to be encoded according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model to obtain a target encoded video.

[0131] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.

[0132] Corresponding to the application example of the method provided in the embodiment of the present application and the third video encoding method provided in the embodiment of the present application, another video encoding device is also provided in the embodiment of the present application. Figure 7 , the video encoding device may include:

[0133] The target video to be encoded acquisition module 701 is used to determine the vehicle surrounding environment video collected by the vehicle video as the target video to be encoded;

[0134] The quantization parameter acquisition module 702 is used to input the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtain the specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on the proximal strategy optimization of the pre-trained initial quantization parameter control model; in the proximal strategy optimization process, the state data includes the input data of the initial quantization parameter control model, the action data includes the output data of the initial quantization parameter control model, and the reward data includes the output data of the pre-trained initial reward model;

[0135] The video encoding module 703 is used to perform video encoding on the target video to be encoded according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model to obtain a target encoded video.

[0136] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.

[0137] Figure 8 FIG. 1 is a block diagram of an electronic device used to implement an embodiment of the present application. Figure 8 As shown, the electronic device includes: a memory 801 and a processor 802. The memory 801 stores a computer program that can be run on the processor 802. When the processor 802 executes the computer program, the method in the above embodiment is implemented. The number of the memory 801 and the processor 802 can be one or more.

[0138] The electronic device also includes:

[0139] The communication interface 803 is used to communicate with external devices and perform data exchange transmission.

[0140] If the memory 801, the processor 802 and the communication interface 803 are implemented independently, the memory 801, the processor 802 and the communication interface 803 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0141] Optionally, in a specific implementation, if the memory 801, the processor 802 and the communication interface 803 are integrated on a chip, the memory 801, the processor 802 and the communication interface 803 can communicate with each other through an internal interface.

[0142] An embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the method provided in the embodiment of the present application when the program is executed by a processor.

[0143] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.

[0144] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.

[0145] It should be understood that the processor may be a central processing unit (CPU), or 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. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.

[0146] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).

[0147] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.

[0148] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0149] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0150] Any process or method description in the flow chart or otherwise described herein can be understood to represent a module, fragment or portion of a code including one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.

[0151] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.

[0152] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.

[0153] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.

[0154] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A model training method, comprising: Train to obtain at least one initial quantization parameter control model and an initial reward model; For each initial quantization parameter control model, the input data of the initial quantization parameter control model is used as state data, the output data of the initial quantization parameter control model is used as action data, and the output data of the initial reward model is used as reward data. The initial quantization parameter control model is subjected to proximal strategy optimization to obtain a corresponding target quantization parameter control model.

2. The method according to claim 1, wherein: The initial reward model is trained by the following steps: Obtaining a sample decoded video and a reference video score annotated for the sample decoded video; the sample decoded video is obtained by decoding a designated encoded video; the designated encoded video is obtained by encoding a designated video to be encoded; The reward model to be trained is trained according to the sample decoded video and the reference video score to obtain the initial reward model.

3. The method according to claim 2, wherein: The reference video score is determined by the following steps: Obtaining a video quality score corresponding to the sample decoded video; Obtaining an actual bit rate corresponding to the specified coded video and a set bit rate preconfigured for the specified coded video; The video quality score is adjusted according to the actual bit rate and the set bit rate corresponding to the designated encoded video to obtain the reference video score.

4. The method according to claim 3, wherein: The video quality score is obtained by manually evaluating the video quality of the sample decoded video.

5. The method according to claim 2, wherein: The method further comprises: Inputting the designated video to be encoded and the set bit rate corresponding to the designated video to be encoded into the initial quantization parameter control model to obtain a specific quantization parameter corresponding to each video frame in the designated video to be encoded; The designated video to be encoded is encoded according to the specific quantization parameter corresponding to each video frame in the designated video to be encoded to obtain the designated encoded video.

6. The method according to claim 1, wherein: The input data of the initial quantization parameter control model includes a sample video to be encoded and a set bit rate pre-configured for a specific encoded video; the output data of the initial quantization parameter control model includes specific quantization parameters corresponding to each video frame in the sample video to be encoded; the specific encoded video is obtained by video encoding the sample video to be encoded based on the specific quantization parameters corresponding to each video frame in the sample video to be encoded.

7. The method according to claim 6, wherein: The input data of the initial reward model includes a specific decoded video and a set bit rate and an actual bit rate corresponding to the specific encoded video; the output data of the initial reward model includes a specific video score corresponding to the specific decoded video; the specific decoded video is obtained based on video decoding of the specific encoded video.

8. The method according to claim 7, wherein: The actual bit rate corresponding to the specific coded video is determined by the following steps: Acquire a data stream corresponding to each video frame in the sample video to be encoded; the data stream is obtained by performing image encoding on the corresponding video frame according to the specific quantization parameter corresponding to each video frame in the sample video to be encoded; The actual bit rate corresponding to the specific encoded video is calculated based on the data stream corresponding to each video frame in the sample video to be encoded.

9. A video encoding method, comprising: Get the target video to be encoded; Inputting the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtaining a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on proximal strategy optimization of a pre-trained initial quantization parameter control model; In the proximal strategy optimization process, the state data includes input data of the initial quantization parameter control model, the action data includes output data of the initial quantization parameter control model, and the reward data includes output data of the pre-trained initial reward model; According to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

10. The method according to claim 9, wherein: The at least one target quantization parameter control model includes a plurality of target quantization parameter control models; the target video to be encoded is encoded according to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, and the target encoded video is obtained by: Determine a target quantization parameter corresponding to each video frame in the target video to be encoded according to a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; According to the target quantization parameter corresponding to each video frame in the target video to be encoded, the target video to be encoded is encoded to obtain a target encoded video.

11. A video encoding method, comprising: The live video collected by the anchor end is determined as the target video to be encoded; Inputting the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtaining a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on proximal strategy optimization of a pre-trained initial quantization parameter control model; In the proximal strategy optimization process, the state data includes input data of the initial quantization parameter control model, the action data includes output data of the initial quantization parameter control model, and the reward data includes output data of the pre-trained initial reward model; According to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

12. A video encoding method, comprising: The vehicle surrounding environment video collected by the vehicle-mounted video collection device is determined as the target video to be encoded; Inputting the target video to be encoded and the set bit rate pre-configured for the target video to be encoded into at least one target quantization parameter control model, and obtaining a specific quantization parameter corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model; each target quantization parameter control model is obtained based on proximal strategy optimization of a pre-trained initial quantization parameter control model; In the proximal strategy optimization process, the state data includes input data of the initial quantization parameter control model, the action data includes output data of the initial quantization parameter control model, and the reward data includes output data of the pre-trained initial reward model; According to the specific quantization parameters corresponding to each video frame in the target video to be encoded output by each target quantization parameter control model, the target video to be encoded is encoded to obtain a target encoded video.

13. An electronic device comprising a memory, a processor and a computer program stored in the memory, wherein the processor implements the method according to any one of claims 1 to 12 when executing the computer program.

14. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.