Code rate control model construction method suitable for rural power grid construction supervision, code rate control method and related device

By constructing a code rate control model suitable for rural network construction supervision in a deep learning video encoder, the problem of deviation between the actual code rate and the target code rate is solved, and efficient code rate control of video data is achieved.

CN119316601BActive Publication Date: 2025-04-11SICHUAN NENGTOU CONSTR ENG GRP CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411846488.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-11
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

Existing deep learning video encoders ignore code rate control, resulting in large deviations from the actual code rate and the target code rate, which cannot effectively adapt to storage and network bandwidth requirements, affecting encoding performance.

Method used

A method for constructing a code rate control model suitable for rural network construction supervision is proposed. By allocating code rates to encode video frames according to the target code rate, using the frame-level code rate, code rate model and distortion model to obtain the target encoding parameters, and improving the accuracy of code rate control by updating the model.

Benefits of technology

Accurate control of the actual code rate is achieved, the error between the actual code rate and the target code rate is reduced, and the encoded video data can better adapt to the requirements of storage and network bandwidth.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316601B_ABST
    Figure CN119316601B_ABST
Patent Text Reader

Abstract

The present invention proposes a method for constructing a rate control model suitable for rural power grid construction supervision, a rate control method and related devices. The construction method determines the frame-level rate of the current frame to be encoded through a target rate related to the network bandwidth, obtains the target encoding parameters using the frame-level rate, the rate model and the distortion model, encodes the current frame to be encoded using the target encoding parameters to obtain the actual rate and the actual distortion value, and updates the rate model and the distortion model, which can improve the accuracy of the target encoding parameters obtained based on the rate model and the distortion model, thereby gradually improving the sample quality of a group of training samples using the feature information of the current frame to be encoded, the target rate, the ratio of the rate consumed by the current encoded frame to the target rate and the frame number, so that the encoding rate control model obtained based on the training sample can take into account the image features, the network bandwidth and the encoding consumed rate, and efficiently output the target encoding parameters for realizing precise control of the actual rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of multimedia coding technology, and in particular to a rate control model construction method suitable for rural power grid construction supervision, a rate control method and related devices. Background Art

[0002] Since the level of informatization of rural power grid transformation construction projects is relatively low and the rural grid construction lines are long, in order to understand the on-site situation, it is currently necessary to take a car to the project department at each point for on-site inspection, which makes it impossible to understand the on-site situation in real time and consumes a lot of manpower costs. However, informatization has become popular today, so it is an inevitable trend to use informatization management to optimize construction management, which can not only improve construction efficiency, project quality and operation safety, but also achieve more economic benefits.

[0003] In the above-mentioned information management, it is generally involved to use video surveillance equipment to collect video of the construction site, and the storage and transmission of video data depends on video encoding. In addition, with the prevalence of video platforms, video traffic also accounts for more than 80% of Internet traffic and continues to grow. Therefore, it is crucial to design efficient encoding technology for video storage and transmission.

[0004] Traditional video encoders generally include Advanced Video Coding (AVC), High Efficiency Video Coding (HEVC) and Versatile Video Coding (VVC). These encoders encode videos based on manually designed rules. However, in recent years, with the development of artificial intelligence technology, video encoders based on deep learning have received more and more attention. The existing methods can be divided into two categories: motion and residual hybrid coding, and probabilistic prediction coding. Their performance has surpassed traditional video encoders in some aspects.

[0005] However, most existing deep learning video encoders focus on designing and improving compression architectures to achieve better rate-distortion performance, while ignoring rate control technology, which results in a large deviation between the actual bit rate and the target bit rate, making the encoded video data unable to adapt well to storage and network bandwidth requirements, and also having a certain adverse effect on rate-distortion performance. Therefore, it is urgent to design an efficient and accurate rate control algorithm for deep learning video encoders. Summary of the invention

[0006] In view of this, in order to at least solve the technical problem that the actual bit rate is relatively large deviation from the target bit rate due to the neglect of bit rate control in the deep learning video coding technology in the traditional technology, and thus the encoded video data cannot adapt well to the storage and network bandwidth requirements, the purpose of the present invention is to provide a method for constructing a bit rate control model suitable for rural power grid construction supervision, a bit rate control method and related devices. The technical solution adopted by the embodiment of the present invention is as follows:

[0007] A first aspect of an embodiment of the present invention provides a method for constructing a rate control model suitable for rural power grid construction supervision, comprising:

[0008] Performing code rate allocation on the current frame to be encoded of the video to be encoded according to the set target code rate to obtain the frame level code rate of the current frame to be encoded;

[0009] Obtaining a target encoding parameter of the current frame to be encoded according to the frame level bit rate of the current frame to be encoded, a currently obtained bit rate model and a distortion model;

[0010] Inputting the current frame to be encoded and its target encoding parameters into an existing video encoder for encoding, obtaining an actual bit rate and an actual distortion value after encoding, and updating the bit rate model and the distortion model according to the actual bit rate and the actual distortion value respectively;

[0011] For each current frame to be encoded, characteristic information of the current frame to be encoded, the target bit rate, a ratio of the bit rate consumed by the current encoded frame to the target bit rate, and a frame number of the current frame to be encoded are used as a group of training samples to obtain a sample set formed by training samples corresponding to each frame in the video to be encoded;

[0012] The next frame of the current frame to be encoded is used as a new current frame to be encoded, and the step of allocating bit rates for the current frame to be encoded according to the set target bit rate is returned to the step until the number of samples in the sample set reaches the set number threshold;

[0013] When the number of samples in the sample set reaches the number threshold, the original model is trained using the sample set to obtain a coding rate control model; the coding rate control model is used to obtain a target coding parameter for controlling the coding rate of the video encoder based on the actual target rate and feature information of the actual video to be encoded.

[0014] A second aspect of an embodiment of the present invention provides a rate control method, including:

[0015] By using the pre-built encoding rate control model, based on the input current frame to be encoded and the current target bit rate, a current target encoding parameter for controlling the current encoding bit rate of the existing video encoder is obtained;

[0016] Inputting the current frame to be encoded and the current target encoding parameters into the video encoder to control the video encoder to encode the current frame to be encoded according to the current target encoding parameters;

[0017] The coding rate control model is constructed by the method for constructing a rate control model suitable for rural power grid construction supervision provided in the first aspect above.

[0018] A third aspect of an embodiment of the present invention provides a rate control model construction device suitable for rural power grid construction supervision, including:

[0019] The bit rate allocation module is configured to: allocate bit rates for the current frame to be encoded of the video to be encoded according to the set target bit rate, so as to obtain the frame level bit rate of the current frame to be encoded;

[0020] The coding parameter determination module is configured to: obtain a target coding parameter of the current frame to be encoded according to the frame level bit rate of the current frame to be encoded, the currently obtained bit rate model and the distortion model;

[0021] The model updating module is configured to: input the current frame to be encoded and its target encoding parameters into an existing video encoder for encoding, obtain an actual bit rate and an actual distortion value after the encoding, and update the bit rate model and the distortion model according to the actual bit rate and the actual distortion value respectively;

[0022] The sample acquisition module is configured to: for each current frame to be encoded, use the feature information of the current frame to be encoded, the target bit rate, the ratio of the bit rate consumed by the current encoded frame to the target bit rate, and the frame number of the current frame to be encoded as a group of training samples to obtain a sample set formed by the training samples corresponding to each frame in the video to be encoded;

[0023] an iteration module, configured to: take the next frame of the current frame to be encoded as a new current frame to be encoded, and trigger the bit rate allocation module, the encoding parameter determination module, the model update module and the sample acquisition module to iteratively run until the number of samples in the sample set reaches a set number threshold;

[0024] The training module is configured to: when the number of samples in the sample set reaches the number threshold, use the sample set to train the original model to obtain a coding rate control model; the coding rate control model is used to obtain a target coding parameter for controlling the coding rate of the video encoder based on the actual target rate and feature information of the actual video to be encoded.

[0025] A fourth aspect of the embodiments of the present invention provides a rate control device, including:

[0026] The encoding parameter output module is configured to: obtain a current target encoding parameter for controlling a current encoding rate of an existing video encoder based on an input current frame to be encoded and a current target rate through a pre-built encoding rate control model;

[0027] The encoding control module is configured to: input the current frame to be encoded and the current target encoding parameter to the video encoder, so as to control the video encoder to encode the current frame to be encoded according to the current target encoding parameter;

[0028] Among them, the coding rate control model is constructed by the rate control model construction device suitable for rural power grid construction supervision provided by the third aspect above.

[0029] According to a fifth aspect of an embodiment of the present invention, an electronic device is provided, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the method for constructing a rate control model suitable for rural power grid construction supervision provided in the first aspect above, and / or the rate control method provided in the second aspect above.

[0030] In a sixth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for constructing a rate control model suitable for rural power grid construction supervision provided in the first aspect above and / or the rate control method provided in the second aspect above is implemented.

[0031] The method for constructing a rate control model suitable for rural power grid construction supervision, the rate control method and related devices provided by the embodiment of the present invention obtain a suitable frame-level rate by allocating a target rate reflecting the network bandwidth situation to the current frame to be encoded, and then obtain a suitable target encoding parameter by using the frame-level rate, the rate model and the distortion model, and then encode the current frame to be encoded by using the target encoding parameter to obtain an actual rate and an actual distortion value, and update the rate model and the distortion model, which can improve the accuracy of the rate model and the distortion model, so that before each subsequent encoding, more accurate target encoding parameters can be obtained based on the updated rate model and the distortion model according to the new frame-level rate of the current frame to be encoded, so that the rate and distortion after encoding based on the target encoding parameters can be controlled. Based on this, since for each current frame to be encoded, the feature information of the current frame to be encoded, the target bit rate, the ratio of the bit rate consumed by the current encoded frame to the target bit rate, and the frame number of the current frame to be encoded will be used as a group of training samples, the quality of the training samples gradually obtained will also be improved. Using such training samples to train the original model can make the encoding bit rate control model finally trained take into account the image characteristics of the frame to be encoded, the network bandwidth conditions and the bit rate consumed by the encoding, and efficiently output target encoding parameters that are more suitable for practical applications, so that when the video encoder encodes based on the target encoding parameters, it can achieve accurate control of the actual bit rate, thereby reducing the error between the actual bit rate and the target bit rate, so that the encoded video data can be well adapted to the requirements of storage and network bandwidth.

[0032] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0034] Figure 1 A structural block diagram of an electronic device provided by an embodiment of the present invention is shown;

[0035] Figure 2 A flow chart of a method for constructing a rate control model suitable for rural power grid construction supervision provided by an embodiment of the present invention is shown;

[0036] Figure 3 A schematic diagram of a rate-distortion curve before and after rate control provided by an embodiment of the present invention is shown;

[0037] Figure 4a A schematic diagram of a bit rate variation curve of each frame in a GOP image group when a target bit rate is 0.02 provided by an embodiment of the present invention is shown;

[0038] Figure 4b A schematic diagram of a code rate variation curve of each frame in a GOP image group when a target code rate is 0.025 provided by an embodiment of the present invention is shown;

[0039] Figure 4c A schematic diagram of a bit rate variation curve of each frame in a GOP image group when a target bit rate is 0.03 provided by an embodiment of the present invention is shown;

[0040] Figure 5a A schematic diagram of a PSNR variation curve corresponding to each frame in a GOP image group when a target bit rate is 0.02 provided by an embodiment of the present invention is shown;

[0041] Figure 5b A schematic diagram of a PSNR variation curve corresponding to each frame in a GOP image group when a target bit rate is 0.025 provided by an embodiment of the present invention is shown;

[0042] Figure 5c A schematic diagram of a PSNR variation curve corresponding to each frame in a GOP image group when a target bit rate is 0.03 provided by an embodiment of the present invention is shown;

[0043] Figure 6 A functional module diagram of a rate control model building device suitable for rural power grid construction supervision provided by an embodiment of the present invention is shown;

[0044] Figure 7 A functional module diagram of a bit rate control device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0045] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0047] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0048] In order to solve the technical problem that the actual bit rate has a large deviation from the target bit rate due to the neglect of bit rate control in the deep learning video coding technology in the traditional technology, and thus the encoded video data cannot adapt well to the storage and network bandwidth requirements, the embodiment of the present invention provides a method for constructing a bit rate control model suitable for rural power grid construction supervision, which allocates a suitable frame-level bit rate to the current frame to be encoded by a target bit rate reflecting the network bandwidth situation, and then obtains a suitable target coding parameter by using the frame-level bit rate, a bit rate model and a distortion model, and then encodes the current frame to be encoded by using the target coding parameter to obtain the actual bit rate and the actual distortion value, and updates the bit rate model and the distortion model, which can improve the accuracy of the bit rate model and the distortion model, so that before each subsequent encoding, more accurate target coding parameters can be obtained according to the frame-level bit rate of the new current frame to be encoded based on the updated bit rate model and the distortion model, so that the bit rate and distortion after encoding based on the target coding parameter can be controlled. Based on this, since for each current frame to be encoded, the feature information of the current frame to be encoded, the target bit rate, the ratio of the bit rate consumed by the current encoded frame to the target bit rate, and the frame number of the current frame to be encoded will be used as a group of training samples, the quality of the training samples gradually obtained will also be improved. Using such training samples to train the original model can make the encoding bit rate control model finally trained take into account the image characteristics of the frame to be encoded, the network bandwidth conditions and the bit rate consumed by the encoding, and efficiently output target encoding parameters that are more suitable for practical applications, so that when the video encoder encodes based on the target encoding parameters, it can achieve accurate control of the actual bit rate, thereby reducing the error between the actual bit rate and the target bit rate, so that the encoded video data can be well adapted to the requirements of storage and network bandwidth.

[0049] The method for constructing a rate control model suitable for rural power grid construction supervision provided by the present invention can be applied to electronic devices. Figure 1, is a block diagram of the structure of an electronic device. The electronic device 100 includes a memory 110, a processor 120 and a communication module 130. The memory 110, the processor 120 and the communication module 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0050] The memory is used to store programs or data. The memory may be, but is not limited to, a random access memory (RAM), 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), etc.

[0051] The processor is used to read / write data or programs stored in the memory and execute corresponding functions.

[0052] The communication module is used to establish a communication connection between the electronic device and other communication terminals through a network, and is used to send and receive data through the network.

[0053] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device, and the electronic device may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0054] In some embodiments, the electronic device can be used in a video encoder or can be set separately from the video encoder. When set separately, the electronic device can be connected to the input end of the video encoder through wiring, so that during the encoding process, the current target encoding parameters obtained based on the input current frame to be encoded and the current target bit rate are input into the video encoder to achieve encoding bit rate control of the video encoder.

[0055] The following combination Figure 2 The method for constructing a rate control model suitable for rural power grid construction supervision provided by an embodiment of the present invention is described. Figure 21 is a flow chart of a method for constructing a rate control model suitable for rural power grid construction supervision provided by an embodiment of the present invention. The method for constructing a rate control model suitable for rural power grid construction supervision provided by an embodiment of the present invention includes:

[0056] In step S100, a bit rate is allocated for a current frame to be encoded of a video to be encoded according to a set target bit rate, so as to obtain a frame-level bit rate of the current frame to be encoded;

[0057] In step S200, a target encoding parameter of the current frame to be encoded is obtained according to the frame level bit rate of the current frame to be encoded, the currently obtained bit rate model and the distortion model;

[0058] In step S300, the current frame to be encoded and its target encoding parameters are input into an existing video encoder for encoding, an actual bit rate and an actual distortion value after the encoding are obtained, and the bit rate model and the distortion model are updated according to the actual bit rate and the actual distortion value respectively;

[0059] In step S400, for each current frame to be encoded, feature information of the current frame to be encoded, the target bit rate, the ratio of the bit rate consumed by the current encoded frame to the target bit rate, and the frame number of the current frame to be encoded are used as a group of training samples to obtain a sample set formed by training samples corresponding to each frame in the video to be encoded;

[0060] In step S500, the next frame of the current frame to be encoded is used as a new current frame to be encoded, and the step of allocating bit rates for the current frame to be encoded according to the set target bit rate is returned to be executed until the number of samples in the sample set reaches the set number threshold;

[0061] In step S600, when the number of samples in the sample set reaches the number threshold, the original model is trained using the sample set to obtain a coding rate control model; the coding rate control model is used to obtain a target coding parameter for controlling the coding rate of the video encoder based on the actual target rate and feature information of the actual video to be encoded.

[0062] The following describes the working process of the method for constructing a rate control model suitable for rural power grid construction supervision provided by an embodiment of the present invention based on steps S100 to S600:

[0063] In order to obtain a sample set with a sufficient number of samples, each frame in the input video to be encoded can be processed through steps S100 to S500. The video to be encoded can be obtained from a large amount of free or authorized videos on the Internet. In the process of executing step S100, the bit rate allocation technology in the relevant technology, such as the bit rate allocation technology used in HEVC, can be used to achieve bit rate allocation for the current frame to be encoded based on the target bit rate.

[0064] To ensure the efficiency and accuracy of bit rate allocation, in some embodiments, for the consideration of encoding performance or other related aspects, the video to be encoded is generally divided into multiple groups of pictures (Group of Pictures, GOP) for processing, wherein, to make it clear that the multiple groups of pictures are divided from the video to be encoded, the multiple groups of pictures are referred to as multiple GOP groups of pictures. For this scenario, an embodiment of the present invention further provides a bit rate allocation scheme, that is, in the above step S100, the bit rate of the current frame to be encoded of the video to be encoded is allocated according to the set target bit rate, and the step of obtaining the frame level bit rate of the current frame to be encoded may include:

[0065] In step S110, a group-level bit rate allocated to each GOP image group is determined according to the target bit rate, the bit rate consumed by the currently encoded frame, and the number of currently encoded frames;

[0066] In step S120, the frame-level bit rate allocated to the current frame to be encoded is determined according to the group-level bit rate corresponding to the target GOP image group where the current frame to be encoded is located, the bit rate consumed by the encoded frames in the target GOP image group and the bit rate weight of the current frame to be encoded.

[0067] The target bit rate can be intelligently calculated according to the current network bandwidth. The specific calculation principle can be found in the relevant technology, and can also be customized by the user according to actual needs.

[0068] As can be seen from the above, in the process of allocating the bit rate for the current frame to be encoded, the bit rate at the GOP level is first allocated to each GOP image group of the video to be encoded in step S110, and then the bit rate at the frame level is further allocated based on the bit rate allocation result at the GOP level in step S120. The process of obtaining the group-level bit rate of each GOP image group in step S110 can be expressed by the following formula:

[0069] Formula (1)

[0070] In formula (1), Indicates the group level bit rate of the current GOP group of pictures; represents the average bit rate allocated to each frame in the video to be encoded, is equal to the ratio of the target bit rate to the total number of all frames in the video to be encoded; Indicates the number of currently encoded frames in the video to be encoded, Indicates the bit rate consumed by the current encoded frame. Indicates the sliding window size, and its value can be set according to actual needs, for example, 40; Indicates the number of all frames in the current GOP group of pictures.

[0071] After the group-level bit rate of each GOP image group is obtained by the above formula (1), step S120 can be executed to obtain the frame-level bit rate of each frame. The process of obtaining the frame-level bit rate of the current frame to be encoded in step S120 can be expressed by the following formula:

[0072] Formula (2)

[0073] In formula (2), Indicates the frame-level bit rate of the current frame to be encoded. Indicates the group-level bit rate corresponding to the target GOP image group where the current frame to be encoded is located. Indicates the bit rate consumed by the encoded frames in the target GOP image group. Indicates the bit rate weight of the current frame to be encoded. Represents the sum of the bitrate weights of all uncoded frames in the target GOP group of images.

[0074] In the above, the bit rate weight of each frame can be set according to actual needs or experiments, but in order to obtain a more appropriate frame-level bit rate, in some embodiments, the present invention also provides a solution for obtaining the bit rate weight of each frame in the video to be encoded, please see Table 1.

[0075] Table 1 Bit rate control frame level bit rate weight value

[0076]

[0077] Taking the current frame to be encoded as an example, the process of obtaining its bit rate weight based on Table 1 is described below:

[0078] Calculate the remainder of the frame number of the current frame to be encoded and 4. The calculation process can be calculated using the formula POC%4, where POC is the frame number of the current frame to be encoded, and "%" is the remainder operator. And obtain the average number of bits per pixel in the current frame to be encoded. For the specific acquisition principle, please refer to the relevant technology. Therefore, if the current frame to be encoded is a P frame, assuming that the remainder of its frame number and 4 is 1, and the average number of bits per pixel bpp in the current frame to be encoded is 0.4, then based on these three conditions, the bit rate weight of the current frame to be encoded can be found in the table as the value of the 4th row and 3rd column in Table 1, which is 3. Therefore, the bit rate weight of each frame can be found through Table 1.

[0079] After obtaining the frame-level bit rate of the current frame to be encoded through any of the above embodiments, step S200 can be executed to use the currently obtained bit rate model and distortion model to obtain the target encoding parameters of the current video to be encoded. Among them, the currently obtained bit rate model and distortion model refer to the latest bit rate model and distortion model. Because it can be seen from step S300 that the bit rate model and distortion model will be updated based on the actual bit rate and the actual distortion value, so in order to ensure the accuracy of the target encoding parameters in step S200, the term "currently obtained bit rate model and distortion model" is used here. It should be noted that at the first encoding, that is, before any update of the encoding model and distortion model, the initial bit rate model and distortion model should be available. In this regard, in some embodiments, in order to simplify the initialization construction process of the bit rate model and distortion model, the embodiment of the present invention also provides a corresponding model construction scheme, that is, the acquisition process of the initial bit rate model and distortion model before the update includes:

[0080] In step S010, the first frame or any frame in the to-be-encoded video is encoded respectively by using a plurality of different encoding parameters to obtain bit rates and distortion values ​​corresponding to the plurality of encoding parameters;

[0081] In step S020, a rate model for characterizing the relationship between the coding parameters and the bit rate is constructed according to the plurality of coding parameters and their corresponding bit rates;

[0082] In step S030, a distortion model for characterizing the relationship between the coding parameters and the distortion values ​​is constructed according to the multiple coding parameters and their corresponding distortion values.

[0083] Since each encoding parameter is used to encode a frame in the video to be encoded, the corresponding bit rate and distortion value will be obtained. Therefore, in order to construct an initial bit rate model, different encoding parameters can be used to encode a certain frame respectively, so that the bit rate and distortion values ​​corresponding to different encoding parameters can be obtained. In some embodiments, the maximum and minimum values ​​of the encoding parameters can be determined according to the performance of the currently used video encoder, and then an equidistant interpolation process is performed between the maximum and minimum values ​​of the encoding parameters to obtain a set number of encoding parameters, such as 10 encoding parameters.

[0084] During the execution of step S010, 10 encoding parameters and the first frame or any frame in the video to be encoded can be input into the video encoder, so that the video encoder encodes the input frame according to different encoding parameters to obtain the bit rate and distortion value corresponding to each of the 10 encoding parameters.

[0085] Next, step S020 can be performed, with multiple coding parameters as independent variables and the bit rates corresponding to the multiple coding parameters as dependent variables, to obtain a coding parameter-bit rate curve by fitting. The equation of the coding parameter-bit rate curve is the bit rate model GR, which can be expressed by the following formula:

[0086] Formula (3)

[0087] In formula (3), and The meanings are the same, both are bit rate models. and is the model parameter of the bit rate model, which is a known value; Is the encoding parameter.

[0088] In the process of executing step S030, regardless of the order of step S020, multiple coding parameters are used as independent variables, and the distortion values ​​corresponding to the multiple coding parameters are used as dependent variables, and a coding parameter-distortion curve is obtained by fitting. The equation of the coding parameter-distortion curve is the distortion model GD, and the distortion model GD can be expressed by the following formula:

[0089] Formula (4)

[0090] In formula (4), and The meanings are the same, both are distortion models. and is the model parameter of the distortion model, which is a known value; is the encoding parameter.

[0091] Therefore, in the process of executing step S200, the corresponding encoding parameters can be first calculated based on the frame-level bit rate of the current frame to be encoded by the bit rate model, that is, the frame-level bit rate is substituted into formula (3) to calculate the encoding parameters , and then the distortion model is based on the encoding parameters Calculate the corresponding distortion value, that is, the encoding parameter Substitute into formula (4) to calculate the distortion value. When the distortion value is less than the set distortion threshold, the current encoding parameter can be used as the target encoding parameter of the current frame to be encoded. When the distortion value is not less than the set distortion threshold, the current encoding parameter can be subtracted or added from the set parameter offset to obtain the offset-processed encoding parameter, and then the distortion value is calculated again until the encoding parameter with a distortion value less than the above-mentioned distortion threshold is obtained, that is, the target encoding parameter of the current frame to be encoded is obtained. The parameter offset can be set based on experience or experiment, and the embodiment of the present invention is not limited to this.

[0092] Although the target coding parameters of the current frame to be encoded can be obtained through the above scheme, the adjustment of the coding parameters by using the parameter offset may cause the distortion value corresponding to the target coding parameters finally obtained to be not the minimum, that is, non-optimal coding parameters, which will affect the subsequent encoding quality and efficiency, as well as the accuracy of the coding rate control model. To solve this technical problem, in some embodiments, the embodiments of the present invention further provide another scheme for implementing step S200, that is, in the above step S200, the step of obtaining the target coding parameters of the current frame to be encoded according to the frame level bit rate of the current frame to be encoded, the currently obtained bit rate model and the distortion model includes:

[0093] In step S210, the frame level bit rate of the current frame to be encoded is adjusted according to a preset error tolerance rate to obtain an adjusted reference bit rate;

[0094] In step S220, a plurality of candidate coding parameters whose bit rates are less than or equal to the reference bit rate are obtained through the bit rate model;

[0095] In step S230, the distortion value corresponding to each candidate coding parameter is calculated by using the distortion model, and the candidate coding parameter with the smallest distortion value is used as the target coding parameter of the current frame to be encoded.

[0096] That is, after obtaining the frame-level bit rate of the current frame to be encoded by any of the above embodiments, the frame-level bit rate of the current frame to be encoded can be adjusted by using the preset error tolerance rate through step S210 to obtain a reference bit rate greater than the frame-level bit rate. For example, the reference bit rate can be equal to the frame-level bit rate. (1+m) times, where m represents the rate error tolerance, that is, the error tolerance mentioned above, and m can be set according to actual needs or experiments, for example, it can be set to 10%.

[0097] After obtaining the reference bit rate, step S220 may be performed to obtain multiple candidate coding parameters whose bit rates are less than or equal to the reference bit rate using the bit rate model. The process may be expressed by the following formula:

[0098] Formula (5)

[0099] In formula (5), represents the code rate model, Indicates the reference bit rate, Represents the set of values ​​of the encoding parameters used in constructing the initial rate model. represents a set formed by the above multiple candidate coding parameters. Therefore, through formula (5), multiple candidate coding parameters that meet the requirements of formula (5) can be found.

[0100] After obtaining multiple candidate coding parameters, step S230 may be performed to calculate the distortion value corresponding to each candidate coding parameter through the distortion model, and the candidate coding parameter with the smallest distortion value is used as the target coding parameter of the current frame to be encoded. This process may be expressed by the following formula:

[0101] Formula (6)

[0102] In formula (6), represents the target encoding parameters, represents the distortion model, Indicates the encoding parameters (variables), represents a set formed by the above multiple candidate coding parameters. Therefore, through formula (6), the coding parameter with the smallest distortion value can be found from multiple candidate coding parameters, and then the target coding parameter of the current frame to be encoded can be obtained.

[0103] After obtaining the target encoding parameters of the current frame to be encoded through any of the above embodiments, step S300 can be performed to input the current frame to be encoded and its target encoding parameters into the video encoder, so that the video encoder encodes the current frame to be encoded with the target encoding parameters to obtain the actual bit rate and actual distortion value after the encoding. The video encoder can be a variable bit rate deep learning video encoder.

[0104] Then, the actual bit rate and the actual distortion value can be used to update the bit rate model and the distortion model respectively, so as to improve the accuracy of the subsequent target coding parameters, thereby providing a higher quality training sample for step S400. In this regard, in order to ensure the effective update of the bit rate model and the distortion model, in some embodiments, the embodiment of the present invention further provides an update scheme for the bit rate model and the distortion model, that is, in the above step S300, the step of updating the bit rate model and the distortion model according to the actual bit rate and the actual distortion value respectively includes:

[0105] In step S310, according to the actual bit rate and the predicted bit rate calculated by the bit rate model before updating based on the target coding parameters corresponding to the actual bit rate, the model parameters of the bit rate model are updated to obtain an updated bit rate model;

[0106] In step S320, the parameters of the distortion model are updated according to the actual distortion value and the predicted distortion value calculated by the distortion model before updating based on the target coding parameters corresponding to the actual distortion value to obtain an updated distortion model.

[0107] Step S310 is an update scheme of the bit rate model. In some implementations, the least mean square method may be used to update the model parameters of the bit rate model based on the actual bit rate and the predicted bit rate. The update process may be expressed by the following formula:

[0108] Formula (7)

[0109] Formula (8)

[0110] In formula (7) and formula (8), and are the two model parameters after the bit rate model is updated. and are the original model parameters of the bit rate model before updating, Indicates the actual bit rate, Indicates that the bitrate model before the update is based on the actual bitrate Corresponding target encoding parameters The predicted bit rate is calculated. Representation parameters The update range, Representation parameters The update range, and It can be set according to actual needs or experience, for example, Set to 0.5, Set to 0.1; Indicates the actual bit rate The corresponding target encoding parameters.

[0111] Next, and By replacing the corresponding original model parameters in the bit rate model, an updated bit rate model can be obtained.

[0112] Step S320 is an update scheme of the distortion model. In some implementations, the least mean square method may be used to update the model parameters of the distortion model based on the actual distortion value and the predicted distortion value. The update process may be expressed by the following formula:

[0113] Formula (9)

[0114] Formula (10)

[0115] In formula (9) and formula (10), and are the two model parameters after the distortion model is updated, and is the original model parameter of the distortion model before updating, represents the actual distortion value, Indicates the target coding parameters corresponding to the actual distortion value of the distortion model before update The predicted distortion value calculated is, Representation parameters The update range, Representation parameters The update range, and It can be set according to actual needs or experience, for example, Set to 0.5, Set to 0.1; Indicates the actual distortion value The corresponding target encoding parameters.

[0116] Next, and By replacing the corresponding original model parameters in the distortion model, an updated distortion model can be obtained.

[0117] After obtaining the updated bit rate model and distortion model, since the current frame to be encoded has been encoded, and in order to obtain more training samples, step S500 can be executed in no particular order with step S400 to take the next frame of the current frame to be encoded as the new current frame to be encoded, and return to execute the step of allocating bit rate to the current frame to be encoded of the encoded video according to the set target bit rate until the number of samples in the sample set reaches the set number threshold. It can be seen that as long as the number of samples does not reach the set number threshold, steps S100~S500 will be iteratively executed according to the new current frame to be encoded. In each iteration, it should be noted that the bit rate model and distortion model in step S200 are the bit rate model and distortion model updated after the previous iteration.

[0118] In addition, if the code rate allocation scheme shown in step S110 and step S120 is used to obtain the frame-level code rate of the current frame to be encoded, then in the iterative process, if it is necessary to further improve the iteration efficiency, if the current frame to be encoded and the previous frame belong to the same GOP image group, then step S110 may not be performed, but the group-level code rate obtained when the code rate is allocated to the previous frame may be directly used to determine the frame-level code rate allocated to the current frame to be encoded through step S120. On the contrary, if the current frame to be encoded and the previous frame belong to different GOP image groups, steps S110 and S120 need to be performed to obtain the frame-level code rate allocated to the current frame to be encoded.

[0119] Regardless of the order of step S300, during the execution of step S400, for each current frame to be encoded, feature information of the current frame to be encoded, the corresponding target bit rate, the ratio of the bit rate consumed by the current encoded frame to the corresponding target bit rate, and the frame number of the current frame to be encoded can be used as a group of training samples and stored in a sample set.

[0120] In the above, the characteristic information may include but is not limited to: the pixel mean of the current frame to be encoded, the pixel variance of the current frame to be encoded, the difference between the pixel mean of the current frame to be encoded and the pixel mean of the previous frame, the difference between the pixel variance of the current frame to be encoded and the pixel variance of the previous frame, the sum of the pixel means of all remaining frames in the target GOP image group where the current frame to be encoded is located, the sum of the pixel variances of all remaining frames in the target GOP image group, the sum of the differences between the pixel means of each adjacent two remaining frames in the target GOP image group, and the sum of the differences between the pixel variances of each adjacent two remaining frames in the target GOP image group.

[0121] To facilitate understanding of the meaning of the above-mentioned characteristic information related to the GOP image group, an example is given below for explanation:

[0122] Assume that there are a total of 3 remaining frames in the target GOP image group, and the remaining frames are frames in the target GOP image group except the key frames. The pixel means of these 3 remaining frames are A1, A2 and A3, and the pixel variances are B1, B2 and B3, respectively. The difference between the pixel means of the second remaining frame and the first remaining frame is A2-A1, the difference between the pixel means of the third remaining frame and the second remaining frame is A3-A2, the difference between the pixel variances of the second remaining frame and the first remaining frame is B2-B1, and the difference between the pixel variances of the third remaining frame and the second remaining frame is B3-B2.

[0123] Based on this, the sum of the pixel means of all remaining frames in the target GOP image group where the current frame to be encoded is located is: A1+A2+A3, the sum of the pixel variances of all remaining frames in the target GOP image group is: B1+B2+B3, the sum of the differences between the pixel means of each adjacent two remaining frames in the target GOP image group is: A2-A1+A3-A2, and the sum of the differences between the pixel variances of each adjacent two remaining frames in the target GOP image group is: B2-B1+B3-B2.

[0124] After each set of samples is obtained, an addition operation can be performed on the basis of the original sample quantity to obtain the current sample quantity in the sample set. When the current sample quantity reaches the set quantity threshold, step S600 can be performed to train the original model using the sample set to obtain the coding rate control model. The quantity threshold can be set based on experience or experiments, and the embodiment of the present invention does not limit this. The training principle of the model is the same as the training principle of the neural network model in the related art, so it is not described in detail here.

[0125] In some examples, in order to ensure the accuracy of the encoding rate control model while reducing the training burden of the encoding rate control model, the original model can adopt a model architecture with three fully connected layers.

[0126] The method for constructing a rate control model suitable for rural power grid construction supervision provided by the embodiment of the present invention can obtain a rate control accuracy of more than 92% by constructing a coding rate control model: by using the coding rate control model to perform rate control based on three target rates - 0.02, 0.025 and 0.03, the following can be obtained: Figure 3 The rate-distortion curves before and after rate control are shown. Figure 3It is a schematic diagram of a rate-distortion curve before and after rate control provided by an embodiment of the present invention. In the figure, the horizontal axis represents the rate, and the vertical axis represents the average peak signal-to-noise ratio (Average Peak Signal to Noise Ratio, Avg PSNR). Avg PSNR is used to indicate the degree of difference between the original image and the decoded image. The higher its value, the better the quality of the processed image relative to the original image. The red curve in the figure is the result of video encoding with fixed encoding parameters, and the blue curve in the figure is the rate control result of the encoding rate control model constructed by the embodiment of the present invention. It can be seen that under the premise of controlling the encoder to encode at the target rate, the Avg PSNR does not decrease, and the rate control accuracy is shown in Table 2:

[0127] Table 2 Bit rate control accuracy table

[0128]

[0129] In addition, the bit rate change of each frame in the GOP image group after the bit rate control model is performed is as follows: Figure 4a~Figure 4c As shown, Figure 4a 1 is a schematic diagram of a bit rate variation curve of each frame in a GOP image group when a target bit rate is 0.02 provided by an embodiment of the present invention. Figure 4b 1 is a schematic diagram of a bit rate variation curve of each frame in a GOP image group when a target bit rate is 0.025 provided by an embodiment of the present invention. Figure 4c 1 is a schematic diagram of a bit rate variation curve of each frame in a GOP image group when a target bit rate is 0.03 provided by an embodiment of the present invention. Figure 4a~Figure 4c In the figure, the horizontal axis represents the frame number of each frame in the GOP image group, and the vertical axis represents the bit rate. It can be seen that no matter which target bit rate is, the bit rate change of each frame in the GOP image group basically conforms to the weight under the corresponding bit rate in Table 1.

[0130] The peak signal to noise ratio (PSNR) of each frame in the GOP image group changes as follows: Figure 5a~Figure 5c As shown, Figure 5a 1 is a schematic diagram of a PSNR variation curve corresponding to each frame in a GOP image group when a target bit rate is 0.02 provided by an embodiment of the present invention. Figure 5b 1 is a schematic diagram of a PSNR variation curve corresponding to each frame in a GOP image group when a target bit rate is 0.025 provided by an embodiment of the present invention. Figure 5c 1 is a schematic diagram of a PSNR variation curve corresponding to each frame in a GOP image group when a target bit rate is 0.03 provided by an embodiment of the present invention. Figure 5a~Figure 5cIn FIG. 5 , the horizontal axis represents the frame number of each frame in the GOP image group, and the vertical axis represents the PSNR value. It can be seen that the change trend of the PSNR change curve is consistent with the change trend of the bit rate of each frame in the GOP image group corresponding to the target bit rate.

[0131] In addition to being able to achieve precise control of the bit rate, the time required for bit rate control through the encoding bit rate control model is also reduced: after actual comparison, the time taken by the traditional technology to implement bit rate control (excluding encoding) is 21.1s per frame; while the time taken by the encoding bit rate control model to implement bit rate control (excluding encoding) is 0.0015s per frame. It can be seen that the encoding bit rate control model provided in the embodiment of the present invention has a more efficient bit rate control efficiency.

[0132] After the coding rate control model is obtained, the coding rate control model can be applied in an actual scenario to implement rate control. To this end, an embodiment of the present invention further provides a rate control method, including:

[0133] In step S1000, a current target encoding parameter for controlling the current encoding rate of an existing video encoder is obtained based on the input current frame to be encoded and the current target rate through the pre-constructed encoding rate control model; wherein the encoding rate control model is constructed by the rate control model construction method suitable for rural power grid construction supervision in any of the above embodiments;

[0134] In step S2000, the current frame to be encoded and the current target encoding parameters are input to the video encoder to control the video encoder to encode the current frame to be encoded according to the current target encoding parameters.

[0135] Therefore, through step S1000 and step S2000, efficient and accurate control of the encoding bit rate can be achieved.

[0136] It is worth noting that the technical features or technical solutions in any of the above embodiments of the present invention can be combined with each other as long as there is no combination contradiction. In addition, the method for constructing a rate control model suitable for rural power grid construction supervision provided by the embodiment of the present invention can be applied to encoding rate control in various video fields not limited to the field of rural power grid construction supervision.

[0137] In order to execute the above-mentioned embodiments of the method for constructing a rate control model suitable for rural power grid construction supervision and the corresponding steps in each possible manner, a method for implementing a rate control model construction device suitable for rural power grid construction supervision is given below. Optionally, the rate control model construction device suitable for rural power grid construction supervision can adopt the above-mentioned Figure 1 For further information, please refer to Figure 6 , Figure 6A functional module diagram of a rate control model construction device suitable for rural power grid construction supervision provided by an embodiment of the present invention. It should be noted that the basic principle and technical effects of the rate control model construction device suitable for rural power grid construction supervision provided by this embodiment are the same as those of the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, please refer to the corresponding contents in the above embodiments. The rate control model construction device 800 suitable for rural power grid construction supervision includes:

[0138] The bit rate allocation module 810 is configured to: perform bit rate allocation on the current frame to be encoded of the video to be encoded according to the set target bit rate, and obtain the frame level bit rate of the current frame to be encoded;

[0139] The coding parameter determination module 820 is configured to: obtain a target coding parameter of the current frame to be encoded according to the frame level bit rate of the current frame to be encoded, the currently obtained bit rate model and the distortion model;

[0140] The model updating module 830 is configured to: input the current frame to be encoded and its target encoding parameters into an existing video encoder for encoding, obtain an actual bit rate and an actual distortion value after the encoding, and update the bit rate model and the distortion model according to the actual bit rate and the actual distortion value respectively;

[0141] The sample acquisition module 840 is configured to: for each current frame to be encoded, use the feature information of the current frame to be encoded, the target bit rate, the ratio of the bit rate consumed by the current encoded frame to the target bit rate, and the frame number of the current frame to be encoded as a group of training samples to obtain a sample set formed by the training samples corresponding to each frame in the video to be encoded;

[0142] The iteration module 850 is configured to: take the next frame of the current frame to be encoded as a new current frame to be encoded, and trigger the bit rate allocation module, the encoding parameter determination module, the model update module and the sample acquisition module to iteratively run until the number of samples in the sample set reaches a set number threshold;

[0143] The training module 860 is configured to: when the number of samples in the sample set reaches the number threshold, use the sample set to train the original model to obtain a coding rate control model; the coding rate control model is used to obtain a target coding parameter for controlling the coding rate of the video encoder based on the actual target rate and feature information of the actual video to be encoded.

[0144] In some embodiments, the bit rate control model construction device 800 suitable for rural power grid construction supervision may also include:

[0145] The model initialization module is configured to: encode the first frame or any frame in the video to be encoded by using different multiple encoding parameters to obtain the bit rates and distortion values ​​corresponding to the multiple encoding parameters; construct a bit rate model for characterizing the relationship between the encoding parameters and the bit rates according to the multiple encoding parameters and their corresponding bit rates; construct a distortion model for characterizing the relationship between the encoding parameters and the distortion values ​​according to the multiple encoding parameters and their corresponding distortion values.

[0146] In some embodiments, the video to be encoded includes a plurality of GOP groups of images; the rate allocation module 810 allocates the rate of the current frame to be encoded of the video to be encoded according to the set target rate to obtain the frame level rate of the current frame to be encoded, and is configured as follows:

[0147] Determine the group-level bit rate allocated to each GOP group of images according to the target bit rate, the bit rate consumed by the currently encoded frame, and the number of currently encoded frames;

[0148] The frame-level bit rate allocated to the current frame to be encoded is determined according to the group-level bit rate corresponding to the target GOP image group where the current frame to be encoded is located, the bit rate consumed by the encoded frames in the target GOP image group and the bit rate weight of the current frame to be encoded.

[0149] In some embodiments, the process of obtaining the target coding parameter of the current frame to be encoded by the coding parameter determination module 820 according to the frame level code rate of the current frame to be encoded, the currently obtained code rate model and the distortion model is configured as follows:

[0150] Adjusting the frame level bit rate of the current frame to be encoded according to a preset error tolerance rate to obtain an adjusted reference bit rate;

[0151] Acquire, by means of the bit rate model, a plurality of candidate coding parameters whose bit rates are less than or equal to the reference bit rate;

[0152] The distortion value corresponding to each candidate coding parameter is calculated by using the distortion model, and the candidate coding parameter with the smallest distortion value is used as the target coding parameter of the current frame to be encoded.

[0153] In some embodiments, the process of the model updating module 830 updating the bit rate model and the distortion model according to the actual bit rate and the actual distortion value, respectively, is configured as follows:

[0154] According to the actual bit rate and the predicted bit rate calculated by the bit rate model before updating based on the target coding parameters corresponding to the actual bit rate, the model parameters of the bit rate model are updated to obtain an updated bit rate model;

[0155] According to the actual distortion value and the predicted distortion value calculated by the distortion model before updating based on the target coding parameter corresponding to the actual distortion value, the parameters of the distortion model are updated to obtain an updated distortion model.

[0156] In some embodiments, the video to be encoded includes multiple GOP image groups; the characteristic information of the current frame to be encoded includes: the pixel mean of the current frame to be encoded, the pixel variance of the current frame to be encoded, the difference between the pixel mean of the current frame to be encoded and the pixel mean of the previous frame, the difference between the pixel variance of the current frame to be encoded and the pixel variance of the previous frame, the sum of the pixel means of all remaining frames in the target GOP image group where the current frame to be encoded is located, the sum of the pixel variances of all remaining frames in the target GOP image group, the sum of the differences between the pixel means of each two adjacent remaining frames in the target GOP image group, and the sum of the differences between the pixel variances of each two adjacent remaining frames in the target GOP image group.

[0157] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory shown in the figure or solidified in the operating system (OS) of the electronic device, and can be Figure 1 Meanwhile, the data and program codes required for executing the above modules can be stored in the memory.

[0158] In order to execute the corresponding steps in the above-mentioned embodiments of the bit rate control method and various possible methods, a method for implementing a bit rate control device is given below. Optionally, the bit rate control device can adopt the above-mentioned Figure 1 For further information, please refer to Figure 7 , Figure 7 This is a functional module diagram of a rate control device provided by an embodiment of the present invention. It should be noted that the basic principle and technical effects of the rate control device provided by this embodiment are the same as those of the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments. The rate control device 900 includes:

[0159] The encoding parameter output module 910 is configured to: obtain a current target encoding parameter for controlling a current encoding rate of an existing video encoder based on an input current frame to be encoded and a current target rate through a pre-built encoding rate control model;

[0160] The encoding control module 920 is configured to: input the current frame to be encoded and the current target encoding parameter to the video encoder, so as to control the video encoder to encode the current frame to be encoded according to the current target encoding parameter;

[0161] The coding rate control model is constructed by the rate control model construction device suitable for rural power grid construction supervision in the above embodiment.

[0162] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory shown in the figure or solidified in the operating system (OS) of the electronic device, and can be Figure 1 Meanwhile, the data and program codes required for executing the above modules can be stored in the memory.

[0163] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0164] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0165] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0166] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for constructing a rate control model suitable for rural power grid construction supervision, characterized in that: include: Performing code rate allocation on the current frame to be encoded of the video to be encoded according to the set target code rate to obtain the frame level code rate of the current frame to be encoded; Obtaining a target encoding parameter of the current frame to be encoded according to the frame level bit rate of the current frame to be encoded, a currently obtained bit rate model and a distortion model; The rate model is used to characterize the relationship between the coding parameter and the bit rate, the distortion model is used to characterize the relationship between the coding parameter and the distortion value, and the distortion value corresponding to the target coding parameter is the smallest or less than the set distortion threshold; Inputting the current frame to be encoded and its target encoding parameters into an existing video encoder for encoding, obtaining an actual bit rate and an actual distortion value after encoding, and updating the bit rate model and the distortion model according to the actual bit rate and the actual distortion value respectively; For each current frame to be encoded, feature information of the current frame to be encoded, the target bit rate, a ratio of the bit rate consumed by the current encoded frame to the target bit rate, and a frame number of the current frame to be encoded are used as a group of training samples to obtain a sample set formed by training samples corresponding to each frame in the video to be encoded; The next frame of the current frame to be encoded is used as a new current frame to be encoded, and the step of allocating bit rates for the current frame to be encoded according to the set target bit rate is returned to be executed until the number of samples in the sample set reaches the set number threshold; When the number of samples in the sample set reaches the number threshold, the original model is trained using the sample set to obtain a coding rate control model; the coding rate control model is used to obtain a target coding parameter for controlling the coding rate of the video encoder based on the actual target rate and feature information of the actual video to be encoded.

2. The method according to claim 1, characterized in that: The process of obtaining the initial bit rate model and distortion model before updating includes: Encoding the first frame or any frame in the to-be-encoded video respectively by using a plurality of different encoding parameters to obtain bit rates and distortion values ​​corresponding to the plurality of encoding parameters; According to the plurality of coding parameters and their respective corresponding bit rates, a bit rate model is constructed to characterize the relationship between the coding parameters and the bit rate; According to the multiple coding parameters and their corresponding distortion values, a distortion model for characterizing the relationship between the coding parameters and the distortion values ​​is constructed.

3. The method according to claim 1, characterized in that The video to be encoded includes a plurality of GOP image groups; the step of performing bit rate allocation on the current frame to be encoded of the video to be encoded according to the set target bit rate to obtain the frame level bit rate of the current frame to be encoded includes: Determine the group-level bit rate allocated to each GOP group of images according to the target bit rate, the bit rate consumed by the currently encoded frame, and the number of currently encoded frames; The frame-level bit rate allocated to the current frame to be encoded is determined according to the group-level bit rate corresponding to the target GOP image group where the current frame to be encoded is located, the bit rate consumed by the encoded frames in the target GOP image group and the bit rate weight of the current frame to be encoded.

4. The method according to claim 1, characterized in that The step of obtaining the target coding parameters of the current frame to be encoded according to the frame level code rate of the current frame to be encoded, the currently obtained code rate model and the distortion model comprises: Adjusting the frame level bit rate of the current frame to be encoded according to a preset error tolerance rate to obtain an adjusted reference bit rate; Acquire, by means of the bit rate model, a plurality of candidate coding parameters whose bit rates are less than or equal to the reference bit rate; The distortion value corresponding to each candidate coding parameter is calculated by using the distortion model, and the candidate coding parameter with the smallest distortion value is used as the target coding parameter of the current frame to be encoded.

5. The method according to claim 1, characterized in that The step of respectively updating the bit rate model and the distortion model according to the actual bit rate and the actual distortion value comprises: According to the actual bit rate and the predicted bit rate calculated by the bit rate model before updating based on the target coding parameters corresponding to the actual bit rate, the model parameters of the bit rate model are updated to obtain an updated bit rate model; According to the actual distortion value and the predicted distortion value calculated by the distortion model before updating based on the target coding parameter corresponding to the actual distortion value, the parameters of the distortion model are updated to obtain an updated distortion model.

6. The method according to claim 1, characterized in that The video to be encoded includes multiple GOP image groups; the feature information of the current frame to be encoded includes: the pixel mean of the current frame to be encoded, the pixel variance of the current frame to be encoded, the difference between the pixel mean of the current frame to be encoded and the pixel mean of the previous frame, the difference between the pixel variance of the current frame to be encoded and the pixel variance of the previous frame, the sum of the pixel means of all remaining frames in the target GOP image group where the current frame to be encoded is located, the sum of the pixel variances of all remaining frames in the target GOP image group, the sum of the differences between the pixel means of every two adjacent remaining frames in the target GOP image group, and the sum of the differences between the pixel variances of every two adjacent remaining frames in the target GOP image group.

7. A rate control method, characterized in that: include: By using the pre-built encoding rate control model, based on the input current frame to be encoded and the current target bit rate, a current target encoding parameter for controlling the current encoding bit rate of the existing video encoder is obtained; Inputting the current frame to be encoded and the current target encoding parameters into the video encoder to control the video encoder to encode the current frame to be encoded according to the current target encoding parameters; The coding rate control model is constructed by the rate control model construction method suitable for rural power grid construction supervision described in any one of claims 1 to 6.

8. A rate control model construction device suitable for rural power grid construction supervision, characterized in that: include: The bit rate allocation module is configured to: allocate bit rates for the current frame to be encoded of the video to be encoded according to the set target bit rate, so as to obtain the frame level bit rate of the current frame to be encoded; The coding parameter determination module is configured to: obtain a target coding parameter of the current frame to be encoded according to the frame level bit rate of the current frame to be encoded, the currently obtained bit rate model and the distortion model; The rate model is used to characterize the relationship between the coding parameter and the bit rate, the distortion model is used to characterize the relationship between the coding parameter and the distortion value, and the distortion value corresponding to the target coding parameter is the smallest or less than the set distortion threshold; The model updating module is configured to: input the current frame to be encoded and its target encoding parameters into an existing video encoder for encoding, obtain an actual bit rate and an actual distortion value after the encoding, and update the bit rate model and the distortion model according to the actual bit rate and the actual distortion value respectively; The sample acquisition module is configured to: for each current frame to be encoded, use the feature information of the current frame to be encoded, the target bit rate, the ratio of the bit rate consumed by the current encoded frame to the target bit rate, and the frame number of the current frame to be encoded as a group of training samples to obtain a sample set formed by the training samples corresponding to each frame in the video to be encoded; an iteration module, configured to: take the next frame of the current frame to be encoded as a new current frame to be encoded, and trigger the bit rate allocation module, the encoding parameter determination module, the model update module and the sample acquisition module to iteratively run until the number of samples in the sample set reaches a set number threshold; The training module is configured to: when the number of samples in the sample set reaches the number threshold, use the sample set to train the original model to obtain a coding rate control model; the coding rate control model is used to obtain a target coding parameter for controlling the coding rate of the video encoder based on the actual target rate and feature information of the actual video to be encoded.

9. A bit rate control device, characterized in that: include: The encoding parameter output module is configured to: obtain a current target encoding parameter for controlling a current encoding rate of an existing video encoder based on an input current frame to be encoded and a current target rate through a pre-built encoding rate control model; The encoding control module is configured to: input the current frame to be encoded and the current target encoding parameter to the video encoder, so as to control the video encoder to encode the current frame to be encoded according to the current target encoding parameter; Wherein, the coding rate control model is constructed by the rate control model construction device suitable for rural power grid construction supervision described in claim 8.

10. An electronic device, characterized in that: It includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the method for constructing a rate control model suitable for rural power grid construction supervision described in any one of claims 1 to 6, and / or the rate control method described in claim 7.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the method for constructing a rate control model suitable for rural power grid construction supervision described in any one of claims 1 to 6, and / or the rate control method described in claim 7.

Citation Information

Patent Citations

  • I-frame target bandwidth allocation method and device based on reinforcement learning

    CN112468808A

  • Enhanced R-Lambda code rate control method

    CN112995667A